From 5920a6ee1d8fea4d195e3e50e637201e499c544e Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Mon, 12 Mar 2018 11:35:23 -0700 Subject: [PATCH 01/25] Add rust template from cargo --- rust/sbp/Cargo.toml | 6 ++++++ rust/sbp/src/lib.rs | 7 +++++++ 2 files changed, 13 insertions(+) create mode 100644 rust/sbp/Cargo.toml create mode 100644 rust/sbp/src/lib.rs diff --git a/rust/sbp/Cargo.toml b/rust/sbp/Cargo.toml new file mode 100644 index 0000000000..ce224b8651 --- /dev/null +++ b/rust/sbp/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "sbp" +version = "0.1.0" +authors = ["Gareth McMullin "] + +[dependencies] diff --git a/rust/sbp/src/lib.rs b/rust/sbp/src/lib.rs new file mode 100644 index 0000000000..31e1bb209f --- /dev/null +++ b/rust/sbp/src/lib.rs @@ -0,0 +1,7 @@ +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + assert_eq!(2 + 2, 4); + } +} From 1dfcb5b7ae43c1cf6b47ede1553b302a68f44f04 Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Mon, 12 Mar 2018 16:47:41 -0700 Subject: [PATCH 02/25] rust: First cut at frame decoding. --- rust/example/Cargo.toml | 12 ++++++++++ rust/example/src/main.rs | 30 ++++++++++++++++++++++++ rust/sbp/Cargo.toml | 4 +++- rust/sbp/src/client/framer.rs | 43 +++++++++++++++++++++++++++++++++++ rust/sbp/src/client/mod.rs | 2 ++ rust/sbp/src/lib.rs | 2 ++ 6 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 rust/example/Cargo.toml create mode 100644 rust/example/src/main.rs create mode 100644 rust/sbp/src/client/framer.rs create mode 100644 rust/sbp/src/client/mod.rs diff --git a/rust/example/Cargo.toml b/rust/example/Cargo.toml new file mode 100644 index 0000000000..6ad5946547 --- /dev/null +++ b/rust/example/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "example" +version = "0.1.0" +authors = ["Gareth McMullin "] + +[dependencies] +serialport = "2.1.0" +byteorder = "1.2.1" +crc16 = "*" + +[dependencies.sbp] +path = "../sbp" diff --git a/rust/example/src/main.rs b/rust/example/src/main.rs new file mode 100644 index 0000000000..5bd46294c2 --- /dev/null +++ b/rust/example/src/main.rs @@ -0,0 +1,30 @@ +extern crate serialport; +extern crate sbp; + +use serialport::prelude::*; +use std::time::Duration; + +fn main() { + let s = SerialPortSettings { + baud_rate: BaudRate::Baud115200, + data_bits: DataBits::Eight, + flow_control: FlowControl::None, + parity: Parity::None, + stop_bits: StopBits::One, + timeout: Duration::from_millis(100), + }; + + let mut port = serialport::open_with_settings("/dev/ttyUSB0", &s) + .expect("open failed"); + loop { + match sbp::client::framer::receive(&mut port) { + Ok(x) => { + println!("id = {}, sender = {}", x.msg_id, x.sender); + println!("{:?}\n", x.payload); + }, + Err(e) => { + println!("{:?}", e); + } + } + } +} diff --git a/rust/sbp/Cargo.toml b/rust/sbp/Cargo.toml index ce224b8651..d77cef4f77 100644 --- a/rust/sbp/Cargo.toml +++ b/rust/sbp/Cargo.toml @@ -1,6 +1,8 @@ [package] name = "sbp" version = "0.1.0" -authors = ["Gareth McMullin "] +authors = ["Gareth McMullin "] [dependencies] +byteorder = "1.2.1" +crc16 = "*" diff --git a/rust/sbp/src/client/framer.rs b/rust/sbp/src/client/framer.rs new file mode 100644 index 0000000000..2b7d0703a2 --- /dev/null +++ b/rust/sbp/src/client/framer.rs @@ -0,0 +1,43 @@ +extern crate byteorder; +extern crate crc16; + +use self::byteorder::{LittleEndian,ReadBytesExt}; +use std::io::{Read, Error, ErrorKind}; + +const SBP_PREAMBLE: u8 = 0x55; + +pub struct SBPMessage { + pub sender: u16, + pub msg_id: u16, + pub payload: Vec, +} + +pub fn receive(a: &mut Read) -> Result { + let mut preamble = [0]; + a.read_exact(&mut preamble)?; + if preamble[0] != SBP_PREAMBLE { + return Err(Error::new(ErrorKind::Other, "invalid preamble")); + } + let mut crc_state = crc16::State::::new(); + let mut header = [0; 5]; + a.read_exact(&mut header).expect("read failed"); + crc_state.update(&header); + let mut header = &header[..]; + let msg_id = header.read_u16::().unwrap(); + let sender = header.read_u16::().unwrap(); + let len = header.read_u8().unwrap() as usize; + println!("msg_id = {}, sender = {}, len = {}", msg_id, sender, len); + + let mut payload = [0; 256]; + let mut payload = &mut payload[..len]; + a.read_exact(&mut payload).expect("read failed"); + crc_state.update(&payload); + + let crc = a.read_u16::().unwrap(); + if crc != crc_state.get() { + return Err(Error::new(ErrorKind::Other, "CRC error")) + } + + let payload = payload.to_vec(); + Ok(SBPMessage{msg_id, sender, payload}) +} diff --git a/rust/sbp/src/client/mod.rs b/rust/sbp/src/client/mod.rs new file mode 100644 index 0000000000..def257e314 --- /dev/null +++ b/rust/sbp/src/client/mod.rs @@ -0,0 +1,2 @@ +pub mod framer; + diff --git a/rust/sbp/src/lib.rs b/rust/sbp/src/lib.rs index 31e1bb209f..0d1b227384 100644 --- a/rust/sbp/src/lib.rs +++ b/rust/sbp/src/lib.rs @@ -1,3 +1,5 @@ +pub mod client; + #[cfg(test)] mod tests { #[test] From 1e6e5dc34e7b48b60352bae71faf3ed72dbb9c9e Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Tue, 13 Mar 2018 10:40:47 -0700 Subject: [PATCH 03/25] rust: Message structure generation --- Makefile | 33 +++++++- generator/sbpg/generator.py | 8 +- .../resources/sbp_messages_template.rs | 44 +++++++++++ generator/sbpg/targets/rust.py | 76 +++++++++++++++++++ 4 files changed, 157 insertions(+), 4 deletions(-) create mode 100644 generator/sbpg/targets/resources/sbp_messages_template.rs create mode 100644 generator/sbpg/targets/rust.py diff --git a/Makefile b/Makefile index f216c67a71..3f17460878 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,14 @@ SBP_MAJOR_VERSION := $(word 1, $(subst ., , $(SBP_VERSION))) SBP_MINOR_VERSION := $(word 2, $(subst ., , $(SBP_VERSION))) SBP_PATCH_VERSION := $(word 3, $(subst ., , $(SBP_VERSION))) -.PHONY: help docs pdf html test release dist silly all docs pdf html c deps-c gen-c test-c python deps-python gen-python test-python javascript deps-javascript gen-javascript test-javascript java deps-java gen-java test-java haskell deps-generator deps-haskell gen-haskell test-haskell verify-prereq-generator verify-prereq-c verify-prereq-javascript verify-prereq-python verify-prereq-java verify-prereq-haskell mapping +.PHONY: help docs pdf html test release dist silly all docs pdf html +.PHONY: c deps-c gen-c test-c python deps-python gen-python test-python +.PHONY: javascript deps-javascript gen-javascript test-javascript +.PHONY: java deps-java gen-java test-java +.PHONY: haskell deps-generator deps-haskell gen-haskell test-haskell +.PHONY: rust deps-rust gen-rust test-rust +.PHONY: verify-prereq-generator verify-prereq-c verify-prereq-javascript +.PHONY: verify-prereq-python verify-prereq-java verify-prereq-haskell verify-prereq-rust mapping # Functions define announce-begin @@ -48,11 +55,12 @@ help: @echo " python to make Python bindings" @echo " haskell to make Haskell bindings" @echo " java to make Java bindings" + @echo " rust to make Rust bindings" @echo " release to handle some release tasks" @echo " test to run all tests" @echo -all: deps-generator c python javascript java docs haskell +all: deps-generator c python javascript java docs haskell rust docs: verify-prereq-docs deps-generator pdf html c: deps-c gen-c test-c @@ -60,6 +68,7 @@ python: deps-python gen-python test-python javascript: deps-javascript gen-javascript test-javascript java: deps-java gen-java test-java haskell: deps-haskell gen-haskell test-haskell +rust: deps-rust gen-rust test-rust # Prerequisite verification verify-prereq-generator: @@ -87,6 +96,8 @@ verify-prereq-java: ; verify-prereq-haskell: ; +verify-prereq-rust: ; + verify-prereq-docs: @command -v pdflatex 1>/dev/null 2>/dev/null || { echo >&2 -e "I require \`pdflatex\` but it's not installed. Aborting.\n\nHave you installed pdflatex? See the generator readme (Installing instructions) at \`generator/README.md\` for setup instructions.\n"; exit 1; } @@ -106,6 +117,8 @@ deps-java: verify-prereq-java deps-haskell: verify-prereq-haskell +deps-rust: verify-prereq-rust + # Generators gen-c: @@ -165,9 +178,18 @@ gen-haskell: --haskell $(call announce-begin,"Finished generating Haskell bindings") +gen-rust: + $(call announce-begin,"Generating Rust bindings") + cd $(SWIFTNAV_ROOT)/generator; \ + $(SBP_GEN_BIN) -i $(SBP_SPEC_DIR) \ + -o $(SWIFTNAV_ROOT)/rust/ \ + -r $(SBP_MAJOR_VERSION).$(SBP_MINOR_VERSION).$(SBP_PATCH_VERSION) \ + --rust + $(call announce-begin,"Finished generating Rust bindings") + # Testers -test: test-all-begin test-c test-java test-python test-haskell test-javascript test-all-end +test: test-all-begin test-c test-java test-python test-haskell test-javascript test-rust test-all-end test-all-begin: $(call announce-begin,"Running all tests") @@ -204,6 +226,11 @@ test-haskell: cd $(SWIFTNAV_ROOT)/haskell/ && stack build --test --allow-different-user $(call announce-end,"Finished running Haskell tests") +test-rust: + $(call announce-begin,"Running Rust tests") + cd $(SWIFTNAV_ROOT)/rust/sbp && cargo test + $(call announce-end,"Finished running Rust tests") + dist: $(call announce-begin,"Deploying packages") pushd $(SWIFTNAV_ROOT)/python diff --git a/generator/sbpg/generator.py b/generator/sbpg/generator.py index 118b7d4686..f40469d4b1 100755 --- a/generator/sbpg/generator.py +++ b/generator/sbpg/generator.py @@ -25,6 +25,7 @@ import sbpg.targets.haskell as hs import sbpg.targets.python as py import sbpg.targets.javascript as js +import sbpg.targets.rust as rs def get_args(): parser = argparse.ArgumentParser(description='Swift Navigation SBP generator.') @@ -56,6 +57,9 @@ def get_args(): parser.add_argument('--java', action="store_true", help='Target language: Java!') + parser.add_argument('--rust', + action="store_true", + help='Target language: Rust.') parser.add_argument('--latex', action="store_true", help='Target language: LaTeX.') @@ -76,7 +80,7 @@ def main(): # Parse and validate arguments. args = get_args().parse_args() verbose = args.verbose - assert args.python or args.javascript or args.c or args.test_c or args.haskell or args.latex or args.java, \ + assert args.python or args.javascript or args.c or args.test_c or args.haskell or args.latex or args.java or args.rust, \ "Please specify a target language." input_file = os.path.abspath(args.input_file[0]) assert len(args.input_file) == 1 @@ -128,6 +132,8 @@ def main(): hs.render_source(output_dir, parsed) elif args.java: java.render_source(output_dir, parsed) + elif args.rust: + rs.render_source(output_dir, parsed) if args.c: c.render_version(output_dir, args.release[0]) elif args.haskell: diff --git a/generator/sbpg/targets/resources/sbp_messages_template.rs b/generator/sbpg/targets/resources/sbp_messages_template.rs new file mode 100644 index 0000000000..6b445f81cb --- /dev/null +++ b/generator/sbpg/targets/resources/sbp_messages_template.rs @@ -0,0 +1,44 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/(((filepath))) +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +(((description|commentify))) + +((*- for i in includes *)) +use super::(((i)))::*; +((*- endfor *)) + +((* for m in msgs *)) +((*- if m.desc *)) +// (((m.short_desc))) +// +(((m.desc|commentify))) +// +((*- endif *)) +((*- if m.fields *)) +((*- if m.sbp_id *)) +pub struct (((m.identifier|camel_case))) { +((*- else *)) +pub struct (((m.identifier))) { +((*- endif *)) + ((*- for f in m.fields *)) + pub (((f.identifier))): (((f|type_map))), + ((*- if f.desc *)) + // ^ (((f.desc | replace("\n", " ") | wordwrap(width=72, wrapstring="\n // ")))) + ((*- endif *)) + ((*- endfor *)) +} +((*- endif *)) + +((* endfor *)) diff --git a/generator/sbpg/targets/rust.py b/generator/sbpg/targets/rust.py new file mode 100644 index 0000000000..4bb6208c0f --- /dev/null +++ b/generator/sbpg/targets/rust.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python +# Copyright (C) 2018 Swift Navigation Inc. +# Contact: Gareth McMullin +# +# This source is subject to the license found in the file 'LICENSE' which must +# be be distributed together with this source. All other rights reserved. +# +# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +""" +Generator for rust target. +""" + +from sbpg.targets.templating import * +from sbpg.utils import markdown_links + +MESSAGES_TEMPLATE_NAME = "sbp_messages_template.rs" + +def camel_case(s): + """ + Makes a classname. + """ + return ''.join(w if w in ACRONYMS else w.title() for w in s.split('_')) + +def commentify(value): + """ + Builds a comment. + """ + value = markdown_links(value) + if value is None: + return + if len(value.split('\n')) == 1: + return "// " + value + else: + return '\n'.join(['// ' + l for l in value.split('\n')[:-1]]) + +TYPE_MAP = {'s8': 'i8', + 's16': 'i16', + 's32': 'i32', + 's64': 'i64', + 'float': 'f32', + 'double': 'f64', + 'string': 'String'} + +def type_map(field): + if TYPE_MAP.has_key(field.type_id): + return TYPE_MAP[field.type_id] + elif field.type_id == 'array': + t = field.options['fill'].value + return "Vec<{}>".format(TYPE_MAP.get(t, t)) + else: + return field.type_id + +JENV.filters['camel_case'] = camel_case +JENV.filters['commentify'] = commentify +JENV.filters['type_map'] = type_map + +def render_source(output_dir, package_spec): + """ + Render and output to a directory given a package specification. + """ + path, name = package_spec.filepath + destination_filename = "%s/sbp/src/messages/%s.rs" % (output_dir, name) + py_template = JENV.get_template(MESSAGES_TEMPLATE_NAME) + includes = [x.rsplit('.')[0] for x in package_spec.includes] + if 'types' in includes: + del includes[includes.index('types')] + with open(destination_filename, 'w') as f: + f.write(py_template.render(msgs=package_spec.definitions, + pkg_name=name, + filepath="/".join(package_spec.filepath) + ".yaml", + description=package_spec.description, + timestamp=package_spec.creation_timestamp, + includes=includes)) From 405837034d512a0326062b939e8f7242d8caa69b Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Tue, 13 Mar 2018 16:42:35 -0700 Subject: [PATCH 04/25] rust: Try parsing messages --- generator/sbpg/generator.py | 3 + .../targets/resources/sbp_messages_mod.rs | 42 +++++++++++ .../resources/sbp_messages_template.rs | 28 ++++++-- generator/sbpg/targets/rust.py | 70 ++++++++++++++++++- rust/example/src/main.rs | 5 +- rust/sbp/src/client/framer.rs | 13 +--- rust/sbp/src/lib.rs | 12 ++++ 7 files changed, 151 insertions(+), 22 deletions(-) create mode 100644 generator/sbpg/targets/resources/sbp_messages_mod.rs diff --git a/generator/sbpg/generator.py b/generator/sbpg/generator.py index f40469d4b1..c8eeec1796 100755 --- a/generator/sbpg/generator.py +++ b/generator/sbpg/generator.py @@ -143,6 +143,9 @@ def main(): elif args.java: parsed = [yaml.parse_spec(spec) for spec in file_index.values()] java.render_table(output_dir, parsed) + elif args.rust: + parsed = [yaml.parse_spec(spec) for spec in file_index.values()] + rs.render_mod(output_dir, parsed) elif args.test_c: test_c.render_check_suites(output_dir, all_specs) test_c.render_check_main(output_dir, all_specs) diff --git a/generator/sbpg/targets/resources/sbp_messages_mod.rs b/generator/sbpg/targets/resources/sbp_messages_mod.rs new file mode 100644 index 0000000000..43d6f7e54b --- /dev/null +++ b/generator/sbpg/targets/resources/sbp_messages_mod.rs @@ -0,0 +1,42 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +((*- for m in mods *)) +pub mod (((m))); +((*- endfor *)) + +use std::io::Read; + +((*- for p in packages *)) +((*- for m in p.definitions *)) +((*- if m.sbp_id *)) +use self::(((p.identifier|mod_name)))::(((m.identifier|camel_case))); +((*- endif *)) +((*- endfor *)) +((*- endfor *)) + +#[derive(Debug)] +pub enum SBP { + Unknown { id: u16 }, + ((*- for m in msgs *)) + (((m.identifier|camel_case)))( (((m.identifier|camel_case))) ), + ((*- endfor *)) +} + +impl SBP { + pub fn parse(id: u16, payload: &mut &[u8]) -> SBP { + match id { + ((*- for m in msgs *)) + (((m.sbp_id))) => SBP::(((m.identifier|camel_case)))( (((m.identifier|camel_case)))::parse(payload) ), + ((*- endfor *)) + _ => SBP::Unknown {id} + } + } +} diff --git a/generator/sbpg/targets/resources/sbp_messages_template.rs b/generator/sbpg/targets/resources/sbp_messages_template.rs index 6b445f81cb..59dfe558e5 100644 --- a/generator/sbpg/targets/resources/sbp_messages_template.rs +++ b/generator/sbpg/targets/resources/sbp_messages_template.rs @@ -14,6 +14,9 @@ //****************************************************************************/ (((description|commentify))) +extern crate byteorder; +use std::io::Read; +use self::byteorder::{LittleEndian,ReadBytesExt}; ((*- for i in includes *)) use super::(((i)))::*; @@ -26,12 +29,8 @@ use super::(((i)))::*; (((m.desc|commentify))) // ((*- endif *)) -((*- if m.fields *)) -((*- if m.sbp_id *)) +#[derive(Debug)] pub struct (((m.identifier|camel_case))) { -((*- else *)) -pub struct (((m.identifier))) { -((*- endif *)) ((*- for f in m.fields *)) pub (((f.identifier))): (((f|type_map))), ((*- if f.desc *)) @@ -39,6 +38,23 @@ pub struct (((m.identifier))) { ((*- endif *)) ((*- endfor *)) } -((*- endif *)) + +impl (((m.identifier|camel_case))) { + ((*- if m.sbp_id *)) + pub const TYPE: u16 = (((m.sbp_id))); + ((*- endif *)) + pub fn parse(buf: &mut Read) -> (((m.identifier|camel_case))) { + (((m.identifier|camel_case))){ + ((*- for f in m.fields *)) + (((f.identifier))): (((f|parse_type))), + ((*- endfor *)) + } + } + ((*- if not m.sbp_id *)) + pub fn parse_array(buf: &mut Read) -> Vec<(((m.identifier|camel_case)))> { + Vec::new() + } + ((*- endif *)) +} ((* endfor *)) diff --git a/generator/sbpg/targets/rust.py b/generator/sbpg/targets/rust.py index 4bb6208c0f..1363ec1548 100644 --- a/generator/sbpg/targets/rust.py +++ b/generator/sbpg/targets/rust.py @@ -17,11 +17,15 @@ from sbpg.utils import markdown_links MESSAGES_TEMPLATE_NAME = "sbp_messages_template.rs" +MESSAGES_MOD_TEMPLATE_NAME = "sbp_messages_mod.rs" +import re def camel_case(s): """ Makes a classname. """ + if '_' not in s: return s + s = re.sub('([a-z])([A-Z])', r'\1_\2', s) return ''.join(w if w in ACRONYMS else w.title() for w in s.split('_')) def commentify(value): @@ -36,7 +40,11 @@ def commentify(value): else: return '\n'.join(['// ' + l for l in value.split('\n')[:-1]]) -TYPE_MAP = {'s8': 'i8', +TYPE_MAP = {'u8': 'u8', + 'u16': 'u16', + 'u32': 'u32', + 'u64': 'u64', + 's8': 'i8', 's16': 'i16', 's32': 'i32', 's64': 'i64', @@ -53,9 +61,48 @@ def type_map(field): else: return field.type_id +def mod_name(x): + return x.split('.', 2)[2] + +def parse_type(field): + """ + Function to pull a type from the binary payload. + """ + if field.type_id == 'string': + if field.options.has_key('size'): + return "::read_string_limit(buf, %s)" % field.options['size'].value + else: + return "::read_string(buf)" + elif field.type_id == 'u8': + return 'buf.read_u8().unwrap()' + elif field.type_id == 's8': + return 'buf.read_i8().unwrap()' + elif field.type_id in TYPE_MAP.keys(): + # Primitive java types have extractor methods in SBPMessage.Parser + return 'buf.read_%s::().unwrap()' % TYPE_MAP[field.type_id] + if field.type_id == 'array': + # Call function to build array + t = field.options['fill'].value + return 'Vec::new()' + if t in TYPE_MAP.keys(): + if field.options.has_key('size'): + return '0' #"parser.getArrayof%s(%d)" % (t.capitalize(), field.options['size'].value) + else: + return '0' #"parser.getArrayof%s()" % t.capitalize() + else: + if field.options.has_key('size'): + return '0' #"parser.getArray(%s.class, %d)" % (t, field.options['size'].value) + else: + return '0' #"parser.getArray(%s.class)" % t + else: + # This is an inner class, call default constructor + return "%s::parse(buf)" % field.type_id + JENV.filters['camel_case'] = camel_case JENV.filters['commentify'] = commentify JENV.filters['type_map'] = type_map +JENV.filters['mod_name'] = mod_name +JENV.filters['parse_type'] = parse_type def render_source(output_dir, package_spec): """ @@ -64,7 +111,7 @@ def render_source(output_dir, package_spec): path, name = package_spec.filepath destination_filename = "%s/sbp/src/messages/%s.rs" % (output_dir, name) py_template = JENV.get_template(MESSAGES_TEMPLATE_NAME) - includes = [x.rsplit('.')[0] for x in package_spec.includes] + includes = [x.rsplit('.', 1)[0] for x in package_spec.includes] if 'types' in includes: del includes[includes.index('types')] with open(destination_filename, 'w') as f: @@ -74,3 +121,22 @@ def render_source(output_dir, package_spec): description=package_spec.description, timestamp=package_spec.creation_timestamp, includes=includes)) + +def render_mod(output_dir, package_specs): + msgs = [] + mods = [] + for package_spec in package_specs: + if not package_spec.render_source: + continue + name = package_spec.identifier.split('.', 2)[2] + if name != 'types': + mods.append(name) + for m in package_spec.definitions: + if m.static and m.sbp_id: + msgs.append(m) + destination_filename = "%s/sbp/src/messages/mod.rs" % output_dir + py_template = JENV.get_template(MESSAGES_MOD_TEMPLATE_NAME) + with open(destination_filename, 'w') as f: + f.write(py_template.render(packages=package_specs, + mods=mods, + msgs=sorted(msgs))) diff --git a/rust/example/src/main.rs b/rust/example/src/main.rs index 5bd46294c2..242579febb 100644 --- a/rust/example/src/main.rs +++ b/rust/example/src/main.rs @@ -18,10 +18,7 @@ fn main() { .expect("open failed"); loop { match sbp::client::framer::receive(&mut port) { - Ok(x) => { - println!("id = {}, sender = {}", x.msg_id, x.sender); - println!("{:?}\n", x.payload); - }, + Ok(x) => println!("{:?}", x), Err(e) => { println!("{:?}", e); } diff --git a/rust/sbp/src/client/framer.rs b/rust/sbp/src/client/framer.rs index 2b7d0703a2..b9fc514ce1 100644 --- a/rust/sbp/src/client/framer.rs +++ b/rust/sbp/src/client/framer.rs @@ -3,16 +3,11 @@ extern crate crc16; use self::byteorder::{LittleEndian,ReadBytesExt}; use std::io::{Read, Error, ErrorKind}; +use ::messages::SBP; const SBP_PREAMBLE: u8 = 0x55; -pub struct SBPMessage { - pub sender: u16, - pub msg_id: u16, - pub payload: Vec, -} - -pub fn receive(a: &mut Read) -> Result { +pub fn receive(a: &mut Read) -> Result { let mut preamble = [0]; a.read_exact(&mut preamble)?; if preamble[0] != SBP_PREAMBLE { @@ -26,7 +21,6 @@ pub fn receive(a: &mut Read) -> Result { let msg_id = header.read_u16::().unwrap(); let sender = header.read_u16::().unwrap(); let len = header.read_u8().unwrap() as usize; - println!("msg_id = {}, sender = {}, len = {}", msg_id, sender, len); let mut payload = [0; 256]; let mut payload = &mut payload[..len]; @@ -38,6 +32,5 @@ pub fn receive(a: &mut Read) -> Result { return Err(Error::new(ErrorKind::Other, "CRC error")) } - let payload = payload.to_vec(); - Ok(SBPMessage{msg_id, sender, payload}) + Ok(SBP::parse(msg_id, &mut &payload[..])) } diff --git a/rust/sbp/src/lib.rs b/rust/sbp/src/lib.rs index 0d1b227384..1c6bb7ccbd 100644 --- a/rust/sbp/src/lib.rs +++ b/rust/sbp/src/lib.rs @@ -1,4 +1,16 @@ pub mod client; +pub mod messages; + +use std::io::Read; +fn read_string(buf: &mut Read) -> String { + let mut s = String::new(); + buf.read_to_string(&mut s).unwrap(); + s +} + +fn read_string_limit(buf: &mut Read, n: u64) -> String { + read_string(&mut buf.take(n)) +} #[cfg(test)] mod tests { From 37cd827b4a12a3121bda1946ed7edd1b28c836fe Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Tue, 13 Mar 2018 18:09:13 -0700 Subject: [PATCH 05/25] rust: Parse arrays and clean up warnings. --- .../targets/resources/sbp_messages_mod.rs | 2 -- .../resources/sbp_messages_template.rs | 21 +++++++++++++---- generator/sbpg/targets/rust.py | 21 ++++++++--------- rust/example/Cargo.toml | 2 -- rust/example/src/main.rs | 9 ++++++-- rust/sbp/src/client/framer.rs | 12 +++++----- rust/sbp/src/lib.rs | 23 +++++++++++++++++++ 7 files changed, 63 insertions(+), 27 deletions(-) diff --git a/generator/sbpg/targets/resources/sbp_messages_mod.rs b/generator/sbpg/targets/resources/sbp_messages_mod.rs index 43d6f7e54b..bc07a8d1ca 100644 --- a/generator/sbpg/targets/resources/sbp_messages_mod.rs +++ b/generator/sbpg/targets/resources/sbp_messages_mod.rs @@ -12,8 +12,6 @@ pub mod (((m))); ((*- endfor *)) -use std::io::Read; - ((*- for p in packages *)) ((*- for m in p.definitions *)) ((*- if m.sbp_id *)) diff --git a/generator/sbpg/targets/resources/sbp_messages_template.rs b/generator/sbpg/targets/resources/sbp_messages_template.rs index 59dfe558e5..aa788f2231 100644 --- a/generator/sbpg/targets/resources/sbp_messages_template.rs +++ b/generator/sbpg/targets/resources/sbp_messages_template.rs @@ -15,7 +15,7 @@ (((description|commentify))) extern crate byteorder; -use std::io::Read; +#[allow(unused_imports)] use self::byteorder::{LittleEndian,ReadBytesExt}; ((*- for i in includes *)) @@ -30,6 +30,7 @@ use super::(((i)))::*; // ((*- endif *)) #[derive(Debug)] +#[allow(non_snake_case)] pub struct (((m.identifier|camel_case))) { ((*- for f in m.fields *)) pub (((f.identifier))): (((f|type_map))), @@ -43,7 +44,7 @@ impl (((m.identifier|camel_case))) { ((*- if m.sbp_id *)) pub const TYPE: u16 = (((m.sbp_id))); ((*- endif *)) - pub fn parse(buf: &mut Read) -> (((m.identifier|camel_case))) { + pub fn parse(_buf: &mut &[u8]) -> (((m.identifier|camel_case))) { (((m.identifier|camel_case))){ ((*- for f in m.fields *)) (((f.identifier))): (((f|parse_type))), @@ -51,8 +52,20 @@ impl (((m.identifier|camel_case))) { } } ((*- if not m.sbp_id *)) - pub fn parse_array(buf: &mut Read) -> Vec<(((m.identifier|camel_case)))> { - Vec::new() + pub fn parse_array(buf: &mut &[u8]) -> Vec<(((m.identifier|camel_case)))> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( (((m.identifier|camel_case)))::parse(buf) ); + } + v + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Vec<(((m.identifier|camel_case)))> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( (((m.identifier|camel_case)))::parse(buf) ); + } + v } ((*- endif *)) } diff --git a/generator/sbpg/targets/rust.py b/generator/sbpg/targets/rust.py index 1363ec1548..29721fa50e 100644 --- a/generator/sbpg/targets/rust.py +++ b/generator/sbpg/targets/rust.py @@ -70,33 +70,32 @@ def parse_type(field): """ if field.type_id == 'string': if field.options.has_key('size'): - return "::read_string_limit(buf, %s)" % field.options['size'].value + return "::read_string_limit(_buf, %s)" % field.options['size'].value else: - return "::read_string(buf)" + return "::read_string(_buf)" elif field.type_id == 'u8': - return 'buf.read_u8().unwrap()' + return '_buf.read_u8().unwrap()' elif field.type_id == 's8': - return 'buf.read_i8().unwrap()' + return '_buf.read_i8().unwrap()' elif field.type_id in TYPE_MAP.keys(): # Primitive java types have extractor methods in SBPMessage.Parser - return 'buf.read_%s::().unwrap()' % TYPE_MAP[field.type_id] + return '_buf.read_%s::().unwrap()' % TYPE_MAP[field.type_id] if field.type_id == 'array': # Call function to build array t = field.options['fill'].value - return 'Vec::new()' if t in TYPE_MAP.keys(): if field.options.has_key('size'): - return '0' #"parser.getArrayof%s(%d)" % (t.capitalize(), field.options['size'].value) + return '::read_%s_array_limit(_buf, %d)' % (t, field.options['size'].value) else: - return '0' #"parser.getArrayof%s()" % t.capitalize() + return '::read_%s_array(_buf)' % t else: if field.options.has_key('size'): - return '0' #"parser.getArray(%s.class, %d)" % (t, field.options['size'].value) + return '%s::parse_array_limit(_buf, %d)' % (t, field.options['size'].value) else: - return '0' #"parser.getArray(%s.class)" % t + return '%s::parse_array(_buf)' % t else: # This is an inner class, call default constructor - return "%s::parse(buf)" % field.type_id + return "%s::parse(_buf)" % field.type_id JENV.filters['camel_case'] = camel_case JENV.filters['commentify'] = commentify diff --git a/rust/example/Cargo.toml b/rust/example/Cargo.toml index 6ad5946547..f67a97b85e 100644 --- a/rust/example/Cargo.toml +++ b/rust/example/Cargo.toml @@ -5,8 +5,6 @@ authors = ["Gareth McMullin "] [dependencies] serialport = "2.1.0" -byteorder = "1.2.1" -crc16 = "*" [dependencies.sbp] path = "../sbp" diff --git a/rust/example/src/main.rs b/rust/example/src/main.rs index 242579febb..48a8359893 100644 --- a/rust/example/src/main.rs +++ b/rust/example/src/main.rs @@ -3,6 +3,7 @@ extern crate sbp; use serialport::prelude::*; use std::time::Duration; +use sbp::messages::SBP; fn main() { let s = SerialPortSettings { @@ -11,14 +12,18 @@ fn main() { flow_control: FlowControl::None, parity: Parity::None, stop_bits: StopBits::One, - timeout: Duration::from_millis(100), + timeout: Duration::from_millis(1000), }; let mut port = serialport::open_with_settings("/dev/ttyUSB0", &s) .expect("open failed"); loop { match sbp::client::framer::receive(&mut port) { - Ok(x) => println!("{:?}", x), + Ok(SBP::MsgLog(x)) => println!("{}", x.text), + Ok(SBP::MsgPosLLH(x)) => { + println!("{} {} {}", x.lat, x.lon, x.height); + } + Ok(_) => (), Err(e) => { println!("{:?}", e); } diff --git a/rust/sbp/src/client/framer.rs b/rust/sbp/src/client/framer.rs index b9fc514ce1..3e6ef1bbeb 100644 --- a/rust/sbp/src/client/framer.rs +++ b/rust/sbp/src/client/framer.rs @@ -15,19 +15,19 @@ pub fn receive(a: &mut Read) -> Result { } let mut crc_state = crc16::State::::new(); let mut header = [0; 5]; - a.read_exact(&mut header).expect("read failed"); + a.read_exact(&mut header)?; crc_state.update(&header); let mut header = &header[..]; - let msg_id = header.read_u16::().unwrap(); - let sender = header.read_u16::().unwrap(); - let len = header.read_u8().unwrap() as usize; + let msg_id = header.read_u16::()?; + let _sender = header.read_u16::()?; + let len = header.read_u8()? as usize; let mut payload = [0; 256]; let mut payload = &mut payload[..len]; - a.read_exact(&mut payload).expect("read failed"); + a.read_exact(&mut payload)?; crc_state.update(&payload); - let crc = a.read_u16::().unwrap(); + let crc = a.read_u16::()?; if crc != crc_state.get() { return Err(Error::new(ErrorKind::Other, "CRC error")) } diff --git a/rust/sbp/src/lib.rs b/rust/sbp/src/lib.rs index 1c6bb7ccbd..18062737cf 100644 --- a/rust/sbp/src/lib.rs +++ b/rust/sbp/src/lib.rs @@ -1,7 +1,10 @@ pub mod client; pub mod messages; +extern crate byteorder; +use self::byteorder::{LittleEndian,ReadBytesExt}; use std::io::Read; + fn read_string(buf: &mut Read) -> String { let mut s = String::new(); buf.read_to_string(&mut s).unwrap(); @@ -12,6 +15,26 @@ fn read_string_limit(buf: &mut Read, n: u64) -> String { read_string(&mut buf.take(n)) } +fn read_u8_array(buf: &mut &[u8]) -> Vec { + buf.to_vec() +} + +fn read_u8_array_limit(buf: &mut &[u8], n:usize) -> Vec { + let mut v = Vec::new(); + for _ in 0..n { + v.push(buf.read_u8().unwrap()) + } + v +} + +fn read_double_array_limit(buf: &mut &[u8], n:usize) -> Vec { + let mut v = Vec::new(); + for _ in 0..n { + v.push(buf.read_f64::().unwrap()) + } + v +} + #[cfg(test)] mod tests { #[test] From 1b0245bf2b91d25a5b87e5fd97505e7a96c00e8c Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Wed, 14 Mar 2018 12:09:51 -0700 Subject: [PATCH 06/25] rust: Better error reporting --- rust/example/src/main.rs | 17 ++++++++++++----- rust/sbp/src/client/framer.rs | 20 +++++++++++++++++--- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/rust/example/src/main.rs b/rust/example/src/main.rs index 48a8359893..8be4c468e6 100644 --- a/rust/example/src/main.rs +++ b/rust/example/src/main.rs @@ -4,6 +4,7 @@ extern crate sbp; use serialport::prelude::*; use std::time::Duration; use sbp::messages::SBP; +use sbp::client::framer::{receive, Error}; fn main() { let s = SerialPortSettings { @@ -18,14 +19,20 @@ fn main() { let mut port = serialport::open_with_settings("/dev/ttyUSB0", &s) .expect("open failed"); loop { - match sbp::client::framer::receive(&mut port) { - Ok(SBP::MsgLog(x)) => println!("{}", x.text), - Ok(SBP::MsgPosLLH(x)) => { - println!("{} {} {}", x.lat, x.lon, x.height); - } + match receive(&mut port) { + Ok(SBP::MsgLog(x)) => + println!("{}", x.text), + Ok(SBP::MsgPosLLH(x)) => + println!("{} {} {}", x.lat, x.lon, x.height), Ok(_) => (), + + Err(Error::InvalidPreamble) => (), + Err(Error::CRCMismatch) => (), + Err(Error::IoError(ref x)) if x.kind() == std::io::ErrorKind::TimedOut => (), + Err(e) => { println!("{:?}", e); + break; } } } diff --git a/rust/sbp/src/client/framer.rs b/rust/sbp/src/client/framer.rs index 3e6ef1bbeb..103cadef05 100644 --- a/rust/sbp/src/client/framer.rs +++ b/rust/sbp/src/client/framer.rs @@ -2,16 +2,30 @@ extern crate byteorder; extern crate crc16; use self::byteorder::{LittleEndian,ReadBytesExt}; -use std::io::{Read, Error, ErrorKind}; +use std::io::{Read, self}; use ::messages::SBP; const SBP_PREAMBLE: u8 = 0x55; +#[derive(Debug)] +pub enum Error { + InvalidPreamble, + CRCMismatch, + ParseError, + IoError(io::Error) +} + +impl From for Error { + fn from(error: io::Error) -> Self { + Error::IoError(error) + } +} + pub fn receive(a: &mut Read) -> Result { let mut preamble = [0]; a.read_exact(&mut preamble)?; if preamble[0] != SBP_PREAMBLE { - return Err(Error::new(ErrorKind::Other, "invalid preamble")); + return Err(Error::InvalidPreamble); } let mut crc_state = crc16::State::::new(); let mut header = [0; 5]; @@ -29,7 +43,7 @@ pub fn receive(a: &mut Read) -> Result { let crc = a.read_u16::()?; if crc != crc_state.get() { - return Err(Error::new(ErrorKind::Other, "CRC error")) + return Err(Error::CRCMismatch); } Ok(SBP::parse(msg_id, &mut &payload[..])) From 3ffbde01895ee23bd33e13562173a89a2e9d445d Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Wed, 14 Mar 2018 13:10:52 -0700 Subject: [PATCH 07/25] rust: Don't panic on parse errors --- .../targets/resources/sbp_messages_mod.rs | 12 ++++-- .../resources/sbp_messages_template.rs | 20 +++++----- generator/sbpg/targets/rust.py | 6 +-- rust/example/src/main.rs | 6 ++- rust/sbp/src/client/framer.rs | 24 +++-------- rust/sbp/src/lib.rs | 40 +++++++++++++------ 6 files changed, 57 insertions(+), 51 deletions(-) diff --git a/generator/sbpg/targets/resources/sbp_messages_mod.rs b/generator/sbpg/targets/resources/sbp_messages_mod.rs index bc07a8d1ca..bb1154978e 100644 --- a/generator/sbpg/targets/resources/sbp_messages_mod.rs +++ b/generator/sbpg/targets/resources/sbp_messages_mod.rs @@ -29,12 +29,16 @@ pub enum SBP { } impl SBP { - pub fn parse(id: u16, payload: &mut &[u8]) -> SBP { - match id { + pub fn parse(id: u16, payload: &mut &[u8]) -> Result { + let x: Result = match id { ((*- for m in msgs *)) - (((m.sbp_id))) => SBP::(((m.identifier|camel_case)))( (((m.identifier|camel_case)))::parse(payload) ), + (((m.sbp_id))) => Ok(SBP::(((m.identifier|camel_case)))( (((m.identifier|camel_case)))::parse(payload)? )), ((*- endfor *)) - _ => SBP::Unknown {id} + _ => Ok(SBP::Unknown {id}) + }; + match x { + Ok(x) => Ok(x), + Err(_) => Err(::Error::ParseError), } } } diff --git a/generator/sbpg/targets/resources/sbp_messages_template.rs b/generator/sbpg/targets/resources/sbp_messages_template.rs index aa788f2231..4e7fd923eb 100644 --- a/generator/sbpg/targets/resources/sbp_messages_template.rs +++ b/generator/sbpg/targets/resources/sbp_messages_template.rs @@ -44,28 +44,28 @@ impl (((m.identifier|camel_case))) { ((*- if m.sbp_id *)) pub const TYPE: u16 = (((m.sbp_id))); ((*- endif *)) - pub fn parse(_buf: &mut &[u8]) -> (((m.identifier|camel_case))) { - (((m.identifier|camel_case))){ + pub fn parse(_buf: &mut &[u8]) -> Result<(((m.identifier|camel_case))), ::Error> { + Ok( (((m.identifier|camel_case))){ ((*- for f in m.fields *)) - (((f.identifier))): (((f|parse_type))), + (((f.identifier))): (((f|parse_type)))?, ((*- endfor *)) - } + } ) } ((*- if not m.sbp_id *)) - pub fn parse_array(buf: &mut &[u8]) -> Vec<(((m.identifier|camel_case)))> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( (((m.identifier|camel_case)))::parse(buf) ); + v.push( (((m.identifier|camel_case)))::parse(buf)? ); } - v + Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Vec<(((m.identifier|camel_case)))> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { - v.push( (((m.identifier|camel_case)))::parse(buf) ); + v.push( (((m.identifier|camel_case)))::parse(buf)? ); } - v + Ok(v) } ((*- endif *)) } diff --git a/generator/sbpg/targets/rust.py b/generator/sbpg/targets/rust.py index 29721fa50e..3676d51929 100644 --- a/generator/sbpg/targets/rust.py +++ b/generator/sbpg/targets/rust.py @@ -74,12 +74,12 @@ def parse_type(field): else: return "::read_string(_buf)" elif field.type_id == 'u8': - return '_buf.read_u8().unwrap()' + return '_buf.read_u8()' elif field.type_id == 's8': - return '_buf.read_i8().unwrap()' + return '_buf.read_i8()' elif field.type_id in TYPE_MAP.keys(): # Primitive java types have extractor methods in SBPMessage.Parser - return '_buf.read_%s::().unwrap()' % TYPE_MAP[field.type_id] + return '_buf.read_%s::()' % TYPE_MAP[field.type_id] if field.type_id == 'array': # Call function to build array t = field.options['fill'].value diff --git a/rust/example/src/main.rs b/rust/example/src/main.rs index 8be4c468e6..fe5b4fcb1f 100644 --- a/rust/example/src/main.rs +++ b/rust/example/src/main.rs @@ -4,7 +4,7 @@ extern crate sbp; use serialport::prelude::*; use std::time::Duration; use sbp::messages::SBP; -use sbp::client::framer::{receive, Error}; +use sbp::Error; fn main() { let s = SerialPortSettings { @@ -18,8 +18,9 @@ fn main() { let mut port = serialport::open_with_settings("/dev/ttyUSB0", &s) .expect("open failed"); + loop { - match receive(&mut port) { + match sbp::client::framer::receive(&mut port) { Ok(SBP::MsgLog(x)) => println!("{}", x.text), Ok(SBP::MsgPosLLH(x)) => @@ -28,6 +29,7 @@ fn main() { Err(Error::InvalidPreamble) => (), Err(Error::CRCMismatch) => (), + Err(Error::ParseError) => (), Err(Error::IoError(ref x)) if x.kind() == std::io::ErrorKind::TimedOut => (), Err(e) => { diff --git a/rust/sbp/src/client/framer.rs b/rust/sbp/src/client/framer.rs index 103cadef05..3c0436f731 100644 --- a/rust/sbp/src/client/framer.rs +++ b/rust/sbp/src/client/framer.rs @@ -2,30 +2,16 @@ extern crate byteorder; extern crate crc16; use self::byteorder::{LittleEndian,ReadBytesExt}; -use std::io::{Read, self}; +use std::io::Read; use ::messages::SBP; const SBP_PREAMBLE: u8 = 0x55; -#[derive(Debug)] -pub enum Error { - InvalidPreamble, - CRCMismatch, - ParseError, - IoError(io::Error) -} - -impl From for Error { - fn from(error: io::Error) -> Self { - Error::IoError(error) - } -} - -pub fn receive(a: &mut Read) -> Result { +pub fn receive(a: &mut Read) -> Result { let mut preamble = [0]; a.read_exact(&mut preamble)?; if preamble[0] != SBP_PREAMBLE { - return Err(Error::InvalidPreamble); + return Err(::Error::InvalidPreamble); } let mut crc_state = crc16::State::::new(); let mut header = [0; 5]; @@ -43,8 +29,8 @@ pub fn receive(a: &mut Read) -> Result { let crc = a.read_u16::()?; if crc != crc_state.get() { - return Err(Error::CRCMismatch); + return Err(::Error::CRCMismatch); } - Ok(SBP::parse(msg_id, &mut &payload[..])) + SBP::parse(msg_id, &mut &payload[..]) } diff --git a/rust/sbp/src/lib.rs b/rust/sbp/src/lib.rs index 18062737cf..0cbe3cea90 100644 --- a/rust/sbp/src/lib.rs +++ b/rust/sbp/src/lib.rs @@ -3,36 +3,50 @@ pub mod messages; extern crate byteorder; use self::byteorder::{LittleEndian,ReadBytesExt}; -use std::io::Read; +use std::io::{self, Read}; -fn read_string(buf: &mut Read) -> String { +#[derive(Debug)] +pub enum Error { + InvalidPreamble, + CRCMismatch, + ParseError, + IoError(io::Error) +} + +impl From for Error { + fn from(error: io::Error) -> Self { + Error::IoError(error) + } +} + +fn read_string(buf: &mut Read) -> Result { let mut s = String::new(); - buf.read_to_string(&mut s).unwrap(); - s + buf.read_to_string(&mut s)?; + Ok(s) } -fn read_string_limit(buf: &mut Read, n: u64) -> String { +fn read_string_limit(buf: &mut Read, n: u64) -> Result { read_string(&mut buf.take(n)) } -fn read_u8_array(buf: &mut &[u8]) -> Vec { - buf.to_vec() +fn read_u8_array(buf: &mut &[u8]) -> Result, Error> { + Ok(buf.to_vec()) } -fn read_u8_array_limit(buf: &mut &[u8], n:usize) -> Vec { +fn read_u8_array_limit(buf: &mut &[u8], n:usize) -> Result, Error> { let mut v = Vec::new(); for _ in 0..n { - v.push(buf.read_u8().unwrap()) + v.push(buf.read_u8()?); } - v + Ok(v) } -fn read_double_array_limit(buf: &mut &[u8], n:usize) -> Vec { +fn read_double_array_limit(buf: &mut &[u8], n:usize) -> Result, Error> { let mut v = Vec::new(); for _ in 0..n { - v.push(buf.read_f64::().unwrap()) + v.push(buf.read_f64::()?); } - v + Ok(v) } #[cfg(test)] From 5ba8bfd086f094a753ce5f7723415f5d1f098b48 Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Thu, 15 Mar 2018 12:53:38 -0700 Subject: [PATCH 08/25] Add cargo for Travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 8c98733926..b6c5d8496d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ addons: - libgmp-dev - oracle-java8-installer - oracle-java8-set-default + - cargo env: - JAVA_HOME=/usr/lib/jvm/java-8-oracle From cba53fbcbad7713d25b1da1d8beb8e4e97f116f5 Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Thu, 15 Mar 2018 13:29:43 -0700 Subject: [PATCH 09/25] rust: Add generated junk --- Makefile | 2 +- rust/sbp/src/messages/acquisition.rs | 329 +++++ rust/sbp/src/messages/bootload.rs | 163 +++ rust/sbp/src/messages/ext_events.rs | 56 + rust/sbp/src/messages/file_io.rs | 243 +++ rust/sbp/src/messages/flash.rs | 290 ++++ rust/sbp/src/messages/gnss.rs | 267 ++++ rust/sbp/src/messages/imu.rs | 94 ++ rust/sbp/src/messages/logging.rs | 121 ++ rust/sbp/src/messages/mag.rs | 54 + rust/sbp/src/messages/mod.rs | 476 ++++++ rust/sbp/src/messages/navigation.rs | 1145 +++++++++++++++ rust/sbp/src/messages/ndb.rs | 70 + rust/sbp/src/messages/observation.rs | 2027 ++++++++++++++++++++++++++ rust/sbp/src/messages/orientation.rs | 187 +++ rust/sbp/src/messages/piksi.rs | 836 +++++++++++ rust/sbp/src/messages/sbas.rs | 52 + rust/sbp/src/messages/settings.rs | 281 ++++ rust/sbp/src/messages/ssr.rs | 261 ++++ rust/sbp/src/messages/system.rs | 134 ++ rust/sbp/src/messages/tracking.rs | 478 ++++++ rust/sbp/src/messages/user.rs | 42 + rust/sbp/src/messages/vehicle.rs | 53 + 23 files changed, 7660 insertions(+), 1 deletion(-) create mode 100644 rust/sbp/src/messages/acquisition.rs create mode 100644 rust/sbp/src/messages/bootload.rs create mode 100644 rust/sbp/src/messages/ext_events.rs create mode 100644 rust/sbp/src/messages/file_io.rs create mode 100644 rust/sbp/src/messages/flash.rs create mode 100644 rust/sbp/src/messages/gnss.rs create mode 100644 rust/sbp/src/messages/imu.rs create mode 100644 rust/sbp/src/messages/logging.rs create mode 100644 rust/sbp/src/messages/mag.rs create mode 100644 rust/sbp/src/messages/mod.rs create mode 100644 rust/sbp/src/messages/navigation.rs create mode 100644 rust/sbp/src/messages/ndb.rs create mode 100644 rust/sbp/src/messages/observation.rs create mode 100644 rust/sbp/src/messages/orientation.rs create mode 100644 rust/sbp/src/messages/piksi.rs create mode 100644 rust/sbp/src/messages/sbas.rs create mode 100644 rust/sbp/src/messages/settings.rs create mode 100644 rust/sbp/src/messages/ssr.rs create mode 100644 rust/sbp/src/messages/system.rs create mode 100644 rust/sbp/src/messages/tracking.rs create mode 100644 rust/sbp/src/messages/user.rs create mode 100644 rust/sbp/src/messages/vehicle.rs diff --git a/Makefile b/Makefile index 3f17460878..a0f3ba3e80 100644 --- a/Makefile +++ b/Makefile @@ -226,7 +226,7 @@ test-haskell: cd $(SWIFTNAV_ROOT)/haskell/ && stack build --test --allow-different-user $(call announce-end,"Finished running Haskell tests") -test-rust: +test-rust: rust $(call announce-begin,"Running Rust tests") cd $(SWIFTNAV_ROOT)/rust/sbp && cargo test $(call announce-end,"Finished running Rust tests") diff --git a/rust/sbp/src/messages/acquisition.rs b/rust/sbp/src/messages/acquisition.rs new file mode 100644 index 0000000000..bf5e98a5dd --- /dev/null +++ b/rust/sbp/src/messages/acquisition.rs @@ -0,0 +1,329 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/acquisition.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Satellite acquisition messages from the device. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; +use super::gnss::*; + + +// Satellite acquisition result +// +// This message describes the results from an attempted GPS signal +// acquisition search for a satellite PRN over a code phase/carrier +// frequency range. It contains the parameters of the point in the +// acquisition search space with the best carrier-to-noise (CN/0) +// ratio. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgAcqResult { + pub cn0: f32, + // ^ CN/0 of best point + pub cp: f32, + // ^ Code phase of best point + pub cf: f32, + // ^ Carrier frequency of best point + pub sid: GnssSignal, + // ^ GNSS signal for which acquisition was attempted +} + +impl MsgAcqResult { + pub const TYPE: u16 = 47; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgAcqResult{ + cn0: _buf.read_f32::()?, + cp: _buf.read_f32::()?, + cf: _buf.read_f32::()?, + sid: GnssSignal::parse(_buf)?, + } ) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgAcqResultDepC { + pub cn0: f32, + // ^ CN/0 of best point + pub cp: f32, + // ^ Code phase of best point + pub cf: f32, + // ^ Carrier frequency of best point + pub sid: GnssSignalDep, + // ^ GNSS signal for which acquisition was attempted +} + +impl MsgAcqResultDepC { + pub const TYPE: u16 = 31; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgAcqResultDepC{ + cn0: _buf.read_f32::()?, + cp: _buf.read_f32::()?, + cf: _buf.read_f32::()?, + sid: GnssSignalDep::parse(_buf)?, + } ) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgAcqResultDepB { + pub snr: f32, + // ^ SNR of best point. Currently in arbitrary SNR points, but will be in + // units of dB Hz in a later revision of this message. + pub cp: f32, + // ^ Code phase of best point + pub cf: f32, + // ^ Carrier frequency of best point + pub sid: GnssSignalDep, + // ^ GNSS signal for which acquisition was attempted +} + +impl MsgAcqResultDepB { + pub const TYPE: u16 = 20; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgAcqResultDepB{ + snr: _buf.read_f32::()?, + cp: _buf.read_f32::()?, + cf: _buf.read_f32::()?, + sid: GnssSignalDep::parse(_buf)?, + } ) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgAcqResultDepA { + pub snr: f32, + // ^ SNR of best point. Currently dimensonless, but will have units of dB Hz + // in the revision of this message. + pub cp: f32, + // ^ Code phase of best point + pub cf: f32, + // ^ Carrier frequency of best point + pub prn: u8, + // ^ PRN-1 identifier of the satellite signal for which acquisition was + // attempted +} + +impl MsgAcqResultDepA { + pub const TYPE: u16 = 21; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgAcqResultDepA{ + snr: _buf.read_f32::()?, + cp: _buf.read_f32::()?, + cf: _buf.read_f32::()?, + prn: _buf.read_u8()?, + } ) + } +} + + +// Acq perfomance measurement and debug +// +// Profile for a specific SV for debugging purposes +// The message describes SV profile during acquisition time. +// The message is used to debug and measure the performance. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct AcqSvProfile { + pub job_type: u8, + // ^ SV search job type (deep, fallback, etc) + pub status: u8, + // ^ Acquisition status 1 is Success, 0 is Failure + pub cn0: u16, + // ^ CN0 value. Only valid if status is '1' + pub int_time: u8, + // ^ Acquisition integration time + pub sid: GnssSignal, + // ^ GNSS signal for which acquisition was attempted + pub bin_width: u16, + // ^ Acq frequency bin width + pub timestamp: u32, + // ^ Timestamp of the job complete event + pub time_spent: u32, + // ^ Time spent to search for sid.code + pub cf_min: i32, + // ^ Doppler range lowest frequency + pub cf_max: i32, + // ^ Doppler range highest frequency + pub cf: i32, + // ^ Doppler value of detected peak. Only valid if status is '1' + pub cp: u32, + // ^ Codephase of detected peak. Only valid if status is '1' +} + +impl AcqSvProfile { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( AcqSvProfile{ + job_type: _buf.read_u8()?, + status: _buf.read_u8()?, + cn0: _buf.read_u16::()?, + int_time: _buf.read_u8()?, + sid: GnssSignal::parse(_buf)?, + bin_width: _buf.read_u16::()?, + timestamp: _buf.read_u32::()?, + time_spent: _buf.read_u32::()?, + cf_min: _buf.read_i32::()?, + cf_max: _buf.read_i32::()?, + cf: _buf.read_i32::()?, + cp: _buf.read_u32::()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( AcqSvProfile::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( AcqSvProfile::parse(buf)? ); + } + Ok(v) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct AcqSvProfileDep { + pub job_type: u8, + // ^ SV search job type (deep, fallback, etc) + pub status: u8, + // ^ Acquisition status 1 is Success, 0 is Failure + pub cn0: u16, + // ^ CN0 value. Only valid if status is '1' + pub int_time: u8, + // ^ Acquisition integration time + pub sid: GnssSignalDep, + // ^ GNSS signal for which acquisition was attempted + pub bin_width: u16, + // ^ Acq frequency bin width + pub timestamp: u32, + // ^ Timestamp of the job complete event + pub time_spent: u32, + // ^ Time spent to search for sid.code + pub cf_min: i32, + // ^ Doppler range lowest frequency + pub cf_max: i32, + // ^ Doppler range highest frequency + pub cf: i32, + // ^ Doppler value of detected peak. Only valid if status is '1' + pub cp: u32, + // ^ Codephase of detected peak. Only valid if status is '1' +} + +impl AcqSvProfileDep { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( AcqSvProfileDep{ + job_type: _buf.read_u8()?, + status: _buf.read_u8()?, + cn0: _buf.read_u16::()?, + int_time: _buf.read_u8()?, + sid: GnssSignalDep::parse(_buf)?, + bin_width: _buf.read_u16::()?, + timestamp: _buf.read_u32::()?, + time_spent: _buf.read_u32::()?, + cf_min: _buf.read_i32::()?, + cf_max: _buf.read_i32::()?, + cf: _buf.read_i32::()?, + cp: _buf.read_u32::()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( AcqSvProfileDep::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( AcqSvProfileDep::parse(buf)? ); + } + Ok(v) + } +} + + +// Acquisition perfomance measurement and debug +// +// The message describes all SV profiles during acquisition time. +// The message is used to debug and measure the performance. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgAcqSvProfile { + pub acq_sv_profile: Vec, + // ^ SV profiles during acquisition time +} + +impl MsgAcqSvProfile { + pub const TYPE: u16 = 46; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgAcqSvProfile{ + acq_sv_profile: AcqSvProfile::parse_array(_buf)?, + } ) + } +} + + +// Deprecated. +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgAcqSvProfileDep { + pub acq_sv_profile: Vec, + // ^ SV profiles during acquisition time +} + +impl MsgAcqSvProfileDep { + pub const TYPE: u16 = 30; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgAcqSvProfileDep{ + acq_sv_profile: AcqSvProfileDep::parse_array(_buf)?, + } ) + } +} + diff --git a/rust/sbp/src/messages/bootload.rs b/rust/sbp/src/messages/bootload.rs new file mode 100644 index 0000000000..7466c16a69 --- /dev/null +++ b/rust/sbp/src/messages/bootload.rs @@ -0,0 +1,163 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/bootload.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Messages for the bootloading configuration of a Piksi 2.3.1. This message +// group does not apply to Piksi Multi. +// +// Note that some of these messages share the same message type ID for both the +// host request and the device response. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; + + +// Bootloading handshake request (host => device) +// +// The handshake message request from the host establishes a +// handshake between the device bootloader and the host. The +// response from the device is MSG_BOOTLOADER_HANDSHAKE_RESP. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgBootloaderHandshakeReq { +} + +impl MsgBootloaderHandshakeReq { + pub const TYPE: u16 = 179; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgBootloaderHandshakeReq{ + } ) + } +} + + +// Bootloading handshake response (host <= device) +// +// The handshake message response from the device establishes a +// handshake between the device bootloader and the host. The +// request from the host is MSG_BOOTLOADER_HANDSHAKE_REQ. The +// payload contains the bootloader version number and the SBP +// protocol version number. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgBootloaderHandshakeResp { + pub flags: u32, + // ^ Bootloader flags + pub version: String, + // ^ Bootloader version number +} + +impl MsgBootloaderHandshakeResp { + pub const TYPE: u16 = 180; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgBootloaderHandshakeResp{ + flags: _buf.read_u32::()?, + version: ::read_string(_buf)?, + } ) + } +} + + +// Bootloader jump to application (host => device) +// +// The host initiates the bootloader to jump to the application. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgBootloaderJumpToApp { + pub jump: u8, + // ^ Ignored by the device +} + +impl MsgBootloaderJumpToApp { + pub const TYPE: u16 = 177; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgBootloaderJumpToApp{ + jump: _buf.read_u8()?, + } ) + } +} + + +// Read FPGA device ID over UART request (host => device) +// +// The device message from the host reads a unique device +// identifier from the SwiftNAP, an FPGA. The host requests the ID +// by sending a MSG_NAP_DEVICE_DNA_REQ message. The device +// responds with a MSG_NAP_DEVICE_DNA_RESP message with the +// device ID in the payload. Note that this ID is tied to the FPGA, +// and not related to the Piksi's serial number. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgNapDeviceDnaReq { +} + +impl MsgNapDeviceDnaReq { + pub const TYPE: u16 = 222; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgNapDeviceDnaReq{ + } ) + } +} + + +// Read FPGA device ID over UART response (host <= device) +// +// The device message from the host reads a unique device +// identifier from the SwiftNAP, an FPGA. The host requests the ID +// by sending a MSG_NAP_DEVICE_DNA_REQ message. The device +// responds with a MSG_NAP_DEVICE_DNA_RESP messagage with the +// device ID in the payload. Note that this ID is tied to the FPGA, +// and not related to the Piksi's serial number. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgNapDeviceDnaResp { + pub dna: Vec, + // ^ 57-bit SwiftNAP FPGA Device ID. Remaining bits are padded on the right. +} + +impl MsgNapDeviceDnaResp { + pub const TYPE: u16 = 221; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgNapDeviceDnaResp{ + dna: ::read_u8_array_limit(_buf, 8)?, + } ) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgBootloaderHandshakeDepA { + pub handshake: Vec, + // ^ Version number string (not NULL terminated) +} + +impl MsgBootloaderHandshakeDepA { + pub const TYPE: u16 = 176; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgBootloaderHandshakeDepA{ + handshake: ::read_u8_array(_buf)?, + } ) + } +} + diff --git a/rust/sbp/src/messages/ext_events.rs b/rust/sbp/src/messages/ext_events.rs new file mode 100644 index 0000000000..14501997d3 --- /dev/null +++ b/rust/sbp/src/messages/ext_events.rs @@ -0,0 +1,56 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/ext_events.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Messages reporting accurately-timestamped external events, +// e.g. camera shutter time. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; + + +// Reports timestamped external pin event +// +// Reports detection of an external event, the GPS time it occurred, +// which pin it was and whether it was rising or falling. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgExtEvent { + pub wn: u16, + // ^ GPS week number + pub tow: u32, + // ^ GPS time of week rounded to the nearest millisecond + pub ns_residual: i32, + // ^ Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to + // 500000) + pub flags: u8, + // ^ Flags + pub pin: u8, + // ^ Pin number. 0..9 = DEBUG0..9. +} + +impl MsgExtEvent { + pub const TYPE: u16 = 257; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgExtEvent{ + wn: _buf.read_u16::()?, + tow: _buf.read_u32::()?, + ns_residual: _buf.read_i32::()?, + flags: _buf.read_u8()?, + pin: _buf.read_u8()?, + } ) + } +} + diff --git a/rust/sbp/src/messages/file_io.rs b/rust/sbp/src/messages/file_io.rs new file mode 100644 index 0000000000..066ea0376a --- /dev/null +++ b/rust/sbp/src/messages/file_io.rs @@ -0,0 +1,243 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/file_io.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Messages for using device's onboard flash filesystem +// functionality. This allows data to be stored persistently in the +// device's program flash with wear-levelling using a simple filesystem +// interface. The file system interface (CFS) defines an abstract API +// for reading directories and for reading and writing files. +// +// Note that some of these messages share the same message type ID for both the +// host request and the device response. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; + + +// Read file from the file system (host => device) +// +// The file read message reads a certain length (up to 255 bytes) +// from a given offset into a file, and returns the data in a +// MSG_FILEIO_READ_RESP message where the message length field +// indicates how many bytes were succesfully read.The sequence +// number in the request will be returned in the response. +// If the message is invalid, a followup MSG_PRINT message will +// print "Invalid fileio read message". A device will only respond +// to this message when it is received from sender ID 0x42. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgFileioReadReq { + pub sequence: u32, + // ^ Read sequence number + pub offset: u32, + // ^ File offset + pub chunk_size: u8, + // ^ Chunk size to read + pub filename: String, + // ^ Name of the file to read from +} + +impl MsgFileioReadReq { + pub const TYPE: u16 = 168; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgFileioReadReq{ + sequence: _buf.read_u32::()?, + offset: _buf.read_u32::()?, + chunk_size: _buf.read_u8()?, + filename: ::read_string(_buf)?, + } ) + } +} + + +// File read from the file system (host <= device) +// +// The file read message reads a certain length (up to 255 bytes) +// from a given offset into a file, and returns the data in a +// message where the message length field indicates how many bytes +// were succesfully read. The sequence number in the response is +// preserved from the request. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgFileioReadResp { + pub sequence: u32, + // ^ Read sequence number + pub contents: Vec, + // ^ Contents of read file +} + +impl MsgFileioReadResp { + pub const TYPE: u16 = 163; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgFileioReadResp{ + sequence: _buf.read_u32::()?, + contents: ::read_u8_array(_buf)?, + } ) + } +} + + +// List files in a directory (host => device) +// +// The read directory message lists the files in a directory on the +// device's onboard flash file system. The offset parameter can be +// used to skip the first n elements of the file list. Returns a +// MSG_FILEIO_READ_DIR_RESP message containing the directory +// listings as a NULL delimited list. The listing is chunked over +// multiple SBP packets. The sequence number in the request will be +// returned in the response. If message is invalid, a followup +// MSG_PRINT message will print "Invalid fileio read message". +// A device will only respond to this message when it is received +// from sender ID 0x42. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgFileioReadDirReq { + pub sequence: u32, + // ^ Read sequence number + pub offset: u32, + // ^ The offset to skip the first n elements of the file list + pub dirname: String, + // ^ Name of the directory to list +} + +impl MsgFileioReadDirReq { + pub const TYPE: u16 = 169; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgFileioReadDirReq{ + sequence: _buf.read_u32::()?, + offset: _buf.read_u32::()?, + dirname: ::read_string(_buf)?, + } ) + } +} + + +// Files listed in a directory (host <= device) +// +// The read directory message lists the files in a directory on the +// device's onboard flash file system. Message contains the directory +// listings as a NULL delimited list. The listing is chunked over +// multiple SBP packets and the end of the list is identified by an +// entry containing just the character 0xFF. The sequence number in +// the response is preserved from the request. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgFileioReadDirResp { + pub sequence: u32, + // ^ Read sequence number + pub contents: Vec, + // ^ Contents of read directory +} + +impl MsgFileioReadDirResp { + pub const TYPE: u16 = 170; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgFileioReadDirResp{ + sequence: _buf.read_u32::()?, + contents: ::read_u8_array(_buf)?, + } ) + } +} + + +// Delete a file from the file system (host => device) +// +// The file remove message deletes a file from the file system. +// If the message is invalid, a followup MSG_PRINT message will +// print "Invalid fileio remove message". A device will only +// process this message when it is received from sender ID 0x42. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgFileioRemove { + pub filename: String, + // ^ Name of the file to delete +} + +impl MsgFileioRemove { + pub const TYPE: u16 = 172; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgFileioRemove{ + filename: ::read_string(_buf)?, + } ) + } +} + + +// Write to file (host => device) +// +// The file write message writes a certain length (up to 255 bytes) +// of data to a file at a given offset. Returns a copy of the +// original MSG_FILEIO_WRITE_RESP message to check integrity of +// the write. The sequence number in the request will be returned +// in the response. If message is invalid, a followup MSG_PRINT +// message will print "Invalid fileio write message". A device will +// only process this message when it is received from sender ID +// 0x42. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgFileioWriteReq { + pub sequence: u32, + // ^ Write sequence number + pub offset: u32, + // ^ Offset into the file at which to start writing in bytes + pub filename: String, + // ^ Name of the file to write to + pub data: Vec, + // ^ Variable-length array of data to write +} + +impl MsgFileioWriteReq { + pub const TYPE: u16 = 173; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgFileioWriteReq{ + sequence: _buf.read_u32::()?, + offset: _buf.read_u32::()?, + filename: ::read_string(_buf)?, + data: ::read_u8_array(_buf)?, + } ) + } +} + + +// File written to (host <= device) +// +// The file write message writes a certain length (up to 255 bytes) +// of data to a file at a given offset. The message is a copy of the +// original MSG_FILEIO_WRITE_REQ message to check integrity of the +// write. The sequence number in the response is preserved from the +// request. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgFileioWriteResp { + pub sequence: u32, + // ^ Write sequence number +} + +impl MsgFileioWriteResp { + pub const TYPE: u16 = 171; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgFileioWriteResp{ + sequence: _buf.read_u32::()?, + } ) + } +} + diff --git a/rust/sbp/src/messages/flash.rs b/rust/sbp/src/messages/flash.rs new file mode 100644 index 0000000000..c75c2f381f --- /dev/null +++ b/rust/sbp/src/messages/flash.rs @@ -0,0 +1,290 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/flash.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Messages for reading/writing the device's onboard flash memory. Many +// of these messages target specific flash memory peripherals used in +// Swift Navigation devices: the STM32 flash and the M25Pxx FPGA +// configuration flash from Piksi 2.3.1. This module does not apply +// to Piksi Multi. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; + + +// Program flash addresses +// +// The flash program message programs a set of addresses of either +// the STM or M25 flash. The device replies with either a +// MSG_FLASH_DONE message containing the return code FLASH_OK (0) +// on success, or FLASH_INVALID_LEN (2) if the maximum write size +// is exceeded. Note that the sector-containing addresses must be +// erased before addresses can be programmed. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgFlashProgram { + pub target: u8, + // ^ Target flags + pub addr_start: Vec, + // ^ Starting address offset to program + pub addr_len: u8, + // ^ Length of set of addresses to program, counting up from starting address + pub data: Vec, + // ^ Data to program addresses with, with length N=addr_len +} + +impl MsgFlashProgram { + pub const TYPE: u16 = 230; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgFlashProgram{ + target: _buf.read_u8()?, + addr_start: ::read_u8_array_limit(_buf, 3)?, + addr_len: _buf.read_u8()?, + data: ::read_u8_array(_buf)?, + } ) + } +} + + +// Flash response message (host <= device). +// +// This message defines success or failure codes for a variety of +// flash memory requests from the host to the device. Flash read +// and write messages, such as MSG_FLASH_READ_REQ, or +// MSG_FLASH_PROGRAM, may return this message on failure. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgFlashDone { + pub response: u8, + // ^ Response flags +} + +impl MsgFlashDone { + pub const TYPE: u16 = 224; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgFlashDone{ + response: _buf.read_u8()?, + } ) + } +} + + +// Read STM or M25 flash address request (host => device). +// +// The flash read message reads a set of addresses of either the +// STM or M25 onboard flash. The device replies with a +// MSG_FLASH_READ_RESP message containing either the read data on +// success or a MSG_FLASH_DONE message containing the return code +// FLASH_INVALID_LEN (2) if the maximum read size is exceeded or +// FLASH_INVALID_ADDR (3) if the address is outside of the allowed +// range. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgFlashReadReq { + pub target: u8, + // ^ Target flags + pub addr_start: Vec, + // ^ Starting address offset to read from + pub addr_len: u8, + // ^ Length of set of addresses to read, counting up from starting address +} + +impl MsgFlashReadReq { + pub const TYPE: u16 = 231; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgFlashReadReq{ + target: _buf.read_u8()?, + addr_start: ::read_u8_array_limit(_buf, 3)?, + addr_len: _buf.read_u8()?, + } ) + } +} + + +// Read STM or M25 flash address response (host <= device). +// +// The flash read message reads a set of addresses of either the +// STM or M25 onboard flash. The device replies with a +// MSG_FLASH_READ_RESP message containing either the read data on +// success or a MSG_FLASH_DONE message containing the return code +// FLASH_INVALID_LEN (2) if the maximum read size is exceeded or +// FLASH_INVALID_ADDR (3) if the address is outside of the allowed +// range. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgFlashReadResp { + pub target: u8, + // ^ Target flags + pub addr_start: Vec, + // ^ Starting address offset to read from + pub addr_len: u8, + // ^ Length of set of addresses to read, counting up from starting address +} + +impl MsgFlashReadResp { + pub const TYPE: u16 = 225; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgFlashReadResp{ + target: _buf.read_u8()?, + addr_start: ::read_u8_array_limit(_buf, 3)?, + addr_len: _buf.read_u8()?, + } ) + } +} + + +// Erase sector of device flash memory (host => device). +// +// The flash erase message from the host erases a sector of either +// the STM or M25 onboard flash memory. The device will reply with a +// MSG_FLASH_DONE message containing the return code - FLASH_OK (0) +// on success or FLASH_INVALID_FLASH (1) if the flash specified is +// invalid. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgFlashErase { + pub target: u8, + // ^ Target flags + pub sector_num: u32, + // ^ Flash sector number to erase (0-11 for the STM, 0-15 for the M25) +} + +impl MsgFlashErase { + pub const TYPE: u16 = 226; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgFlashErase{ + target: _buf.read_u8()?, + sector_num: _buf.read_u32::()?, + } ) + } +} + + +// Lock sector of STM flash memory (host => device) +// +// The flash lock message locks a sector of the STM flash +// memory. The device replies with a MSG_FLASH_DONE message. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgStmFlashLockSector { + pub sector: u32, + // ^ Flash sector number to lock +} + +impl MsgStmFlashLockSector { + pub const TYPE: u16 = 227; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgStmFlashLockSector{ + sector: _buf.read_u32::()?, + } ) + } +} + + +// Unlock sector of STM flash memory (host => device) +// +// The flash unlock message unlocks a sector of the STM flash +// memory. The device replies with a MSG_FLASH_DONE message. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgStmFlashUnlockSector { + pub sector: u32, + // ^ Flash sector number to unlock +} + +impl MsgStmFlashUnlockSector { + pub const TYPE: u16 = 228; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgStmFlashUnlockSector{ + sector: _buf.read_u32::()?, + } ) + } +} + + +// Read device's hardcoded unique ID request (host => device) + +// +// This message reads the device's hardcoded unique ID. The host +// requests the ID by sending a MSG_STM_UNIQUE_ID_REQ. The device +// responds with a MSG_STM_UNIQUE_ID_RESP with the 12-byte unique +// ID in the payload. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgStmUniqueIdReq { +} + +impl MsgStmUniqueIdReq { + pub const TYPE: u16 = 232; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgStmUniqueIdReq{ + } ) + } +} + + +// Read device's hardcoded unique ID response (host <= device) + +// +// This message reads the device's hardcoded unique ID. The host +// requests the ID by sending a MSG_STM_UNIQUE_ID_REQ. The device +// responds with a MSG_STM_UNIQUE_ID_RESP with the 12-byte unique +// ID in the payload.. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgStmUniqueIdResp { + pub stm_id: Vec, + // ^ Device unique ID +} + +impl MsgStmUniqueIdResp { + pub const TYPE: u16 = 229; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgStmUniqueIdResp{ + stm_id: ::read_u8_array_limit(_buf, 12)?, + } ) + } +} + + +// Write M25 flash status register (host => device) +// +// The flash status message writes to the 8-bit M25 flash status +// register. The device replies with a MSG_FLASH_DONE message. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgM25FlashWriteStatus { + pub status: Vec, + // ^ Byte to write to the M25 flash status register +} + +impl MsgM25FlashWriteStatus { + pub const TYPE: u16 = 243; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgM25FlashWriteStatus{ + status: ::read_u8_array_limit(_buf, 1)?, + } ) + } +} + diff --git a/rust/sbp/src/messages/gnss.rs b/rust/sbp/src/messages/gnss.rs new file mode 100644 index 0000000000..641dd2f9df --- /dev/null +++ b/rust/sbp/src/messages/gnss.rs @@ -0,0 +1,267 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/gnss.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Various structs shared between modules +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; + + +// Represents all the relevant information about the signal +// +// Signal identifier containing constellation, band, and satellite identifier +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct GnssSignal { + pub sat: u8, + // ^ Constellation-specific satellite identifier + pub code: u8, + // ^ Signal constellation, band and code +} + +impl GnssSignal { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( GnssSignal{ + sat: _buf.read_u8()?, + code: _buf.read_u8()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( GnssSignal::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( GnssSignal::parse(buf)? ); + } + Ok(v) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct GnssSignalDep { + pub sat: u16, + // ^ Constellation-specific satellite identifier. Note: unlike GnssSignal, + // GPS satellites are encoded as (PRN - 1). Other constellations do not + // have this offset. + pub code: u8, + // ^ Signal constellation, band and code + pub reserved: u8, + // ^ Reserved +} + +impl GnssSignalDep { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( GnssSignalDep{ + sat: _buf.read_u16::()?, + code: _buf.read_u8()?, + reserved: _buf.read_u8()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( GnssSignalDep::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( GnssSignalDep::parse(buf)? ); + } + Ok(v) + } +} + + +// Millisecond-accurate GPS time +// +// A wire-appropriate GPS time, defined as the number of +// milliseconds since beginning of the week on the Saturday/Sunday +// transition. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct GPSTimeDep { + pub tow: u32, + // ^ Milliseconds since start of GPS week + pub wn: u16, + // ^ GPS week number +} + +impl GPSTimeDep { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( GPSTimeDep{ + tow: _buf.read_u32::()?, + wn: _buf.read_u16::()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( GPSTimeDep::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( GPSTimeDep::parse(buf)? ); + } + Ok(v) + } +} + + +// Whole second accurate GPS time +// +// A GPS time, defined as the number of +// seconds since beginning of the week on the Saturday/Sunday +// transition. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct GPSTimeSec { + pub tow: u32, + // ^ Seconds since start of GPS week + pub wn: u16, + // ^ GPS week number +} + +impl GPSTimeSec { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( GPSTimeSec{ + tow: _buf.read_u32::()?, + wn: _buf.read_u16::()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( GPSTimeSec::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( GPSTimeSec::parse(buf)? ); + } + Ok(v) + } +} + + +// Nanosecond-accurate receiver clock time +// +// A wire-appropriate receiver clock time, defined as the time +// since the beginning of the week on the Saturday/Sunday +// transition. In most cases, observations are epoch aligned +// so ns field will be 0. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct GPSTime { + pub tow: u32, + // ^ Milliseconds since start of GPS week + pub ns_residual: i32, + // ^ Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to + // 500000) + pub wn: u16, + // ^ GPS week number +} + +impl GPSTime { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( GPSTime{ + tow: _buf.read_u32::()?, + ns_residual: _buf.read_i32::()?, + wn: _buf.read_u16::()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( GPSTime::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( GPSTime::parse(buf)? ); + } + Ok(v) + } +} + + +// GNSS carrier phase measurement. +// +// Carrier phase measurement in cycles represented as a 40-bit +// fixed point number with Q32.8 layout, i.e. 32-bits of whole +// cycles and 8-bits of fractional cycles. This phase has the +// same sign as the pseudorange. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct CarrierPhase { + pub i: i32, + // ^ Carrier phase whole cycles + pub f: u8, + // ^ Carrier phase fractional part +} + +impl CarrierPhase { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( CarrierPhase{ + i: _buf.read_i32::()?, + f: _buf.read_u8()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( CarrierPhase::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( CarrierPhase::parse(buf)? ); + } + Ok(v) + } +} + diff --git a/rust/sbp/src/messages/imu.rs b/rust/sbp/src/messages/imu.rs new file mode 100644 index 0000000000..0d1064e34f --- /dev/null +++ b/rust/sbp/src/messages/imu.rs @@ -0,0 +1,94 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/imu.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Inertial Measurement Unit (IMU) messages. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; + + +// Raw IMU data +// +// Raw data from the Inertial Measurement Unit, containing accelerometer and +// gyroscope readings. The sense of the measurements are to be aligned with +// the indications on the device itself. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgImuRaw { + pub tow: u32, + // ^ Milliseconds since start of GPS week. If the high bit is set, the time + // is unknown or invalid. + pub tow_f: u8, + // ^ Milliseconds since start of GPS week, fractional part + pub acc_x: i16, + // ^ Acceleration in the IMU frame X axis + pub acc_y: i16, + // ^ Acceleration in the IMU frame Y axis + pub acc_z: i16, + // ^ Acceleration in the IMU frame Z axis + pub gyr_x: i16, + // ^ Angular rate around IMU frame X axis + pub gyr_y: i16, + // ^ Angular rate around IMU frame Y axis + pub gyr_z: i16, + // ^ Angular rate around IMU frame Z axis +} + +impl MsgImuRaw { + pub const TYPE: u16 = 2304; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgImuRaw{ + tow: _buf.read_u32::()?, + tow_f: _buf.read_u8()?, + acc_x: _buf.read_i16::()?, + acc_y: _buf.read_i16::()?, + acc_z: _buf.read_i16::()?, + gyr_x: _buf.read_i16::()?, + gyr_y: _buf.read_i16::()?, + gyr_z: _buf.read_i16::()?, + } ) + } +} + + +// Auxiliary IMU data +// +// Auxiliary data specific to a particular IMU. The `imu_type` field will +// always be consistent but the rest of the payload is device specific and +// depends on the value of `imu_type`. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgImuAux { + pub imu_type: u8, + // ^ IMU type + pub temp: i16, + // ^ Raw IMU temperature + pub imu_conf: u8, + // ^ IMU configuration +} + +impl MsgImuAux { + pub const TYPE: u16 = 2305; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgImuAux{ + imu_type: _buf.read_u8()?, + temp: _buf.read_i16::()?, + imu_conf: _buf.read_u8()?, + } ) + } +} + diff --git a/rust/sbp/src/messages/logging.rs b/rust/sbp/src/messages/logging.rs new file mode 100644 index 0000000000..ff25099ab3 --- /dev/null +++ b/rust/sbp/src/messages/logging.rs @@ -0,0 +1,121 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/logging.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Logging and debugging messages from the device. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; + + +// Plaintext logging messages with levels +// +// This message contains a human-readable payload string from the +// device containing errors, warnings and informational messages at +// ERROR, WARNING, DEBUG, INFO logging levels. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgLog { + pub level: u8, + // ^ Logging level + pub text: String, + // ^ Human-readable string +} + +impl MsgLog { + pub const TYPE: u16 = 1025; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgLog{ + level: _buf.read_u8()?, + text: ::read_string(_buf)?, + } ) + } +} + + +// Wrapper for FWD a separate stream of information over SBP +// +// This message provides the ability to forward messages over SBP. This may take the form +// of wrapping up SBP messages received by Piksi for logging purposes or wrapping +// another protocol with SBP. +// +// The source identifier indicates from what interface a forwarded stream derived. +// The protocol identifier identifies what the expected protocol the forwarded msg contains. +// Protocol 0 represents SBP and the remaining values are implementation defined. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgFwd { + pub source: u8, + // ^ source identifier + pub protocol: u8, + // ^ protocol identifier + pub fwd_payload: String, + // ^ variable length wrapped binary message +} + +impl MsgFwd { + pub const TYPE: u16 = 1026; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgFwd{ + source: _buf.read_u8()?, + protocol: _buf.read_u8()?, + fwd_payload: ::read_string(_buf)?, + } ) + } +} + + +// Tweet +// +// All the news fit to tweet. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgTweet { + pub tweet: String, + // ^ Human-readable string +} + +impl MsgTweet { + pub const TYPE: u16 = 18; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgTweet{ + tweet: ::read_string_limit(_buf, 140)?, + } ) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgPrintDep { + pub text: String, + // ^ Human-readable string +} + +impl MsgPrintDep { + pub const TYPE: u16 = 16; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgPrintDep{ + text: ::read_string(_buf)?, + } ) + } +} + diff --git a/rust/sbp/src/messages/mag.rs b/rust/sbp/src/messages/mag.rs new file mode 100644 index 0000000000..6b0dfa93d0 --- /dev/null +++ b/rust/sbp/src/messages/mag.rs @@ -0,0 +1,54 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/mag.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Magnetometer (mag) messages. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; + + +// Raw magnetometer data +// +// Raw data from the magnetometer. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgMagRaw { + pub tow: u32, + // ^ Milliseconds since start of GPS week. If the high bit is set, the time + // is unknown or invalid. + pub tow_f: u8, + // ^ Milliseconds since start of GPS week, fractional part + pub mag_x: i16, + // ^ Magnetic field in the body frame X axis + pub mag_y: i16, + // ^ Magnetic field in the body frame Y axis + pub mag_z: i16, + // ^ Magnetic field in the body frame Z axis +} + +impl MsgMagRaw { + pub const TYPE: u16 = 2306; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgMagRaw{ + tow: _buf.read_u32::()?, + tow_f: _buf.read_u8()?, + mag_x: _buf.read_i16::()?, + mag_y: _buf.read_i16::()?, + mag_z: _buf.read_i16::()?, + } ) + } +} + diff --git a/rust/sbp/src/messages/mod.rs b/rust/sbp/src/messages/mod.rs new file mode 100644 index 0000000000..f601d92b35 --- /dev/null +++ b/rust/sbp/src/messages/mod.rs @@ -0,0 +1,476 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. +pub mod settings; +pub mod user; +pub mod mag; +pub mod ndb; +pub mod ext_events; +pub mod observation; +pub mod gnss; +pub mod piksi; +pub mod ssr; +pub mod acquisition; +pub mod sbas; +pub mod bootload; +pub mod logging; +pub mod file_io; +pub mod vehicle; +pub mod system; +pub mod imu; +pub mod flash; +pub mod orientation; +pub mod tracking; +pub mod navigation; +use self::settings::MsgSettingsSave; +use self::settings::MsgSettingsWrite; +use self::settings::MsgSettingsWriteResp; +use self::settings::MsgSettingsReadReq; +use self::settings::MsgSettingsReadResp; +use self::settings::MsgSettingsReadByIndexReq; +use self::settings::MsgSettingsReadByIndexResp; +use self::settings::MsgSettingsReadByIndexDone; +use self::settings::MsgSettingsRegister; +use self::user::MsgUserData; +use self::mag::MsgMagRaw; +use self::ndb::MsgNdbEvent; +use self::ext_events::MsgExtEvent; +use self::observation::MsgObs; +use self::observation::MsgBasePosLLH; +use self::observation::MsgBasePosECEF; +use self::observation::MsgEphemerisGPSDepE; +use self::observation::MsgEphemerisGPS; +use self::observation::MsgEphemerisSbasDepA; +use self::observation::MsgEphemerisGloDepA; +use self::observation::MsgEphemerisSbas; +use self::observation::MsgEphemerisGloDepB; +use self::observation::MsgEphemerisGloDepC; +use self::observation::MsgEphemerisGlo; +use self::observation::MsgEphemerisDepD; +use self::observation::MsgEphemerisDepA; +use self::observation::MsgEphemerisDepB; +use self::observation::MsgEphemerisDepC; +use self::observation::MsgObsDepA; +use self::observation::MsgObsDepB; +use self::observation::MsgObsDepC; +use self::observation::MsgIono; +use self::observation::MsgSvConfigurationGPS; +use self::observation::MsgGroupDelayDepA; +use self::observation::MsgGroupDelayDepB; +use self::observation::MsgGroupDelay; +use self::observation::MsgAlmanacGPSDep; +use self::observation::MsgAlmanacGPS; +use self::observation::MsgAlmanacGloDep; +use self::observation::MsgAlmanacGlo; +use self::observation::MsgGloBiases; +use self::piksi::MsgAlmanac; +use self::piksi::MsgSetTime; +use self::piksi::MsgReset; +use self::piksi::MsgResetDep; +use self::piksi::MsgCwResults; +use self::piksi::MsgCwStart; +use self::piksi::MsgResetFilters; +use self::piksi::MsgInitBase; +use self::piksi::MsgThreadState; +use self::piksi::MsgUartState; +use self::piksi::MsgUartStateDepa; +use self::piksi::MsgIarState; +use self::piksi::MsgMaskSatellite; +use self::piksi::MsgMaskSatelliteDep; +use self::piksi::MsgDeviceMonitor; +use self::piksi::MsgCommandReq; +use self::piksi::MsgCommandResp; +use self::piksi::MsgCommandOutput; +use self::piksi::MsgNetworkStateReq; +use self::piksi::MsgNetworkStateResp; +use self::piksi::MsgNetworkBandwidthUsage; +use self::piksi::MsgSpecanDep; +use self::piksi::MsgSpecan; +use self::ssr::MsgSsrOrbitClock; +use self::ssr::MsgSsrCodeBiases; +use self::ssr::MsgSsrPhaseBiases; +use self::acquisition::MsgAcqResult; +use self::acquisition::MsgAcqResultDepC; +use self::acquisition::MsgAcqResultDepB; +use self::acquisition::MsgAcqResultDepA; +use self::acquisition::MsgAcqSvProfile; +use self::acquisition::MsgAcqSvProfileDep; +use self::sbas::MsgSbasRaw; +use self::bootload::MsgBootloaderHandshakeReq; +use self::bootload::MsgBootloaderHandshakeResp; +use self::bootload::MsgBootloaderJumpToApp; +use self::bootload::MsgNapDeviceDnaReq; +use self::bootload::MsgNapDeviceDnaResp; +use self::bootload::MsgBootloaderHandshakeDepA; +use self::logging::MsgLog; +use self::logging::MsgFwd; +use self::logging::MsgTweet; +use self::logging::MsgPrintDep; +use self::file_io::MsgFileioReadReq; +use self::file_io::MsgFileioReadResp; +use self::file_io::MsgFileioReadDirReq; +use self::file_io::MsgFileioReadDirResp; +use self::file_io::MsgFileioRemove; +use self::file_io::MsgFileioWriteReq; +use self::file_io::MsgFileioWriteResp; +use self::vehicle::MsgOdometry; +use self::system::MsgStartup; +use self::system::MsgDgnssStatus; +use self::system::MsgHeartbeat; +use self::system::MsgInsStatus; +use self::imu::MsgImuRaw; +use self::imu::MsgImuAux; +use self::flash::MsgFlashProgram; +use self::flash::MsgFlashDone; +use self::flash::MsgFlashReadReq; +use self::flash::MsgFlashReadResp; +use self::flash::MsgFlashErase; +use self::flash::MsgStmFlashLockSector; +use self::flash::MsgStmFlashUnlockSector; +use self::flash::MsgStmUniqueIdReq; +use self::flash::MsgStmUniqueIdResp; +use self::flash::MsgM25FlashWriteStatus; +use self::orientation::MsgBaselineHeading; +use self::orientation::MsgOrientQuat; +use self::orientation::MsgOrientEuler; +use self::orientation::MsgAngularRate; +use self::tracking::MsgTrackingStateDetailedDepA; +use self::tracking::MsgTrackingStateDetailedDep; +use self::tracking::MsgTrackingState; +use self::tracking::MsgTrackingIq; +use self::tracking::MsgTrackingIqDep; +use self::tracking::MsgTrackingStateDepA; +use self::tracking::MsgTrackingStateDepB; +use self::navigation::MsgGPSTime; +use self::navigation::MsgUtcTime; +use self::navigation::MsgDops; +use self::navigation::MsgPosECEF; +use self::navigation::MsgPosECEFCov; +use self::navigation::MsgPosLLH; +use self::navigation::MsgPosLLHCov; +use self::navigation::MsgBaselineECEF; +use self::navigation::MsgBaselineNED; +use self::navigation::MsgVelECEF; +use self::navigation::MsgVelECEFCov; +use self::navigation::MsgVelNED; +use self::navigation::MsgVelNEDCov; +use self::navigation::MsgVelBody; +use self::navigation::MsgAgeCorrections; +use self::navigation::MsgGPSTimeDepA; +use self::navigation::MsgDopsDepA; +use self::navigation::MsgPosECEFDepA; +use self::navigation::MsgPosLLHDepA; +use self::navigation::MsgBaselineECEFDepA; +use self::navigation::MsgBaselineNEDDepA; +use self::navigation::MsgVelECEFDepA; +use self::navigation::MsgVelNEDDepA; +use self::navigation::MsgBaselineHeadingDepA; + +#[derive(Debug)] +pub enum SBP { + Unknown { id: u16 }, + MsgVelNEDDepA( MsgVelNEDDepA ), + MsgBaselineHeadingDepA( MsgBaselineHeadingDepA ), + MsgPosECEF( MsgPosECEF ), + MsgPosECEFCov( MsgPosECEFCov ), + MsgPosLLH( MsgPosLLH ), + MsgPosLLHCov( MsgPosLLHCov ), + MsgBaselineECEF( MsgBaselineECEF ), + MsgBaselineNED( MsgBaselineNED ), + MsgVelECEF( MsgVelECEF ), + MsgVelECEFCov( MsgVelECEFCov ), + MsgVelNED( MsgVelNED ), + MsgVelNEDCov( MsgVelNEDCov ), + MsgVelBody( MsgVelBody ), + MsgAgeCorrections( MsgAgeCorrections ), + MsgGPSTimeDepA( MsgGPSTimeDepA ), + MsgDopsDepA( MsgDopsDepA ), + MsgPosECEFDepA( MsgPosECEFDepA ), + MsgPosLLHDepA( MsgPosLLHDepA ), + MsgBaselineECEFDepA( MsgBaselineECEFDepA ), + MsgBaselineNEDDepA( MsgBaselineNEDDepA ), + MsgVelECEFDepA( MsgVelECEFDepA ), + MsgFlashReadReq( MsgFlashReadReq ), + MsgFlashReadResp( MsgFlashReadResp ), + MsgFlashErase( MsgFlashErase ), + MsgStmFlashLockSector( MsgStmFlashLockSector ), + MsgStmFlashUnlockSector( MsgStmFlashUnlockSector ), + MsgStmUniqueIdReq( MsgStmUniqueIdReq ), + MsgStmUniqueIdResp( MsgStmUniqueIdResp ), + MsgM25FlashWriteStatus( MsgM25FlashWriteStatus ), + MsgBaselineHeading( MsgBaselineHeading ), + MsgOrientQuat( MsgOrientQuat ), + MsgOrientEuler( MsgOrientEuler ), + MsgAngularRate( MsgAngularRate ), + MsgTrackingStateDetailedDepA( MsgTrackingStateDetailedDepA ), + MsgTrackingStateDetailedDep( MsgTrackingStateDetailedDep ), + MsgTrackingState( MsgTrackingState ), + MsgTrackingIq( MsgTrackingIq ), + MsgTrackingIqDep( MsgTrackingIqDep ), + MsgTrackingStateDepA( MsgTrackingStateDepA ), + MsgTrackingStateDepB( MsgTrackingStateDepB ), + MsgGPSTime( MsgGPSTime ), + MsgUtcTime( MsgUtcTime ), + MsgDops( MsgDops ), + MsgSsrOrbitClock( MsgSsrOrbitClock ), + MsgSsrCodeBiases( MsgSsrCodeBiases ), + MsgSsrPhaseBiases( MsgSsrPhaseBiases ), + MsgAcqResult( MsgAcqResult ), + MsgAcqResultDepC( MsgAcqResultDepC ), + MsgAcqResultDepB( MsgAcqResultDepB ), + MsgAcqResultDepA( MsgAcqResultDepA ), + MsgAcqSvProfile( MsgAcqSvProfile ), + MsgAcqSvProfileDep( MsgAcqSvProfileDep ), + MsgSbasRaw( MsgSbasRaw ), + MsgBootloaderHandshakeReq( MsgBootloaderHandshakeReq ), + MsgBootloaderHandshakeResp( MsgBootloaderHandshakeResp ), + MsgBootloaderJumpToApp( MsgBootloaderJumpToApp ), + MsgNapDeviceDnaReq( MsgNapDeviceDnaReq ), + MsgNapDeviceDnaResp( MsgNapDeviceDnaResp ), + MsgBootloaderHandshakeDepA( MsgBootloaderHandshakeDepA ), + MsgLog( MsgLog ), + MsgFwd( MsgFwd ), + MsgTweet( MsgTweet ), + MsgPrintDep( MsgPrintDep ), + MsgFileioReadReq( MsgFileioReadReq ), + MsgFileioReadResp( MsgFileioReadResp ), + MsgFileioReadDirReq( MsgFileioReadDirReq ), + MsgFileioReadDirResp( MsgFileioReadDirResp ), + MsgFileioRemove( MsgFileioRemove ), + MsgFileioWriteReq( MsgFileioWriteReq ), + MsgFileioWriteResp( MsgFileioWriteResp ), + MsgOdometry( MsgOdometry ), + MsgStartup( MsgStartup ), + MsgDgnssStatus( MsgDgnssStatus ), + MsgHeartbeat( MsgHeartbeat ), + MsgInsStatus( MsgInsStatus ), + MsgImuRaw( MsgImuRaw ), + MsgImuAux( MsgImuAux ), + MsgFlashProgram( MsgFlashProgram ), + MsgFlashDone( MsgFlashDone ), + MsgGroupDelayDepA( MsgGroupDelayDepA ), + MsgGroupDelayDepB( MsgGroupDelayDepB ), + MsgGroupDelay( MsgGroupDelay ), + MsgAlmanacGPSDep( MsgAlmanacGPSDep ), + MsgAlmanacGPS( MsgAlmanacGPS ), + MsgAlmanacGloDep( MsgAlmanacGloDep ), + MsgAlmanacGlo( MsgAlmanacGlo ), + MsgGloBiases( MsgGloBiases ), + MsgAlmanac( MsgAlmanac ), + MsgSetTime( MsgSetTime ), + MsgReset( MsgReset ), + MsgResetDep( MsgResetDep ), + MsgCwResults( MsgCwResults ), + MsgCwStart( MsgCwStart ), + MsgResetFilters( MsgResetFilters ), + MsgInitBase( MsgInitBase ), + MsgThreadState( MsgThreadState ), + MsgUartState( MsgUartState ), + MsgSpecan( MsgSpecan ), + MsgEphemerisGlo( MsgEphemerisGlo ), + MsgEphemerisDepD( MsgEphemerisDepD ), + MsgEphemerisDepA( MsgEphemerisDepA ), + MsgEphemerisDepB( MsgEphemerisDepB ), + MsgEphemerisDepC( MsgEphemerisDepC ), + MsgObsDepA( MsgObsDepA ), + MsgObsDepB( MsgObsDepB ), + MsgObsDepC( MsgObsDepC ), + MsgIono( MsgIono ), + MsgSvConfigurationGPS( MsgSvConfigurationGPS ), + MsgMagRaw( MsgMagRaw ), + MsgNdbEvent( MsgNdbEvent ), + MsgExtEvent( MsgExtEvent ), + MsgObs( MsgObs ), + MsgBasePosLLH( MsgBasePosLLH ), + MsgBasePosECEF( MsgBasePosECEF ), + MsgEphemerisGPSDepE( MsgEphemerisGPSDepE ), + MsgEphemerisGPS( MsgEphemerisGPS ), + MsgEphemerisSbasDepA( MsgEphemerisSbasDepA ), + MsgEphemerisGloDepA( MsgEphemerisGloDepA ), + MsgEphemerisSbas( MsgEphemerisSbas ), + MsgEphemerisGloDepB( MsgEphemerisGloDepB ), + MsgEphemerisGloDepC( MsgEphemerisGloDepC ), + MsgSettingsSave( MsgSettingsSave ), + MsgSettingsWrite( MsgSettingsWrite ), + MsgSettingsWriteResp( MsgSettingsWriteResp ), + MsgSettingsReadReq( MsgSettingsReadReq ), + MsgSettingsReadResp( MsgSettingsReadResp ), + MsgSettingsReadByIndexReq( MsgSettingsReadByIndexReq ), + MsgSettingsReadByIndexResp( MsgSettingsReadByIndexResp ), + MsgSettingsReadByIndexDone( MsgSettingsReadByIndexDone ), + MsgSettingsRegister( MsgSettingsRegister ), + MsgUserData( MsgUserData ), + MsgNetworkBandwidthUsage( MsgNetworkBandwidthUsage ), + MsgSpecanDep( MsgSpecanDep ), + MsgCommandReq( MsgCommandReq ), + MsgCommandResp( MsgCommandResp ), + MsgCommandOutput( MsgCommandOutput ), + MsgNetworkStateReq( MsgNetworkStateReq ), + MsgNetworkStateResp( MsgNetworkStateResp ), + MsgUartStateDepa( MsgUartStateDepa ), + MsgIarState( MsgIarState ), + MsgMaskSatellite( MsgMaskSatellite ), + MsgMaskSatelliteDep( MsgMaskSatelliteDep ), + MsgDeviceMonitor( MsgDeviceMonitor ), +} + +impl SBP { + pub fn parse(id: u16, payload: &mut &[u8]) -> Result { + let x: Result = match id { + 517 => Ok(SBP::MsgVelNEDDepA( MsgVelNEDDepA::parse(payload)? )), + 519 => Ok(SBP::MsgBaselineHeadingDepA( MsgBaselineHeadingDepA::parse(payload)? )), + 521 => Ok(SBP::MsgPosECEF( MsgPosECEF::parse(payload)? )), + 532 => Ok(SBP::MsgPosECEFCov( MsgPosECEFCov::parse(payload)? )), + 522 => Ok(SBP::MsgPosLLH( MsgPosLLH::parse(payload)? )), + 529 => Ok(SBP::MsgPosLLHCov( MsgPosLLHCov::parse(payload)? )), + 523 => Ok(SBP::MsgBaselineECEF( MsgBaselineECEF::parse(payload)? )), + 524 => Ok(SBP::MsgBaselineNED( MsgBaselineNED::parse(payload)? )), + 525 => Ok(SBP::MsgVelECEF( MsgVelECEF::parse(payload)? )), + 533 => Ok(SBP::MsgVelECEFCov( MsgVelECEFCov::parse(payload)? )), + 526 => Ok(SBP::MsgVelNED( MsgVelNED::parse(payload)? )), + 530 => Ok(SBP::MsgVelNEDCov( MsgVelNEDCov::parse(payload)? )), + 531 => Ok(SBP::MsgVelBody( MsgVelBody::parse(payload)? )), + 528 => Ok(SBP::MsgAgeCorrections( MsgAgeCorrections::parse(payload)? )), + 256 => Ok(SBP::MsgGPSTimeDepA( MsgGPSTimeDepA::parse(payload)? )), + 518 => Ok(SBP::MsgDopsDepA( MsgDopsDepA::parse(payload)? )), + 512 => Ok(SBP::MsgPosECEFDepA( MsgPosECEFDepA::parse(payload)? )), + 513 => Ok(SBP::MsgPosLLHDepA( MsgPosLLHDepA::parse(payload)? )), + 514 => Ok(SBP::MsgBaselineECEFDepA( MsgBaselineECEFDepA::parse(payload)? )), + 515 => Ok(SBP::MsgBaselineNEDDepA( MsgBaselineNEDDepA::parse(payload)? )), + 516 => Ok(SBP::MsgVelECEFDepA( MsgVelECEFDepA::parse(payload)? )), + 231 => Ok(SBP::MsgFlashReadReq( MsgFlashReadReq::parse(payload)? )), + 225 => Ok(SBP::MsgFlashReadResp( MsgFlashReadResp::parse(payload)? )), + 226 => Ok(SBP::MsgFlashErase( MsgFlashErase::parse(payload)? )), + 227 => Ok(SBP::MsgStmFlashLockSector( MsgStmFlashLockSector::parse(payload)? )), + 228 => Ok(SBP::MsgStmFlashUnlockSector( MsgStmFlashUnlockSector::parse(payload)? )), + 232 => Ok(SBP::MsgStmUniqueIdReq( MsgStmUniqueIdReq::parse(payload)? )), + 229 => Ok(SBP::MsgStmUniqueIdResp( MsgStmUniqueIdResp::parse(payload)? )), + 243 => Ok(SBP::MsgM25FlashWriteStatus( MsgM25FlashWriteStatus::parse(payload)? )), + 527 => Ok(SBP::MsgBaselineHeading( MsgBaselineHeading::parse(payload)? )), + 544 => Ok(SBP::MsgOrientQuat( MsgOrientQuat::parse(payload)? )), + 545 => Ok(SBP::MsgOrientEuler( MsgOrientEuler::parse(payload)? )), + 546 => Ok(SBP::MsgAngularRate( MsgAngularRate::parse(payload)? )), + 33 => Ok(SBP::MsgTrackingStateDetailedDepA( MsgTrackingStateDetailedDepA::parse(payload)? )), + 17 => Ok(SBP::MsgTrackingStateDetailedDep( MsgTrackingStateDetailedDep::parse(payload)? )), + 65 => Ok(SBP::MsgTrackingState( MsgTrackingState::parse(payload)? )), + 44 => Ok(SBP::MsgTrackingIq( MsgTrackingIq::parse(payload)? )), + 28 => Ok(SBP::MsgTrackingIqDep( MsgTrackingIqDep::parse(payload)? )), + 22 => Ok(SBP::MsgTrackingStateDepA( MsgTrackingStateDepA::parse(payload)? )), + 19 => Ok(SBP::MsgTrackingStateDepB( MsgTrackingStateDepB::parse(payload)? )), + 258 => Ok(SBP::MsgGPSTime( MsgGPSTime::parse(payload)? )), + 259 => Ok(SBP::MsgUtcTime( MsgUtcTime::parse(payload)? )), + 520 => Ok(SBP::MsgDops( MsgDops::parse(payload)? )), + 1500 => Ok(SBP::MsgSsrOrbitClock( MsgSsrOrbitClock::parse(payload)? )), + 1505 => Ok(SBP::MsgSsrCodeBiases( MsgSsrCodeBiases::parse(payload)? )), + 1510 => Ok(SBP::MsgSsrPhaseBiases( MsgSsrPhaseBiases::parse(payload)? )), + 47 => Ok(SBP::MsgAcqResult( MsgAcqResult::parse(payload)? )), + 31 => Ok(SBP::MsgAcqResultDepC( MsgAcqResultDepC::parse(payload)? )), + 20 => Ok(SBP::MsgAcqResultDepB( MsgAcqResultDepB::parse(payload)? )), + 21 => Ok(SBP::MsgAcqResultDepA( MsgAcqResultDepA::parse(payload)? )), + 46 => Ok(SBP::MsgAcqSvProfile( MsgAcqSvProfile::parse(payload)? )), + 30 => Ok(SBP::MsgAcqSvProfileDep( MsgAcqSvProfileDep::parse(payload)? )), + 30583 => Ok(SBP::MsgSbasRaw( MsgSbasRaw::parse(payload)? )), + 179 => Ok(SBP::MsgBootloaderHandshakeReq( MsgBootloaderHandshakeReq::parse(payload)? )), + 180 => Ok(SBP::MsgBootloaderHandshakeResp( MsgBootloaderHandshakeResp::parse(payload)? )), + 177 => Ok(SBP::MsgBootloaderJumpToApp( MsgBootloaderJumpToApp::parse(payload)? )), + 222 => Ok(SBP::MsgNapDeviceDnaReq( MsgNapDeviceDnaReq::parse(payload)? )), + 221 => Ok(SBP::MsgNapDeviceDnaResp( MsgNapDeviceDnaResp::parse(payload)? )), + 176 => Ok(SBP::MsgBootloaderHandshakeDepA( MsgBootloaderHandshakeDepA::parse(payload)? )), + 1025 => Ok(SBP::MsgLog( MsgLog::parse(payload)? )), + 1026 => Ok(SBP::MsgFwd( MsgFwd::parse(payload)? )), + 18 => Ok(SBP::MsgTweet( MsgTweet::parse(payload)? )), + 16 => Ok(SBP::MsgPrintDep( MsgPrintDep::parse(payload)? )), + 168 => Ok(SBP::MsgFileioReadReq( MsgFileioReadReq::parse(payload)? )), + 163 => Ok(SBP::MsgFileioReadResp( MsgFileioReadResp::parse(payload)? )), + 169 => Ok(SBP::MsgFileioReadDirReq( MsgFileioReadDirReq::parse(payload)? )), + 170 => Ok(SBP::MsgFileioReadDirResp( MsgFileioReadDirResp::parse(payload)? )), + 172 => Ok(SBP::MsgFileioRemove( MsgFileioRemove::parse(payload)? )), + 173 => Ok(SBP::MsgFileioWriteReq( MsgFileioWriteReq::parse(payload)? )), + 171 => Ok(SBP::MsgFileioWriteResp( MsgFileioWriteResp::parse(payload)? )), + 2307 => Ok(SBP::MsgOdometry( MsgOdometry::parse(payload)? )), + 65280 => Ok(SBP::MsgStartup( MsgStartup::parse(payload)? )), + 65282 => Ok(SBP::MsgDgnssStatus( MsgDgnssStatus::parse(payload)? )), + 65535 => Ok(SBP::MsgHeartbeat( MsgHeartbeat::parse(payload)? )), + 65283 => Ok(SBP::MsgInsStatus( MsgInsStatus::parse(payload)? )), + 2304 => Ok(SBP::MsgImuRaw( MsgImuRaw::parse(payload)? )), + 2305 => Ok(SBP::MsgImuAux( MsgImuAux::parse(payload)? )), + 230 => Ok(SBP::MsgFlashProgram( MsgFlashProgram::parse(payload)? )), + 224 => Ok(SBP::MsgFlashDone( MsgFlashDone::parse(payload)? )), + 146 => Ok(SBP::MsgGroupDelayDepA( MsgGroupDelayDepA::parse(payload)? )), + 147 => Ok(SBP::MsgGroupDelayDepB( MsgGroupDelayDepB::parse(payload)? )), + 148 => Ok(SBP::MsgGroupDelay( MsgGroupDelay::parse(payload)? )), + 112 => Ok(SBP::MsgAlmanacGPSDep( MsgAlmanacGPSDep::parse(payload)? )), + 114 => Ok(SBP::MsgAlmanacGPS( MsgAlmanacGPS::parse(payload)? )), + 113 => Ok(SBP::MsgAlmanacGloDep( MsgAlmanacGloDep::parse(payload)? )), + 115 => Ok(SBP::MsgAlmanacGlo( MsgAlmanacGlo::parse(payload)? )), + 117 => Ok(SBP::MsgGloBiases( MsgGloBiases::parse(payload)? )), + 105 => Ok(SBP::MsgAlmanac( MsgAlmanac::parse(payload)? )), + 104 => Ok(SBP::MsgSetTime( MsgSetTime::parse(payload)? )), + 182 => Ok(SBP::MsgReset( MsgReset::parse(payload)? )), + 178 => Ok(SBP::MsgResetDep( MsgResetDep::parse(payload)? )), + 192 => Ok(SBP::MsgCwResults( MsgCwResults::parse(payload)? )), + 193 => Ok(SBP::MsgCwStart( MsgCwStart::parse(payload)? )), + 34 => Ok(SBP::MsgResetFilters( MsgResetFilters::parse(payload)? )), + 35 => Ok(SBP::MsgInitBase( MsgInitBase::parse(payload)? )), + 23 => Ok(SBP::MsgThreadState( MsgThreadState::parse(payload)? )), + 29 => Ok(SBP::MsgUartState( MsgUartState::parse(payload)? )), + 81 => Ok(SBP::MsgSpecan( MsgSpecan::parse(payload)? )), + 136 => Ok(SBP::MsgEphemerisGlo( MsgEphemerisGlo::parse(payload)? )), + 128 => Ok(SBP::MsgEphemerisDepD( MsgEphemerisDepD::parse(payload)? )), + 26 => Ok(SBP::MsgEphemerisDepA( MsgEphemerisDepA::parse(payload)? )), + 70 => Ok(SBP::MsgEphemerisDepB( MsgEphemerisDepB::parse(payload)? )), + 71 => Ok(SBP::MsgEphemerisDepC( MsgEphemerisDepC::parse(payload)? )), + 69 => Ok(SBP::MsgObsDepA( MsgObsDepA::parse(payload)? )), + 67 => Ok(SBP::MsgObsDepB( MsgObsDepB::parse(payload)? )), + 73 => Ok(SBP::MsgObsDepC( MsgObsDepC::parse(payload)? )), + 144 => Ok(SBP::MsgIono( MsgIono::parse(payload)? )), + 145 => Ok(SBP::MsgSvConfigurationGPS( MsgSvConfigurationGPS::parse(payload)? )), + 2306 => Ok(SBP::MsgMagRaw( MsgMagRaw::parse(payload)? )), + 1024 => Ok(SBP::MsgNdbEvent( MsgNdbEvent::parse(payload)? )), + 257 => Ok(SBP::MsgExtEvent( MsgExtEvent::parse(payload)? )), + 74 => Ok(SBP::MsgObs( MsgObs::parse(payload)? )), + 68 => Ok(SBP::MsgBasePosLLH( MsgBasePosLLH::parse(payload)? )), + 72 => Ok(SBP::MsgBasePosECEF( MsgBasePosECEF::parse(payload)? )), + 129 => Ok(SBP::MsgEphemerisGPSDepE( MsgEphemerisGPSDepE::parse(payload)? )), + 134 => Ok(SBP::MsgEphemerisGPS( MsgEphemerisGPS::parse(payload)? )), + 130 => Ok(SBP::MsgEphemerisSbasDepA( MsgEphemerisSbasDepA::parse(payload)? )), + 131 => Ok(SBP::MsgEphemerisGloDepA( MsgEphemerisGloDepA::parse(payload)? )), + 132 => Ok(SBP::MsgEphemerisSbas( MsgEphemerisSbas::parse(payload)? )), + 133 => Ok(SBP::MsgEphemerisGloDepB( MsgEphemerisGloDepB::parse(payload)? )), + 135 => Ok(SBP::MsgEphemerisGloDepC( MsgEphemerisGloDepC::parse(payload)? )), + 161 => Ok(SBP::MsgSettingsSave( MsgSettingsSave::parse(payload)? )), + 160 => Ok(SBP::MsgSettingsWrite( MsgSettingsWrite::parse(payload)? )), + 175 => Ok(SBP::MsgSettingsWriteResp( MsgSettingsWriteResp::parse(payload)? )), + 164 => Ok(SBP::MsgSettingsReadReq( MsgSettingsReadReq::parse(payload)? )), + 165 => Ok(SBP::MsgSettingsReadResp( MsgSettingsReadResp::parse(payload)? )), + 162 => Ok(SBP::MsgSettingsReadByIndexReq( MsgSettingsReadByIndexReq::parse(payload)? )), + 167 => Ok(SBP::MsgSettingsReadByIndexResp( MsgSettingsReadByIndexResp::parse(payload)? )), + 166 => Ok(SBP::MsgSettingsReadByIndexDone( MsgSettingsReadByIndexDone::parse(payload)? )), + 174 => Ok(SBP::MsgSettingsRegister( MsgSettingsRegister::parse(payload)? )), + 2048 => Ok(SBP::MsgUserData( MsgUserData::parse(payload)? )), + 189 => Ok(SBP::MsgNetworkBandwidthUsage( MsgNetworkBandwidthUsage::parse(payload)? )), + 80 => Ok(SBP::MsgSpecanDep( MsgSpecanDep::parse(payload)? )), + 184 => Ok(SBP::MsgCommandReq( MsgCommandReq::parse(payload)? )), + 185 => Ok(SBP::MsgCommandResp( MsgCommandResp::parse(payload)? )), + 188 => Ok(SBP::MsgCommandOutput( MsgCommandOutput::parse(payload)? )), + 186 => Ok(SBP::MsgNetworkStateReq( MsgNetworkStateReq::parse(payload)? )), + 187 => Ok(SBP::MsgNetworkStateResp( MsgNetworkStateResp::parse(payload)? )), + 24 => Ok(SBP::MsgUartStateDepa( MsgUartStateDepa::parse(payload)? )), + 25 => Ok(SBP::MsgIarState( MsgIarState::parse(payload)? )), + 43 => Ok(SBP::MsgMaskSatellite( MsgMaskSatellite::parse(payload)? )), + 27 => Ok(SBP::MsgMaskSatelliteDep( MsgMaskSatelliteDep::parse(payload)? )), + 181 => Ok(SBP::MsgDeviceMonitor( MsgDeviceMonitor::parse(payload)? )), + _ => Ok(SBP::Unknown {id}) + }; + match x { + Ok(x) => Ok(x), + Err(_) => Err(::Error::ParseError), + } + } +} \ No newline at end of file diff --git a/rust/sbp/src/messages/navigation.rs b/rust/sbp/src/messages/navigation.rs new file mode 100644 index 0000000000..0abf5dfd57 --- /dev/null +++ b/rust/sbp/src/messages/navigation.rs @@ -0,0 +1,1145 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/navigation.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Geodetic navigation messages reporting GPS time, position, velocity, +// and baseline position solutions. For position solutions, these +// messages define several different position solutions: single-point +// (SPP), RTK, and pseudo-absolute position solutions. +// +// The SPP is the standalone, absolute GPS position solution using only +// a single receiver. The RTK solution is the differential GPS +// solution, which can use either a fixed/integer or floating carrier +// phase ambiguity. The pseudo-absolute position solution uses a +// user-provided, well-surveyed base station position (if available) +// and the RTK solution in tandem. +// +// When the inertial navigation mode indicates that the IMU is used, +// all messages are reported in the vehicle body frame as defined by +// device settings. By default, the vehicle body frame is configured to be +// coincident with the antenna phase center. When there is no inertial +// navigation, the solution will be reported at the phase center of the antenna. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; + + +// GPS Time +// +// This message reports the GPS time, representing the time since +// the GPS epoch began on midnight January 6, 1980 UTC. GPS time +// counts the weeks and seconds of the week. The weeks begin at the +// Saturday/Sunday transition. GPS week 0 began at the beginning of +// the GPS time scale. +// +// Within each week number, the GPS time of the week is between +// between 0 and 604800 seconds (=60*60*24*7). Note that GPS time +// does not accumulate leap seconds, and as of now, has a small +// offset from UTC. In a message stream, this message precedes a +// set of other navigation messages referenced to the same time +// (but lacking the ns field) and indicates a more precise time of +// these messages. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgGPSTime { + pub wn: u16, + // ^ GPS week number + pub tow: u32, + // ^ GPS time of week rounded to the nearest millisecond + pub ns_residual: i32, + // ^ Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to + // 500000) + pub flags: u8, + // ^ Status flags (reserved) +} + +impl MsgGPSTime { + pub const TYPE: u16 = 258; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgGPSTime{ + wn: _buf.read_u16::()?, + tow: _buf.read_u32::()?, + ns_residual: _buf.read_i32::()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// UTC Time +// +// This message reports the Universal Coordinated Time (UTC). Note the flags +// which indicate the source of the UTC offset value and source of the time fix. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgUtcTime { + pub flags: u8, + // ^ Indicates source and time validity + pub tow: u32, + // ^ GPS time of week rounded to the nearest millisecond + pub year: u16, + // ^ Year + pub month: u8, + // ^ Month (range 1 .. 12) + pub day: u8, + // ^ days in the month (range 1-31) + pub hours: u8, + // ^ hours of day (range 0-23) + pub minutes: u8, + // ^ minutes of hour (range 0-59) + pub seconds: u8, + // ^ seconds of minute (range 0-60) rounded down + pub ns: u32, + // ^ nanoseconds of second (range 0-999999999) +} + +impl MsgUtcTime { + pub const TYPE: u16 = 259; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgUtcTime{ + flags: _buf.read_u8()?, + tow: _buf.read_u32::()?, + year: _buf.read_u16::()?, + month: _buf.read_u8()?, + day: _buf.read_u8()?, + hours: _buf.read_u8()?, + minutes: _buf.read_u8()?, + seconds: _buf.read_u8()?, + ns: _buf.read_u32::()?, + } ) + } +} + + +// Dilution of Precision +// +// This dilution of precision (DOP) message describes the effect of +// navigation satellite geometry on positional measurement +// precision. The flags field indicated whether the DOP reported +// corresponds to differential or SPP solution. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgDops { + pub tow: u32, + // ^ GPS Time of Week + pub gdop: u16, + // ^ Geometric Dilution of Precision + pub pdop: u16, + // ^ Position Dilution of Precision + pub tdop: u16, + // ^ Time Dilution of Precision + pub hdop: u16, + // ^ Horizontal Dilution of Precision + pub vdop: u16, + // ^ Vertical Dilution of Precision + pub flags: u8, + // ^ Indicates the position solution with which the DOPS message corresponds +} + +impl MsgDops { + pub const TYPE: u16 = 520; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgDops{ + tow: _buf.read_u32::()?, + gdop: _buf.read_u16::()?, + pdop: _buf.read_u16::()?, + tdop: _buf.read_u16::()?, + hdop: _buf.read_u16::()?, + vdop: _buf.read_u16::()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Single-point position in ECEF +// +// The position solution message reports absolute Earth Centered +// Earth Fixed (ECEF) coordinates and the status (single point vs +// pseudo-absolute RTK) of the position solution. If the rover +// receiver knows the surveyed position of the base station and has +// an RTK solution, this reports a pseudo-absolute position +// solution using the base station position and the rover's RTK +// baseline vector. The full GPS time is given by the preceding +// MSG_GPS_TIME with the matching time-of-week (tow). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgPosECEF { + pub tow: u32, + // ^ GPS Time of Week + pub x: f64, + // ^ ECEF X coordinate + pub y: f64, + // ^ ECEF Y coordinate + pub z: f64, + // ^ ECEF Z coordinate + pub accuracy: u16, + // ^ Position estimated standard deviation + pub n_sats: u8, + // ^ Number of satellites used in solution + pub flags: u8, + // ^ Status flags +} + +impl MsgPosECEF { + pub const TYPE: u16 = 521; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgPosECEF{ + tow: _buf.read_u32::()?, + x: _buf.read_f64::()?, + y: _buf.read_f64::()?, + z: _buf.read_f64::()?, + accuracy: _buf.read_u16::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Single-point position in ECEF +// +// The position solution message reports absolute Earth Centered +// Earth Fixed (ECEF) coordinates and the status (single point vs +// pseudo-absolute RTK) of the position solution. The message also +// reports the upper triangular portion of the 3x3 covariance matrix. +// If the receiver knows the surveyed position of the base station and has +// an RTK solution, this reports a pseudo-absolute position +// solution using the base station position and the rover's RTK +// baseline vector. The full GPS time is given by the preceding +// MSG_GPS_TIME with the matching time-of-week (tow). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgPosECEFCov { + pub tow: u32, + // ^ GPS Time of Week + pub x: f64, + // ^ ECEF X coordinate + pub y: f64, + // ^ ECEF Y coordinate + pub z: f64, + // ^ ECEF Z coordinate + pub cov_x_x: f32, + // ^ Estimated variance of x + pub cov_x_y: f32, + // ^ Estimated covariance of x and y + pub cov_x_z: f32, + // ^ Estimated covariance of x and z + pub cov_y_y: f32, + // ^ Estimated variance of y + pub cov_y_z: f32, + // ^ Estimated covariance of y and z + pub cov_z_z: f32, + // ^ Estimated variance of z + pub n_sats: u8, + // ^ Number of satellites used in solution + pub flags: u8, + // ^ Status flags +} + +impl MsgPosECEFCov { + pub const TYPE: u16 = 532; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgPosECEFCov{ + tow: _buf.read_u32::()?, + x: _buf.read_f64::()?, + y: _buf.read_f64::()?, + z: _buf.read_f64::()?, + cov_x_x: _buf.read_f32::()?, + cov_x_y: _buf.read_f32::()?, + cov_x_z: _buf.read_f32::()?, + cov_y_y: _buf.read_f32::()?, + cov_y_z: _buf.read_f32::()?, + cov_z_z: _buf.read_f32::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Geodetic Position +// +// This position solution message reports the absolute geodetic +// coordinates and the status (single point vs pseudo-absolute RTK) +// of the position solution. If the rover receiver knows the +// surveyed position of the base station and has an RTK solution, +// this reports a pseudo-absolute position solution using the base +// station position and the rover's RTK baseline vector. The full +// GPS time is given by the preceding MSG_GPS_TIME with the +// matching time-of-week (tow). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgPosLLH { + pub tow: u32, + // ^ GPS Time of Week + pub lat: f64, + // ^ Latitude + pub lon: f64, + // ^ Longitude + pub height: f64, + // ^ Height above WGS84 ellipsoid + pub h_accuracy: u16, + // ^ Horizontal position estimated standard deviation + pub v_accuracy: u16, + // ^ Vertical position estimated standard deviation + pub n_sats: u8, + // ^ Number of satellites used in solution. + pub flags: u8, + // ^ Status flags +} + +impl MsgPosLLH { + pub const TYPE: u16 = 522; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgPosLLH{ + tow: _buf.read_u32::()?, + lat: _buf.read_f64::()?, + lon: _buf.read_f64::()?, + height: _buf.read_f64::()?, + h_accuracy: _buf.read_u16::()?, + v_accuracy: _buf.read_u16::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Geodetic Position +// +// This position solution message reports the absolute geodetic +// coordinates and the status (single point vs pseudo-absolute RTK) +// of the position solution as well as the upper triangle of the 3x3 +// covariance matrix. The position information and Fix Mode flags should +// follow the MSG_POS_LLH message. Since the covariance matrix is computed +// in the local-level North, East, Down frame, the covariance terms follow +// with that convention. Thus, covariances are reported against the "downward" +// measurement and care should be taken with the sign convention. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgPosLLHCov { + pub tow: u32, + // ^ GPS Time of Week + pub lat: f64, + // ^ Latitude + pub lon: f64, + // ^ Longitude + pub height: f64, + // ^ Height above WGS84 ellipsoid + pub cov_n_n: f32, + // ^ Estimated variance of northing + pub cov_n_e: f32, + // ^ Covariance of northing and easting + pub cov_n_d: f32, + // ^ Covariance of northing and downward measurement + pub cov_e_e: f32, + // ^ Estimated variance of easting + pub cov_e_d: f32, + // ^ Covariance of easting and downward measurement + pub cov_d_d: f32, + // ^ Estimated variance of downward measurement + pub n_sats: u8, + // ^ Number of satellites used in solution. + pub flags: u8, + // ^ Status flags +} + +impl MsgPosLLHCov { + pub const TYPE: u16 = 529; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgPosLLHCov{ + tow: _buf.read_u32::()?, + lat: _buf.read_f64::()?, + lon: _buf.read_f64::()?, + height: _buf.read_f64::()?, + cov_n_n: _buf.read_f32::()?, + cov_n_e: _buf.read_f32::()?, + cov_n_d: _buf.read_f32::()?, + cov_e_e: _buf.read_f32::()?, + cov_e_d: _buf.read_f32::()?, + cov_d_d: _buf.read_f32::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Baseline Position in ECEF +// +// This message reports the baseline solution in Earth Centered +// Earth Fixed (ECEF) coordinates. This baseline is the relative +// vector distance from the base station to the rover receiver. The +// full GPS time is given by the preceding MSG_GPS_TIME with the +// matching time-of-week (tow). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgBaselineECEF { + pub tow: u32, + // ^ GPS Time of Week + pub x: i32, + // ^ Baseline ECEF X coordinate + pub y: i32, + // ^ Baseline ECEF Y coordinate + pub z: i32, + // ^ Baseline ECEF Z coordinate + pub accuracy: u16, + // ^ Position estimated standard deviation + pub n_sats: u8, + // ^ Number of satellites used in solution + pub flags: u8, + // ^ Status flags +} + +impl MsgBaselineECEF { + pub const TYPE: u16 = 523; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgBaselineECEF{ + tow: _buf.read_u32::()?, + x: _buf.read_i32::()?, + y: _buf.read_i32::()?, + z: _buf.read_i32::()?, + accuracy: _buf.read_u16::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Baseline in NED +// +// This message reports the baseline solution in North East Down +// (NED) coordinates. This baseline is the relative vector distance +// from the base station to the rover receiver, and NED coordinate +// system is defined at the local WGS84 tangent plane centered at the +// base station position. The full GPS time is given by the +// preceding MSG_GPS_TIME with the matching time-of-week (tow). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgBaselineNED { + pub tow: u32, + // ^ GPS Time of Week + pub n: i32, + // ^ Baseline North coordinate + pub e: i32, + // ^ Baseline East coordinate + pub d: i32, + // ^ Baseline Down coordinate + pub h_accuracy: u16, + // ^ Horizontal position estimated standard deviation + pub v_accuracy: u16, + // ^ Vertical position estimated standard deviation + pub n_sats: u8, + // ^ Number of satellites used in solution + pub flags: u8, + // ^ Status flags +} + +impl MsgBaselineNED { + pub const TYPE: u16 = 524; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgBaselineNED{ + tow: _buf.read_u32::()?, + n: _buf.read_i32::()?, + e: _buf.read_i32::()?, + d: _buf.read_i32::()?, + h_accuracy: _buf.read_u16::()?, + v_accuracy: _buf.read_u16::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Velocity in ECEF +// +// This message reports the velocity in Earth Centered Earth Fixed +// (ECEF) coordinates. The full GPS time is given by the preceding +// MSG_GPS_TIME with the matching time-of-week (tow). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgVelECEF { + pub tow: u32, + // ^ GPS Time of Week + pub x: i32, + // ^ Velocity ECEF X coordinate + pub y: i32, + // ^ Velocity ECEF Y coordinate + pub z: i32, + // ^ Velocity ECEF Z coordinate + pub accuracy: u16, + // ^ Velocity estimated standard deviation + pub n_sats: u8, + // ^ Number of satellites used in solution + pub flags: u8, + // ^ Status flags +} + +impl MsgVelECEF { + pub const TYPE: u16 = 525; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgVelECEF{ + tow: _buf.read_u32::()?, + x: _buf.read_i32::()?, + y: _buf.read_i32::()?, + z: _buf.read_i32::()?, + accuracy: _buf.read_u16::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Velocity in ECEF +// +// This message reports the velocity in Earth Centered Earth Fixed +// (ECEF) coordinates. The full GPS time is given by the preceding +// MSG_GPS_TIME with the matching time-of-week (tow). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgVelECEFCov { + pub tow: u32, + // ^ GPS Time of Week + pub x: i32, + // ^ Velocity ECEF X coordinate + pub y: i32, + // ^ Velocity ECEF Y coordinate + pub z: i32, + // ^ Velocity ECEF Z coordinate + pub cov_x_x: f32, + // ^ Estimated variance of x + pub cov_x_y: f32, + // ^ Estimated covariance of x and y + pub cov_x_z: f32, + // ^ Estimated covariance of x and z + pub cov_y_y: f32, + // ^ Estimated variance of y + pub cov_y_z: f32, + // ^ Estimated covariance of y and z + pub cov_z_z: f32, + // ^ Estimated variance of z + pub n_sats: u8, + // ^ Number of satellites used in solution + pub flags: u8, + // ^ Status flags +} + +impl MsgVelECEFCov { + pub const TYPE: u16 = 533; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgVelECEFCov{ + tow: _buf.read_u32::()?, + x: _buf.read_i32::()?, + y: _buf.read_i32::()?, + z: _buf.read_i32::()?, + cov_x_x: _buf.read_f32::()?, + cov_x_y: _buf.read_f32::()?, + cov_x_z: _buf.read_f32::()?, + cov_y_y: _buf.read_f32::()?, + cov_y_z: _buf.read_f32::()?, + cov_z_z: _buf.read_f32::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Velocity in NED +// +// This message reports the velocity in local North East Down (NED) +// coordinates. The NED coordinate system is defined as the local WGS84 +// tangent plane centered at the current position. The full GPS time is +// given by the preceding MSG_GPS_TIME with the matching time-of-week (tow). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgVelNED { + pub tow: u32, + // ^ GPS Time of Week + pub n: i32, + // ^ Velocity North coordinate + pub e: i32, + // ^ Velocity East coordinate + pub d: i32, + // ^ Velocity Down coordinate + pub h_accuracy: u16, + // ^ Horizontal velocity estimated standard deviation + pub v_accuracy: u16, + // ^ Vertical velocity estimated standard deviation + pub n_sats: u8, + // ^ Number of satellites used in solution + pub flags: u8, + // ^ Status flags +} + +impl MsgVelNED { + pub const TYPE: u16 = 526; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgVelNED{ + tow: _buf.read_u32::()?, + n: _buf.read_i32::()?, + e: _buf.read_i32::()?, + d: _buf.read_i32::()?, + h_accuracy: _buf.read_u16::()?, + v_accuracy: _buf.read_u16::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Velocity in NED +// +// This message reports the velocity in local North East Down (NED) +// coordinates. The NED coordinate system is defined as the local WGS84 +// tangent plane centered at the current position. The full GPS time is +// given by the preceding MSG_GPS_TIME with the matching time-of-week (tow). +// This message is similar to the MSG_VEL_NED, but it includes the upper triangular +// portion of the 3x3 covariance matrix. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgVelNEDCov { + pub tow: u32, + // ^ GPS Time of Week + pub n: i32, + // ^ Velocity North coordinate + pub e: i32, + // ^ Velocity East coordinate + pub d: i32, + // ^ Velocity Down coordinate + pub cov_n_n: f32, + // ^ Estimated variance of northward measurement + pub cov_n_e: f32, + // ^ Covariance of northward and eastward measurement + pub cov_n_d: f32, + // ^ Covariance of northward and downward measurement + pub cov_e_e: f32, + // ^ Estimated variance of eastward measurement + pub cov_e_d: f32, + // ^ Covariance of eastward and downward measurement + pub cov_d_d: f32, + // ^ Estimated variance of downward measurement + pub n_sats: u8, + // ^ Number of satellites used in solution + pub flags: u8, + // ^ Status flags +} + +impl MsgVelNEDCov { + pub const TYPE: u16 = 530; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgVelNEDCov{ + tow: _buf.read_u32::()?, + n: _buf.read_i32::()?, + e: _buf.read_i32::()?, + d: _buf.read_i32::()?, + cov_n_n: _buf.read_f32::()?, + cov_n_e: _buf.read_f32::()?, + cov_n_d: _buf.read_f32::()?, + cov_e_e: _buf.read_f32::()?, + cov_e_d: _buf.read_f32::()?, + cov_d_d: _buf.read_f32::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Velocity in User Frame +// +// This message reports the velocity in the Vehicle Body Frame. By convention, +// the x-axis should point out the nose of the vehicle and represent the forward +// direction, while as the y-axis should point out the right hand side of the vehicle. +// Since this is a right handed system, z should point out the bottom of the vehicle. +// The orientation and origin of the Vehicle Body Frame are specified via the device settings. +// The full GPS time is given by the preceding MSG_GPS_TIME with the +// matching time-of-week (tow). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgVelBody { + pub tow: u32, + // ^ GPS Time of Week + pub x: i32, + // ^ Velocity in x direction + pub y: i32, + // ^ Velocity in y direction + pub z: i32, + // ^ Velocity in z direction + pub cov_x_x: f32, + // ^ Estimated variance of x + pub cov_x_y: f32, + // ^ Covariance of x and y + pub cov_x_z: f32, + // ^ Covariance of x and z + pub cov_y_y: f32, + // ^ Estimated variance of y + pub cov_y_z: f32, + // ^ Covariance of y and z + pub cov_z_z: f32, + // ^ Estimated variance of z + pub n_sats: u8, + // ^ Number of satellites used in solution + pub flags: u8, + // ^ Status flags +} + +impl MsgVelBody { + pub const TYPE: u16 = 531; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgVelBody{ + tow: _buf.read_u32::()?, + x: _buf.read_i32::()?, + y: _buf.read_i32::()?, + z: _buf.read_i32::()?, + cov_x_x: _buf.read_f32::()?, + cov_x_y: _buf.read_f32::()?, + cov_x_z: _buf.read_f32::()?, + cov_y_y: _buf.read_f32::()?, + cov_y_z: _buf.read_f32::()?, + cov_z_z: _buf.read_f32::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Age of corrections +// +// This message reports the Age of the corrections used for the current +// Differential solution +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgAgeCorrections { + pub tow: u32, + // ^ GPS Time of Week + pub age: u16, + // ^ Age of the corrections (0xFFFF indicates invalid) +} + +impl MsgAgeCorrections { + pub const TYPE: u16 = 528; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgAgeCorrections{ + tow: _buf.read_u32::()?, + age: _buf.read_u16::()?, + } ) + } +} + + +// GPS Time (v1.0) +// +// This message reports the GPS time, representing the time since +// the GPS epoch began on midnight January 6, 1980 UTC. GPS time +// counts the weeks and seconds of the week. The weeks begin at the +// Saturday/Sunday transition. GPS week 0 began at the beginning of +// the GPS time scale. +// +// Within each week number, the GPS time of the week is between +// between 0 and 604800 seconds (=60*60*24*7). Note that GPS time +// does not accumulate leap seconds, and as of now, has a small +// offset from UTC. In a message stream, this message precedes a +// set of other navigation messages referenced to the same time +// (but lacking the ns field) and indicates a more precise time of +// these messages. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgGPSTimeDepA { + pub wn: u16, + // ^ GPS week number + pub tow: u32, + // ^ GPS time of week rounded to the nearest millisecond + pub ns_residual: i32, + // ^ Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to + // 500000) + pub flags: u8, + // ^ Status flags (reserved) +} + +impl MsgGPSTimeDepA { + pub const TYPE: u16 = 256; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgGPSTimeDepA{ + wn: _buf.read_u16::()?, + tow: _buf.read_u32::()?, + ns_residual: _buf.read_i32::()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Dilution of Precision +// +// This dilution of precision (DOP) message describes the effect of +// navigation satellite geometry on positional measurement +// precision. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgDopsDepA { + pub tow: u32, + // ^ GPS Time of Week + pub gdop: u16, + // ^ Geometric Dilution of Precision + pub pdop: u16, + // ^ Position Dilution of Precision + pub tdop: u16, + // ^ Time Dilution of Precision + pub hdop: u16, + // ^ Horizontal Dilution of Precision + pub vdop: u16, + // ^ Vertical Dilution of Precision +} + +impl MsgDopsDepA { + pub const TYPE: u16 = 518; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgDopsDepA{ + tow: _buf.read_u32::()?, + gdop: _buf.read_u16::()?, + pdop: _buf.read_u16::()?, + tdop: _buf.read_u16::()?, + hdop: _buf.read_u16::()?, + vdop: _buf.read_u16::()?, + } ) + } +} + + +// Single-point position in ECEF +// +// The position solution message reports absolute Earth Centered +// Earth Fixed (ECEF) coordinates and the status (single point vs +// pseudo-absolute RTK) of the position solution. If the rover +// receiver knows the surveyed position of the base station and has +// an RTK solution, this reports a pseudo-absolute position +// solution using the base station position and the rover's RTK +// baseline vector. The full GPS time is given by the preceding +// MSG_GPS_TIME with the matching time-of-week (tow). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgPosECEFDepA { + pub tow: u32, + // ^ GPS Time of Week + pub x: f64, + // ^ ECEF X coordinate + pub y: f64, + // ^ ECEF Y coordinate + pub z: f64, + // ^ ECEF Z coordinate + pub accuracy: u16, + // ^ Position accuracy estimate (not implemented). Defaults to 0. + pub n_sats: u8, + // ^ Number of satellites used in solution + pub flags: u8, + // ^ Status flags +} + +impl MsgPosECEFDepA { + pub const TYPE: u16 = 512; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgPosECEFDepA{ + tow: _buf.read_u32::()?, + x: _buf.read_f64::()?, + y: _buf.read_f64::()?, + z: _buf.read_f64::()?, + accuracy: _buf.read_u16::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Geodetic Position +// +// This position solution message reports the absolute geodetic +// coordinates and the status (single point vs pseudo-absolute RTK) +// of the position solution. If the rover receiver knows the +// surveyed position of the base station and has an RTK solution, +// this reports a pseudo-absolute position solution using the base +// station position and the rover's RTK baseline vector. The full +// GPS time is given by the preceding MSG_GPS_TIME with the +// matching time-of-week (tow). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgPosLLHDepA { + pub tow: u32, + // ^ GPS Time of Week + pub lat: f64, + // ^ Latitude + pub lon: f64, + // ^ Longitude + pub height: f64, + // ^ Height + pub h_accuracy: u16, + // ^ Horizontal position accuracy estimate (not implemented). Defaults to 0. + pub v_accuracy: u16, + // ^ Vertical position accuracy estimate (not implemented). Defaults to 0. + pub n_sats: u8, + // ^ Number of satellites used in solution. + pub flags: u8, + // ^ Status flags +} + +impl MsgPosLLHDepA { + pub const TYPE: u16 = 513; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgPosLLHDepA{ + tow: _buf.read_u32::()?, + lat: _buf.read_f64::()?, + lon: _buf.read_f64::()?, + height: _buf.read_f64::()?, + h_accuracy: _buf.read_u16::()?, + v_accuracy: _buf.read_u16::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Baseline Position in ECEF +// +// This message reports the baseline solution in Earth Centered +// Earth Fixed (ECEF) coordinates. This baseline is the relative +// vector distance from the base station to the rover receiver. The +// full GPS time is given by the preceding MSG_GPS_TIME with the +// matching time-of-week (tow). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgBaselineECEFDepA { + pub tow: u32, + // ^ GPS Time of Week + pub x: i32, + // ^ Baseline ECEF X coordinate + pub y: i32, + // ^ Baseline ECEF Y coordinate + pub z: i32, + // ^ Baseline ECEF Z coordinate + pub accuracy: u16, + // ^ Position accuracy estimate + pub n_sats: u8, + // ^ Number of satellites used in solution + pub flags: u8, + // ^ Status flags +} + +impl MsgBaselineECEFDepA { + pub const TYPE: u16 = 514; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgBaselineECEFDepA{ + tow: _buf.read_u32::()?, + x: _buf.read_i32::()?, + y: _buf.read_i32::()?, + z: _buf.read_i32::()?, + accuracy: _buf.read_u16::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Baseline in NED +// +// This message reports the baseline solution in North East Down +// (NED) coordinates. This baseline is the relative vector distance +// from the base station to the rover receiver, and NED coordinate +// system is defined at the local WGS84 tangent plane centered at the +// base station position. The full GPS time is given by the +// preceding MSG_GPS_TIME with the matching time-of-week (tow). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgBaselineNEDDepA { + pub tow: u32, + // ^ GPS Time of Week + pub n: i32, + // ^ Baseline North coordinate + pub e: i32, + // ^ Baseline East coordinate + pub d: i32, + // ^ Baseline Down coordinate + pub h_accuracy: u16, + // ^ Horizontal position accuracy estimate (not implemented). Defaults to 0. + pub v_accuracy: u16, + // ^ Vertical position accuracy estimate (not implemented). Defaults to 0. + pub n_sats: u8, + // ^ Number of satellites used in solution + pub flags: u8, + // ^ Status flags +} + +impl MsgBaselineNEDDepA { + pub const TYPE: u16 = 515; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgBaselineNEDDepA{ + tow: _buf.read_u32::()?, + n: _buf.read_i32::()?, + e: _buf.read_i32::()?, + d: _buf.read_i32::()?, + h_accuracy: _buf.read_u16::()?, + v_accuracy: _buf.read_u16::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Velocity in ECEF +// +// This message reports the velocity in Earth Centered Earth Fixed +// (ECEF) coordinates. The full GPS time is given by the preceding +// MSG_GPS_TIME with the matching time-of-week (tow). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgVelECEFDepA { + pub tow: u32, + // ^ GPS Time of Week + pub x: i32, + // ^ Velocity ECEF X coordinate + pub y: i32, + // ^ Velocity ECEF Y coordinate + pub z: i32, + // ^ Velocity ECEF Z coordinate + pub accuracy: u16, + // ^ Velocity accuracy estimate (not implemented). Defaults to 0. + pub n_sats: u8, + // ^ Number of satellites used in solution + pub flags: u8, + // ^ Status flags (reserved) +} + +impl MsgVelECEFDepA { + pub const TYPE: u16 = 516; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgVelECEFDepA{ + tow: _buf.read_u32::()?, + x: _buf.read_i32::()?, + y: _buf.read_i32::()?, + z: _buf.read_i32::()?, + accuracy: _buf.read_u16::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Velocity in NED +// +// This message reports the velocity in local North East Down (NED) +// coordinates. The NED coordinate system is defined as the local WGS84 +// tangent plane centered at the current position. The full GPS time is +// given by the preceding MSG_GPS_TIME with the matching time-of-week (tow). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgVelNEDDepA { + pub tow: u32, + // ^ GPS Time of Week + pub n: i32, + // ^ Velocity North coordinate + pub e: i32, + // ^ Velocity East coordinate + pub d: i32, + // ^ Velocity Down coordinate + pub h_accuracy: u16, + // ^ Horizontal velocity accuracy estimate (not implemented). Defaults to 0. + pub v_accuracy: u16, + // ^ Vertical velocity accuracy estimate (not implemented). Defaults to 0. + pub n_sats: u8, + // ^ Number of satellites used in solution + pub flags: u8, + // ^ Status flags (reserved) +} + +impl MsgVelNEDDepA { + pub const TYPE: u16 = 517; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgVelNEDDepA{ + tow: _buf.read_u32::()?, + n: _buf.read_i32::()?, + e: _buf.read_i32::()?, + d: _buf.read_i32::()?, + h_accuracy: _buf.read_u16::()?, + v_accuracy: _buf.read_u16::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Heading relative to True North +// +// This message reports the baseline heading pointing from the base station +// to the rover relative to True North. The full GPS time is given by the +// preceding MSG_GPS_TIME with the matching time-of-week (tow). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgBaselineHeadingDepA { + pub tow: u32, + // ^ GPS Time of Week + pub heading: u32, + // ^ Heading + pub n_sats: u8, + // ^ Number of satellites used in solution + pub flags: u8, + // ^ Status flags +} + +impl MsgBaselineHeadingDepA { + pub const TYPE: u16 = 519; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgBaselineHeadingDepA{ + tow: _buf.read_u32::()?, + heading: _buf.read_u32::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + diff --git a/rust/sbp/src/messages/ndb.rs b/rust/sbp/src/messages/ndb.rs new file mode 100644 index 0000000000..7e2b8d5fda --- /dev/null +++ b/rust/sbp/src/messages/ndb.rs @@ -0,0 +1,70 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/ndb.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Messages for logging NDB events. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; +use super::gnss::*; + + +// Navigation DataBase Event +// +// This message is sent out when an object is stored into NDB. If needed +// message could also be sent out when fetching an object from NDB. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgNdbEvent { + pub recv_time: u64, + // ^ HW time in milliseconds. + pub event: u8, + // ^ Event type. + pub object_type: u8, + // ^ Event object type. + pub result: u8, + // ^ Event result. + pub data_source: u8, + // ^ Data source for STORE event, reserved for other events. + pub object_sid: GnssSignal, + // ^ GNSS signal identifier, If object_type is Ephemeris OR Almanac, sid + // indicates for which signal the object belongs to. Reserved in other + // cases. + pub src_sid: GnssSignal, + // ^ GNSS signal identifier, If object_type is Almanac, Almanac WN, Iono OR + // L2C capabilities AND data_source is NDB_DS_RECEIVER sid indicates from + // which SV data was decoded. Reserved in other cases. + pub original_sender: u16, + // ^ A unique identifier of the sending hardware. For v1.0, set to the 2 + // least significant bytes of the device serial number, valid only if + // data_source is NDB_DS_SBP. Reserved in case of other data_source. +} + +impl MsgNdbEvent { + pub const TYPE: u16 = 1024; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgNdbEvent{ + recv_time: _buf.read_u64::()?, + event: _buf.read_u8()?, + object_type: _buf.read_u8()?, + result: _buf.read_u8()?, + data_source: _buf.read_u8()?, + object_sid: GnssSignal::parse(_buf)?, + src_sid: GnssSignal::parse(_buf)?, + original_sender: _buf.read_u16::()?, + } ) + } +} + diff --git a/rust/sbp/src/messages/observation.rs b/rust/sbp/src/messages/observation.rs new file mode 100644 index 0000000000..64e182396d --- /dev/null +++ b/rust/sbp/src/messages/observation.rs @@ -0,0 +1,2027 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/observation.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Satellite observation messages from the device. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; +use super::gnss::*; + + +// Header for observation message. +// +// Header of a GNSS observation message. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct ObservationHeader { + pub t: GPSTime, + // ^ GNSS time of this observation + pub n_obs: u8, + // ^ Total number of observations. First nibble is the size of the sequence + // (n), second nibble is the zero-indexed counter (ith packet of n) +} + +impl ObservationHeader { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( ObservationHeader{ + t: GPSTime::parse(_buf)?, + n_obs: _buf.read_u8()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( ObservationHeader::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( ObservationHeader::parse(buf)? ); + } + Ok(v) + } +} + + +// GNSS doppler measurement. +// +// Doppler measurement in Hz represented as a 24-bit +// fixed point number with Q16.8 layout, i.e. 16-bits of whole +// doppler and 8-bits of fractional doppler. This doppler is defined +// as positive for approaching satellites. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct Doppler { + pub i: i16, + // ^ Doppler whole Hz + pub f: u8, + // ^ Doppler fractional part +} + +impl Doppler { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( Doppler{ + i: _buf.read_i16::()?, + f: _buf.read_u8()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( Doppler::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( Doppler::parse(buf)? ); + } + Ok(v) + } +} + + +// GNSS observations for a particular satellite signal. +// +// Pseudorange and carrier phase observation for a satellite being +// tracked. The observations are interoperable with 3rd party +// receivers and conform with typical RTCMv3 GNSS observations. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct PackedObsContent { + pub P: u32, + // ^ Pseudorange observation + pub L: CarrierPhase, + // ^ Carrier phase observation with typical sign convention. + pub D: Doppler, + // ^ Doppler observation with typical sign convention. + pub cn0: u8, + // ^ Carrier-to-Noise density. Zero implies invalid cn0. + pub lock: u8, + // ^ Lock timer. This value gives an indication of the time for which a + // signal has maintained continuous phase lock. Whenever a signal has lost + // and regained lock, this value is reset to zero. It is encoded according + // to DF402 from the RTCM 10403.2 Amendment 2 specification. Valid values + // range from 0 to 15 and the most significant nibble is reserved for + // future use. + pub flags: u8, + // ^ Measurement status flags. A bit field of flags providing the status of + // this observation. If this field is 0 it means only the Cn0 estimate for + // the signal is valid. + pub sid: GnssSignal, + // ^ GNSS signal identifier (16 bit) +} + +impl PackedObsContent { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( PackedObsContent{ + P: _buf.read_u32::()?, + L: CarrierPhase::parse(_buf)?, + D: Doppler::parse(_buf)?, + cn0: _buf.read_u8()?, + lock: _buf.read_u8()?, + flags: _buf.read_u8()?, + sid: GnssSignal::parse(_buf)?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( PackedObsContent::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( PackedObsContent::parse(buf)? ); + } + Ok(v) + } +} + + +// GPS satellite observations +// +// The GPS observations message reports all the raw pseudorange and +// carrier phase observations for the satellites being tracked by +// the device. Carrier phase observation here is represented as a +// 40-bit fixed point number with Q32.8 layout (i.e. 32-bits of +// whole cycles and 8-bits of fractional cycles). The observations +// are be interoperable with 3rd party receivers and conform +// with typical RTCMv3 GNSS observations. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgObs { + pub header: ObservationHeader, + // ^ Header of a GPS observation message + pub obs: Vec, + // ^ Pseudorange and carrier phase observation for a satellite being tracked. +} + +impl MsgObs { + pub const TYPE: u16 = 74; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgObs{ + header: ObservationHeader::parse(_buf)?, + obs: PackedObsContent::parse_array(_buf)?, + } ) + } +} + + +// Base station position +// +// The base station position message is the position reported by +// the base station itself. It is used for pseudo-absolute RTK +// positioning, and is required to be a high-accuracy surveyed +// location of the base station. Any error here will result in an +// error in the pseudo-absolute position output. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgBasePosLLH { + pub lat: f64, + // ^ Latitude + pub lon: f64, + // ^ Longitude + pub height: f64, + // ^ Height +} + +impl MsgBasePosLLH { + pub const TYPE: u16 = 68; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgBasePosLLH{ + lat: _buf.read_f64::()?, + lon: _buf.read_f64::()?, + height: _buf.read_f64::()?, + } ) + } +} + + +// Base station position in ECEF +// +// The base station position message is the position reported by +// the base station itself in absolute Earth Centered Earth Fixed +// coordinates. It is used for pseudo-absolute RTK positioning, and +// is required to be a high-accuracy surveyed location of the base +// station. Any error here will result in an error in the +// pseudo-absolute position output. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgBasePosECEF { + pub x: f64, + // ^ ECEF X coodinate + pub y: f64, + // ^ ECEF Y coordinate + pub z: f64, + // ^ ECEF Z coordinate +} + +impl MsgBasePosECEF { + pub const TYPE: u16 = 72; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgBasePosECEF{ + x: _buf.read_f64::()?, + y: _buf.read_f64::()?, + z: _buf.read_f64::()?, + } ) + } +} + + +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct EphemerisCommonContent { + pub sid: GnssSignal, + // ^ GNSS signal identifier (16 bit) + pub toe: GPSTimeSec, + // ^ Time of Ephemerides + pub ura: f64, + // ^ User Range Accuracy + pub fit_interval: u32, + // ^ Curve fit interval + pub valid: u8, + // ^ Status of ephemeris, 1 = valid, 0 = invalid + pub health_bits: u8, + // ^ Satellite health status. GPS: ICD-GPS-200, chapter 20.3.3.3.1.4 SBAS: 0 + // = valid, non-zero = invalid GLO: 0 = valid, non-zero = invalid +} + +impl EphemerisCommonContent { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( EphemerisCommonContent{ + sid: GnssSignal::parse(_buf)?, + toe: GPSTimeSec::parse(_buf)?, + ura: _buf.read_f64::()?, + fit_interval: _buf.read_u32::()?, + valid: _buf.read_u8()?, + health_bits: _buf.read_u8()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( EphemerisCommonContent::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( EphemerisCommonContent::parse(buf)? ); + } + Ok(v) + } +} + + +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct EphemerisCommonContentDepA { + pub sid: GnssSignalDep, + // ^ GNSS signal identifier + pub toe: GPSTimeDep, + // ^ Time of Ephemerides + pub ura: f64, + // ^ User Range Accuracy + pub fit_interval: u32, + // ^ Curve fit interval + pub valid: u8, + // ^ Status of ephemeris, 1 = valid, 0 = invalid + pub health_bits: u8, + // ^ Satellite health status. GPS: ICD-GPS-200, chapter 20.3.3.3.1.4 SBAS: 0 + // = valid, non-zero = invalid GLO: 0 = valid, non-zero = invalid +} + +impl EphemerisCommonContentDepA { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( EphemerisCommonContentDepA{ + sid: GnssSignalDep::parse(_buf)?, + toe: GPSTimeDep::parse(_buf)?, + ura: _buf.read_f64::()?, + fit_interval: _buf.read_u32::()?, + valid: _buf.read_u8()?, + health_bits: _buf.read_u8()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( EphemerisCommonContentDepA::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( EphemerisCommonContentDepA::parse(buf)? ); + } + Ok(v) + } +} + + +// Satellite broadcast ephemeris for GPS +// +// The ephemeris message returns a set of satellite orbit +// parameters that is used to calculate GPS satellite position, +// velocity, and clock offset. Please see the Navstar GPS +// Space Segment/Navigation user interfaces (ICD-GPS-200, Table +// 20-III) for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisGPSDepE { + pub common: EphemerisCommonContentDepA, + // ^ Values common for all ephemeris types + pub tgd: f64, + // ^ Group delay differential between L1 and L2 + pub c_rs: f64, + // ^ Amplitude of the sine harmonic correction term to the orbit radius + pub c_rc: f64, + // ^ Amplitude of the cosine harmonic correction term to the orbit radius + pub c_uc: f64, + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude + pub c_us: f64, + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude + pub c_ic: f64, + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination + pub c_is: f64, + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination + pub dn: f64, + // ^ Mean motion difference + pub m0: f64, + // ^ Mean anomaly at reference time + pub ecc: f64, + // ^ Eccentricity of satellite orbit + pub sqrta: f64, + // ^ Square root of the semi-major axis of orbit + pub omega0: f64, + // ^ Longitude of ascending node of orbit plane at weekly epoch + pub omegadot: f64, + // ^ Rate of right ascension + pub w: f64, + // ^ Argument of perigee + pub inc: f64, + // ^ Inclination + pub inc_dot: f64, + // ^ Inclination first derivative + pub af0: f64, + // ^ Polynomial clock correction coefficient (clock bias) + pub af1: f64, + // ^ Polynomial clock correction coefficient (clock drift) + pub af2: f64, + // ^ Polynomial clock correction coefficient (rate of clock drift) + pub toc: GPSTimeDep, + // ^ Clock reference + pub iode: u8, + // ^ Issue of ephemeris data + pub iodc: u16, + // ^ Issue of clock data +} + +impl MsgEphemerisGPSDepE { + pub const TYPE: u16 = 129; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgEphemerisGPSDepE{ + common: EphemerisCommonContentDepA::parse(_buf)?, + tgd: _buf.read_f64::()?, + c_rs: _buf.read_f64::()?, + c_rc: _buf.read_f64::()?, + c_uc: _buf.read_f64::()?, + c_us: _buf.read_f64::()?, + c_ic: _buf.read_f64::()?, + c_is: _buf.read_f64::()?, + dn: _buf.read_f64::()?, + m0: _buf.read_f64::()?, + ecc: _buf.read_f64::()?, + sqrta: _buf.read_f64::()?, + omega0: _buf.read_f64::()?, + omegadot: _buf.read_f64::()?, + w: _buf.read_f64::()?, + inc: _buf.read_f64::()?, + inc_dot: _buf.read_f64::()?, + af0: _buf.read_f64::()?, + af1: _buf.read_f64::()?, + af2: _buf.read_f64::()?, + toc: GPSTimeDep::parse(_buf)?, + iode: _buf.read_u8()?, + iodc: _buf.read_u16::()?, + } ) + } +} + + +// Satellite broadcast ephemeris for GPS +// +// The ephemeris message returns a set of satellite orbit +// parameters that is used to calculate GPS satellite position, +// velocity, and clock offset. Please see the Navstar GPS +// Space Segment/Navigation user interfaces (ICD-GPS-200, Table +// 20-III) for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisGPS { + pub common: EphemerisCommonContent, + // ^ Values common for all ephemeris types + pub tgd: f64, + // ^ Group delay differential between L1 and L2 + pub c_rs: f64, + // ^ Amplitude of the sine harmonic correction term to the orbit radius + pub c_rc: f64, + // ^ Amplitude of the cosine harmonic correction term to the orbit radius + pub c_uc: f64, + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude + pub c_us: f64, + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude + pub c_ic: f64, + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination + pub c_is: f64, + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination + pub dn: f64, + // ^ Mean motion difference + pub m0: f64, + // ^ Mean anomaly at reference time + pub ecc: f64, + // ^ Eccentricity of satellite orbit + pub sqrta: f64, + // ^ Square root of the semi-major axis of orbit + pub omega0: f64, + // ^ Longitude of ascending node of orbit plane at weekly epoch + pub omegadot: f64, + // ^ Rate of right ascension + pub w: f64, + // ^ Argument of perigee + pub inc: f64, + // ^ Inclination + pub inc_dot: f64, + // ^ Inclination first derivative + pub af0: f64, + // ^ Polynomial clock correction coefficient (clock bias) + pub af1: f64, + // ^ Polynomial clock correction coefficient (clock drift) + pub af2: f64, + // ^ Polynomial clock correction coefficient (rate of clock drift) + pub toc: GPSTimeSec, + // ^ Clock reference + pub iode: u8, + // ^ Issue of ephemeris data + pub iodc: u16, + // ^ Issue of clock data +} + +impl MsgEphemerisGPS { + pub const TYPE: u16 = 134; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgEphemerisGPS{ + common: EphemerisCommonContent::parse(_buf)?, + tgd: _buf.read_f64::()?, + c_rs: _buf.read_f64::()?, + c_rc: _buf.read_f64::()?, + c_uc: _buf.read_f64::()?, + c_us: _buf.read_f64::()?, + c_ic: _buf.read_f64::()?, + c_is: _buf.read_f64::()?, + dn: _buf.read_f64::()?, + m0: _buf.read_f64::()?, + ecc: _buf.read_f64::()?, + sqrta: _buf.read_f64::()?, + omega0: _buf.read_f64::()?, + omegadot: _buf.read_f64::()?, + w: _buf.read_f64::()?, + inc: _buf.read_f64::()?, + inc_dot: _buf.read_f64::()?, + af0: _buf.read_f64::()?, + af1: _buf.read_f64::()?, + af2: _buf.read_f64::()?, + toc: GPSTimeSec::parse(_buf)?, + iode: _buf.read_u8()?, + iodc: _buf.read_u16::()?, + } ) + } +} + + +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisSbasDepA { + pub common: EphemerisCommonContentDepA, + // ^ Values common for all ephemeris types + pub pos: Vec, + // ^ Position of the GEO at time toe + pub vel: Vec, + // ^ Velocity of the GEO at time toe + pub acc: Vec, + // ^ Acceleration of the GEO at time toe + pub a_gf0: f64, + // ^ Time offset of the GEO clock w.r.t. SBAS Network Time + pub a_gf1: f64, + // ^ Drift of the GEO clock w.r.t. SBAS Network Time +} + +impl MsgEphemerisSbasDepA { + pub const TYPE: u16 = 130; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgEphemerisSbasDepA{ + common: EphemerisCommonContentDepA::parse(_buf)?, + pos: ::read_double_array_limit(_buf, 3)?, + vel: ::read_double_array_limit(_buf, 3)?, + acc: ::read_double_array_limit(_buf, 3)?, + a_gf0: _buf.read_f64::()?, + a_gf1: _buf.read_f64::()?, + } ) + } +} + + +// Satellite broadcast ephemeris for GLO +// +// The ephemeris message returns a set of satellite orbit +// parameters that is used to calculate GLO satellite position, +// velocity, and clock offset. Please see the GLO ICD 5.1 "Table 4.5 +// Characteristics of words of immediate information (ephemeris parameters)" +// for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisGloDepA { + pub common: EphemerisCommonContentDepA, + // ^ Values common for all ephemeris types + pub gamma: f64, + // ^ Relative deviation of predicted carrier frequency from nominal + pub tau: f64, + // ^ Correction to the SV time + pub pos: Vec, + // ^ Position of the SV at tb in PZ-90.02 coordinates system + pub vel: Vec, + // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system + pub acc: Vec, + // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys +} + +impl MsgEphemerisGloDepA { + pub const TYPE: u16 = 131; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgEphemerisGloDepA{ + common: EphemerisCommonContentDepA::parse(_buf)?, + gamma: _buf.read_f64::()?, + tau: _buf.read_f64::()?, + pos: ::read_double_array_limit(_buf, 3)?, + vel: ::read_double_array_limit(_buf, 3)?, + acc: ::read_double_array_limit(_buf, 3)?, + } ) + } +} + + +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisSbas { + pub common: EphemerisCommonContent, + // ^ Values common for all ephemeris types + pub pos: Vec, + // ^ Position of the GEO at time toe + pub vel: Vec, + // ^ Velocity of the GEO at time toe + pub acc: Vec, + // ^ Acceleration of the GEO at time toe + pub a_gf0: f64, + // ^ Time offset of the GEO clock w.r.t. SBAS Network Time + pub a_gf1: f64, + // ^ Drift of the GEO clock w.r.t. SBAS Network Time +} + +impl MsgEphemerisSbas { + pub const TYPE: u16 = 132; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgEphemerisSbas{ + common: EphemerisCommonContent::parse(_buf)?, + pos: ::read_double_array_limit(_buf, 3)?, + vel: ::read_double_array_limit(_buf, 3)?, + acc: ::read_double_array_limit(_buf, 3)?, + a_gf0: _buf.read_f64::()?, + a_gf1: _buf.read_f64::()?, + } ) + } +} + + +// Satellite broadcast ephemeris for GLO +// +// The ephemeris message returns a set of satellite orbit +// parameters that is used to calculate GLO satellite position, +// velocity, and clock offset. Please see the GLO ICD 5.1 "Table 4.5 +// Characteristics of words of immediate information (ephemeris parameters)" +// for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisGloDepB { + pub common: EphemerisCommonContent, + // ^ Values common for all ephemeris types + pub gamma: f64, + // ^ Relative deviation of predicted carrier frequency from nominal + pub tau: f64, + // ^ Correction to the SV time + pub pos: Vec, + // ^ Position of the SV at tb in PZ-90.02 coordinates system + pub vel: Vec, + // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system + pub acc: Vec, + // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys +} + +impl MsgEphemerisGloDepB { + pub const TYPE: u16 = 133; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgEphemerisGloDepB{ + common: EphemerisCommonContent::parse(_buf)?, + gamma: _buf.read_f64::()?, + tau: _buf.read_f64::()?, + pos: ::read_double_array_limit(_buf, 3)?, + vel: ::read_double_array_limit(_buf, 3)?, + acc: ::read_double_array_limit(_buf, 3)?, + } ) + } +} + + +// Satellite broadcast ephemeris for GLO +// +// The ephemeris message returns a set of satellite orbit +// parameters that is used to calculate GLO satellite position, +// velocity, and clock offset. Please see the GLO ICD 5.1 "Table 4.5 +// Characteristics of words of immediate information (ephemeris parameters)" +// for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisGloDepC { + pub common: EphemerisCommonContent, + // ^ Values common for all ephemeris types + pub gamma: f64, + // ^ Relative deviation of predicted carrier frequency from nominal + pub tau: f64, + // ^ Correction to the SV time + pub d_tau: f64, + // ^ Equipment delay between L1 and L2 + pub pos: Vec, + // ^ Position of the SV at tb in PZ-90.02 coordinates system + pub vel: Vec, + // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system + pub acc: Vec, + // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys + pub fcn: u8, + // ^ Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for invalid +} + +impl MsgEphemerisGloDepC { + pub const TYPE: u16 = 135; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgEphemerisGloDepC{ + common: EphemerisCommonContent::parse(_buf)?, + gamma: _buf.read_f64::()?, + tau: _buf.read_f64::()?, + d_tau: _buf.read_f64::()?, + pos: ::read_double_array_limit(_buf, 3)?, + vel: ::read_double_array_limit(_buf, 3)?, + acc: ::read_double_array_limit(_buf, 3)?, + fcn: _buf.read_u8()?, + } ) + } +} + + +// Satellite broadcast ephemeris for GLO +// +// The ephemeris message returns a set of satellite orbit +// parameters that is used to calculate GLO satellite position, +// velocity, and clock offset. Please see the GLO ICD 5.1 "Table 4.5 +// Characteristics of words of immediate information (ephemeris parameters)" +// for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisGlo { + pub common: EphemerisCommonContent, + // ^ Values common for all ephemeris types + pub gamma: f64, + // ^ Relative deviation of predicted carrier frequency from nominal + pub tau: f64, + // ^ Correction to the SV time + pub d_tau: f64, + // ^ Equipment delay between L1 and L2 + pub pos: Vec, + // ^ Position of the SV at tb in PZ-90.02 coordinates system + pub vel: Vec, + // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system + pub acc: Vec, + // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys + pub fcn: u8, + // ^ Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for invalid + pub iod: u8, + // ^ Issue of ephemeris data +} + +impl MsgEphemerisGlo { + pub const TYPE: u16 = 136; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgEphemerisGlo{ + common: EphemerisCommonContent::parse(_buf)?, + gamma: _buf.read_f64::()?, + tau: _buf.read_f64::()?, + d_tau: _buf.read_f64::()?, + pos: ::read_double_array_limit(_buf, 3)?, + vel: ::read_double_array_limit(_buf, 3)?, + acc: ::read_double_array_limit(_buf, 3)?, + fcn: _buf.read_u8()?, + iod: _buf.read_u8()?, + } ) + } +} + + +// Satellite broadcast ephemeris +// +// The ephemeris message returns a set of satellite orbit +// parameters that is used to calculate GPS satellite position, +// velocity, and clock offset. Please see the Navstar GPS +// Space Segment/Navigation user interfaces (ICD-GPS-200, Table +// 20-III) for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisDepD { + pub tgd: f64, + // ^ Group delay differential between L1 and L2 + pub c_rs: f64, + // ^ Amplitude of the sine harmonic correction term to the orbit radius + pub c_rc: f64, + // ^ Amplitude of the cosine harmonic correction term to the orbit radius + pub c_uc: f64, + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude + pub c_us: f64, + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude + pub c_ic: f64, + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination + pub c_is: f64, + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination + pub dn: f64, + // ^ Mean motion difference + pub m0: f64, + // ^ Mean anomaly at reference time + pub ecc: f64, + // ^ Eccentricity of satellite orbit + pub sqrta: f64, + // ^ Square root of the semi-major axis of orbit + pub omega0: f64, + // ^ Longitude of ascending node of orbit plane at weekly epoch + pub omegadot: f64, + // ^ Rate of right ascension + pub w: f64, + // ^ Argument of perigee + pub inc: f64, + // ^ Inclination + pub inc_dot: f64, + // ^ Inclination first derivative + pub af0: f64, + // ^ Polynomial clock correction coefficient (clock bias) + pub af1: f64, + // ^ Polynomial clock correction coefficient (clock drift) + pub af2: f64, + // ^ Polynomial clock correction coefficient (rate of clock drift) + pub toe_tow: f64, + // ^ Time of week + pub toe_wn: u16, + // ^ Week number + pub toc_tow: f64, + // ^ Clock reference time of week + pub toc_wn: u16, + // ^ Clock reference week number + pub valid: u8, + // ^ Is valid? + pub healthy: u8, + // ^ Satellite is healthy? + pub sid: GnssSignalDep, + // ^ GNSS signal identifier + pub iode: u8, + // ^ Issue of ephemeris data + pub iodc: u16, + // ^ Issue of clock data + pub reserved: u32, + // ^ Reserved field +} + +impl MsgEphemerisDepD { + pub const TYPE: u16 = 128; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgEphemerisDepD{ + tgd: _buf.read_f64::()?, + c_rs: _buf.read_f64::()?, + c_rc: _buf.read_f64::()?, + c_uc: _buf.read_f64::()?, + c_us: _buf.read_f64::()?, + c_ic: _buf.read_f64::()?, + c_is: _buf.read_f64::()?, + dn: _buf.read_f64::()?, + m0: _buf.read_f64::()?, + ecc: _buf.read_f64::()?, + sqrta: _buf.read_f64::()?, + omega0: _buf.read_f64::()?, + omegadot: _buf.read_f64::()?, + w: _buf.read_f64::()?, + inc: _buf.read_f64::()?, + inc_dot: _buf.read_f64::()?, + af0: _buf.read_f64::()?, + af1: _buf.read_f64::()?, + af2: _buf.read_f64::()?, + toe_tow: _buf.read_f64::()?, + toe_wn: _buf.read_u16::()?, + toc_tow: _buf.read_f64::()?, + toc_wn: _buf.read_u16::()?, + valid: _buf.read_u8()?, + healthy: _buf.read_u8()?, + sid: GnssSignalDep::parse(_buf)?, + iode: _buf.read_u8()?, + iodc: _buf.read_u16::()?, + reserved: _buf.read_u32::()?, + } ) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisDepA { + pub tgd: f64, + // ^ Group delay differential between L1 and L2 + pub c_rs: f64, + // ^ Amplitude of the sine harmonic correction term to the orbit radius + pub c_rc: f64, + // ^ Amplitude of the cosine harmonic correction term to the orbit radius + pub c_uc: f64, + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude + pub c_us: f64, + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude + pub c_ic: f64, + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination + pub c_is: f64, + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination + pub dn: f64, + // ^ Mean motion difference + pub m0: f64, + // ^ Mean anomaly at reference time + pub ecc: f64, + // ^ Eccentricity of satellite orbit + pub sqrta: f64, + // ^ Square root of the semi-major axis of orbit + pub omega0: f64, + // ^ Longitude of ascending node of orbit plane at weekly epoch + pub omegadot: f64, + // ^ Rate of right ascension + pub w: f64, + // ^ Argument of perigee + pub inc: f64, + // ^ Inclination + pub inc_dot: f64, + // ^ Inclination first derivative + pub af0: f64, + // ^ Polynomial clock correction coefficient (clock bias) + pub af1: f64, + // ^ Polynomial clock correction coefficient (clock drift) + pub af2: f64, + // ^ Polynomial clock correction coefficient (rate of clock drift) + pub toe_tow: f64, + // ^ Time of week + pub toe_wn: u16, + // ^ Week number + pub toc_tow: f64, + // ^ Clock reference time of week + pub toc_wn: u16, + // ^ Clock reference week number + pub valid: u8, + // ^ Is valid? + pub healthy: u8, + // ^ Satellite is healthy? + pub prn: u8, + // ^ PRN being tracked +} + +impl MsgEphemerisDepA { + pub const TYPE: u16 = 26; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgEphemerisDepA{ + tgd: _buf.read_f64::()?, + c_rs: _buf.read_f64::()?, + c_rc: _buf.read_f64::()?, + c_uc: _buf.read_f64::()?, + c_us: _buf.read_f64::()?, + c_ic: _buf.read_f64::()?, + c_is: _buf.read_f64::()?, + dn: _buf.read_f64::()?, + m0: _buf.read_f64::()?, + ecc: _buf.read_f64::()?, + sqrta: _buf.read_f64::()?, + omega0: _buf.read_f64::()?, + omegadot: _buf.read_f64::()?, + w: _buf.read_f64::()?, + inc: _buf.read_f64::()?, + inc_dot: _buf.read_f64::()?, + af0: _buf.read_f64::()?, + af1: _buf.read_f64::()?, + af2: _buf.read_f64::()?, + toe_tow: _buf.read_f64::()?, + toe_wn: _buf.read_u16::()?, + toc_tow: _buf.read_f64::()?, + toc_wn: _buf.read_u16::()?, + valid: _buf.read_u8()?, + healthy: _buf.read_u8()?, + prn: _buf.read_u8()?, + } ) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisDepB { + pub tgd: f64, + // ^ Group delay differential between L1 and L2 + pub c_rs: f64, + // ^ Amplitude of the sine harmonic correction term to the orbit radius + pub c_rc: f64, + // ^ Amplitude of the cosine harmonic correction term to the orbit radius + pub c_uc: f64, + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude + pub c_us: f64, + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude + pub c_ic: f64, + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination + pub c_is: f64, + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination + pub dn: f64, + // ^ Mean motion difference + pub m0: f64, + // ^ Mean anomaly at reference time + pub ecc: f64, + // ^ Eccentricity of satellite orbit + pub sqrta: f64, + // ^ Square root of the semi-major axis of orbit + pub omega0: f64, + // ^ Longitude of ascending node of orbit plane at weekly epoch + pub omegadot: f64, + // ^ Rate of right ascension + pub w: f64, + // ^ Argument of perigee + pub inc: f64, + // ^ Inclination + pub inc_dot: f64, + // ^ Inclination first derivative + pub af0: f64, + // ^ Polynomial clock correction coefficient (clock bias) + pub af1: f64, + // ^ Polynomial clock correction coefficient (clock drift) + pub af2: f64, + // ^ Polynomial clock correction coefficient (rate of clock drift) + pub toe_tow: f64, + // ^ Time of week + pub toe_wn: u16, + // ^ Week number + pub toc_tow: f64, + // ^ Clock reference time of week + pub toc_wn: u16, + // ^ Clock reference week number + pub valid: u8, + // ^ Is valid? + pub healthy: u8, + // ^ Satellite is healthy? + pub prn: u8, + // ^ PRN being tracked + pub iode: u8, + // ^ Issue of ephemeris data +} + +impl MsgEphemerisDepB { + pub const TYPE: u16 = 70; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgEphemerisDepB{ + tgd: _buf.read_f64::()?, + c_rs: _buf.read_f64::()?, + c_rc: _buf.read_f64::()?, + c_uc: _buf.read_f64::()?, + c_us: _buf.read_f64::()?, + c_ic: _buf.read_f64::()?, + c_is: _buf.read_f64::()?, + dn: _buf.read_f64::()?, + m0: _buf.read_f64::()?, + ecc: _buf.read_f64::()?, + sqrta: _buf.read_f64::()?, + omega0: _buf.read_f64::()?, + omegadot: _buf.read_f64::()?, + w: _buf.read_f64::()?, + inc: _buf.read_f64::()?, + inc_dot: _buf.read_f64::()?, + af0: _buf.read_f64::()?, + af1: _buf.read_f64::()?, + af2: _buf.read_f64::()?, + toe_tow: _buf.read_f64::()?, + toe_wn: _buf.read_u16::()?, + toc_tow: _buf.read_f64::()?, + toc_wn: _buf.read_u16::()?, + valid: _buf.read_u8()?, + healthy: _buf.read_u8()?, + prn: _buf.read_u8()?, + iode: _buf.read_u8()?, + } ) + } +} + + +// Satellite broadcast ephemeris +// +// The ephemeris message returns a set of satellite orbit +// parameters that is used to calculate GPS satellite position, +// velocity, and clock offset. Please see the Navstar GPS +// Space Segment/Navigation user interfaces (ICD-GPS-200, Table +// 20-III) for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisDepC { + pub tgd: f64, + // ^ Group delay differential between L1 and L2 + pub c_rs: f64, + // ^ Amplitude of the sine harmonic correction term to the orbit radius + pub c_rc: f64, + // ^ Amplitude of the cosine harmonic correction term to the orbit radius + pub c_uc: f64, + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude + pub c_us: f64, + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude + pub c_ic: f64, + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination + pub c_is: f64, + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination + pub dn: f64, + // ^ Mean motion difference + pub m0: f64, + // ^ Mean anomaly at reference time + pub ecc: f64, + // ^ Eccentricity of satellite orbit + pub sqrta: f64, + // ^ Square root of the semi-major axis of orbit + pub omega0: f64, + // ^ Longitude of ascending node of orbit plane at weekly epoch + pub omegadot: f64, + // ^ Rate of right ascension + pub w: f64, + // ^ Argument of perigee + pub inc: f64, + // ^ Inclination + pub inc_dot: f64, + // ^ Inclination first derivative + pub af0: f64, + // ^ Polynomial clock correction coefficient (clock bias) + pub af1: f64, + // ^ Polynomial clock correction coefficient (clock drift) + pub af2: f64, + // ^ Polynomial clock correction coefficient (rate of clock drift) + pub toe_tow: f64, + // ^ Time of week + pub toe_wn: u16, + // ^ Week number + pub toc_tow: f64, + // ^ Clock reference time of week + pub toc_wn: u16, + // ^ Clock reference week number + pub valid: u8, + // ^ Is valid? + pub healthy: u8, + // ^ Satellite is healthy? + pub sid: GnssSignalDep, + // ^ GNSS signal identifier + pub iode: u8, + // ^ Issue of ephemeris data + pub iodc: u16, + // ^ Issue of clock data + pub reserved: u32, + // ^ Reserved field +} + +impl MsgEphemerisDepC { + pub const TYPE: u16 = 71; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgEphemerisDepC{ + tgd: _buf.read_f64::()?, + c_rs: _buf.read_f64::()?, + c_rc: _buf.read_f64::()?, + c_uc: _buf.read_f64::()?, + c_us: _buf.read_f64::()?, + c_ic: _buf.read_f64::()?, + c_is: _buf.read_f64::()?, + dn: _buf.read_f64::()?, + m0: _buf.read_f64::()?, + ecc: _buf.read_f64::()?, + sqrta: _buf.read_f64::()?, + omega0: _buf.read_f64::()?, + omegadot: _buf.read_f64::()?, + w: _buf.read_f64::()?, + inc: _buf.read_f64::()?, + inc_dot: _buf.read_f64::()?, + af0: _buf.read_f64::()?, + af1: _buf.read_f64::()?, + af2: _buf.read_f64::()?, + toe_tow: _buf.read_f64::()?, + toe_wn: _buf.read_u16::()?, + toc_tow: _buf.read_f64::()?, + toc_wn: _buf.read_u16::()?, + valid: _buf.read_u8()?, + healthy: _buf.read_u8()?, + sid: GnssSignalDep::parse(_buf)?, + iode: _buf.read_u8()?, + iodc: _buf.read_u16::()?, + reserved: _buf.read_u32::()?, + } ) + } +} + + +// Header for observation message. +// +// Header of a GPS observation message. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct ObservationHeaderDep { + pub t: GPSTimeDep, + // ^ GPS time of this observation + pub n_obs: u8, + // ^ Total number of observations. First nibble is the size of the sequence + // (n), second nibble is the zero-indexed counter (ith packet of n) +} + +impl ObservationHeaderDep { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( ObservationHeaderDep{ + t: GPSTimeDep::parse(_buf)?, + n_obs: _buf.read_u8()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( ObservationHeaderDep::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( ObservationHeaderDep::parse(buf)? ); + } + Ok(v) + } +} + + +// GPS carrier phase measurement. +// +// Carrier phase measurement in cycles represented as a 40-bit +// fixed point number with Q32.8 layout, i.e. 32-bits of whole +// cycles and 8-bits of fractional cycles. This has the opposite +// sign convention than a typical GPS receiver and the phase has +// the opposite sign as the pseudorange. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct CarrierPhaseDepA { + pub i: i32, + // ^ Carrier phase whole cycles + pub f: u8, + // ^ Carrier phase fractional part +} + +impl CarrierPhaseDepA { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( CarrierPhaseDepA{ + i: _buf.read_i32::()?, + f: _buf.read_u8()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( CarrierPhaseDepA::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( CarrierPhaseDepA::parse(buf)? ); + } + Ok(v) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct PackedObsContentDepA { + pub P: u32, + // ^ Pseudorange observation + pub L: CarrierPhaseDepA, + // ^ Carrier phase observation with opposite sign from typical convention + pub cn0: u8, + // ^ Carrier-to-Noise density + pub lock: u16, + // ^ Lock indicator. This value changes whenever a satellite signal has lost + // and regained lock, indicating that the carrier phase ambiguity may have + // changed. + pub prn: u8, + // ^ PRN-1 identifier of the satellite signal +} + +impl PackedObsContentDepA { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( PackedObsContentDepA{ + P: _buf.read_u32::()?, + L: CarrierPhaseDepA::parse(_buf)?, + cn0: _buf.read_u8()?, + lock: _buf.read_u16::()?, + prn: _buf.read_u8()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( PackedObsContentDepA::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( PackedObsContentDepA::parse(buf)? ); + } + Ok(v) + } +} + + +// GPS observations for a particular satellite signal. +// +// Pseudorange and carrier phase observation for a satellite being +// tracked. Pseudoranges are referenced to a nominal pseudorange. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct PackedObsContentDepB { + pub P: u32, + // ^ Pseudorange observation + pub L: CarrierPhaseDepA, + // ^ Carrier phase observation with opposite sign from typical convention. + pub cn0: u8, + // ^ Carrier-to-Noise density + pub lock: u16, + // ^ Lock indicator. This value changes whenever a satellite signal has lost + // and regained lock, indicating that the carrier phase ambiguity may have + // changed. + pub sid: GnssSignalDep, + // ^ GNSS signal identifier +} + +impl PackedObsContentDepB { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( PackedObsContentDepB{ + P: _buf.read_u32::()?, + L: CarrierPhaseDepA::parse(_buf)?, + cn0: _buf.read_u8()?, + lock: _buf.read_u16::()?, + sid: GnssSignalDep::parse(_buf)?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( PackedObsContentDepB::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( PackedObsContentDepB::parse(buf)? ); + } + Ok(v) + } +} + + +// GPS observations for a particular satellite signal. +// +// Pseudorange and carrier phase observation for a satellite being +// tracked. The observations are be interoperable with 3rd party +// receivers and conform with typical RTCMv3 GNSS observations. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct PackedObsContentDepC { + pub P: u32, + // ^ Pseudorange observation + pub L: CarrierPhase, + // ^ Carrier phase observation with typical sign convention. + pub cn0: u8, + // ^ Carrier-to-Noise density + pub lock: u16, + // ^ Lock indicator. This value changes whenever a satellite signal has lost + // and regained lock, indicating that the carrier phase ambiguity may have + // changed. + pub sid: GnssSignalDep, + // ^ GNSS signal identifier +} + +impl PackedObsContentDepC { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( PackedObsContentDepC{ + P: _buf.read_u32::()?, + L: CarrierPhase::parse(_buf)?, + cn0: _buf.read_u8()?, + lock: _buf.read_u16::()?, + sid: GnssSignalDep::parse(_buf)?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( PackedObsContentDepC::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( PackedObsContentDepC::parse(buf)? ); + } + Ok(v) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgObsDepA { + pub header: ObservationHeaderDep, + // ^ Header of a GPS observation message + pub obs: Vec, + // ^ Pseudorange and carrier phase observation for a satellite being tracked. +} + +impl MsgObsDepA { + pub const TYPE: u16 = 69; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgObsDepA{ + header: ObservationHeaderDep::parse(_buf)?, + obs: PackedObsContentDepA::parse_array(_buf)?, + } ) + } +} + + +// Deprecated +// +// This observation message has been deprecated in favor of +// observations that are more interoperable. This message +// should be used for observations referenced to +// a nominal pseudorange which are not interoperable with +// most 3rd party GNSS receievers or typical RTCMv3 +// observations. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgObsDepB { + pub header: ObservationHeaderDep, + // ^ Header of a GPS observation message + pub obs: Vec, + // ^ Pseudorange and carrier phase observation for a satellite being tracked. +} + +impl MsgObsDepB { + pub const TYPE: u16 = 67; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgObsDepB{ + header: ObservationHeaderDep::parse(_buf)?, + obs: PackedObsContentDepB::parse_array(_buf)?, + } ) + } +} + + +// Deprecated +// +// The GPS observations message reports all the raw pseudorange and +// carrier phase observations for the satellites being tracked by +// the device. Carrier phase observation here is represented as a +// 40-bit fixed point number with Q32.8 layout (i.e. 32-bits of +// whole cycles and 8-bits of fractional cycles). The observations +// are interoperable with 3rd party receivers and conform +// with typical RTCMv3 GNSS observations. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgObsDepC { + pub header: ObservationHeaderDep, + // ^ Header of a GPS observation message + pub obs: Vec, + // ^ Pseudorange and carrier phase observation for a satellite being tracked. +} + +impl MsgObsDepC { + pub const TYPE: u16 = 73; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgObsDepC{ + header: ObservationHeaderDep::parse(_buf)?, + obs: PackedObsContentDepC::parse_array(_buf)?, + } ) + } +} + + +// Iono corrections +// +// The ionospheric parameters which allow the "L1 only" or "L2 only" user to +// utilize the ionospheric model for computation of the ionospheric delay. +// Please see ICD-GPS-200 (Chapter 20.3.3.5.1.7) for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgIono { + pub t_nmct: GPSTimeSec, + // ^ Navigation Message Correction Table Valitidy Time + pub a0: f64, + pub a1: f64, + pub a2: f64, + pub a3: f64, + pub b0: f64, + pub b1: f64, + pub b2: f64, + pub b3: f64, +} + +impl MsgIono { + pub const TYPE: u16 = 144; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgIono{ + t_nmct: GPSTimeSec::parse(_buf)?, + a0: _buf.read_f64::()?, + a1: _buf.read_f64::()?, + a2: _buf.read_f64::()?, + a3: _buf.read_f64::()?, + b0: _buf.read_f64::()?, + b1: _buf.read_f64::()?, + b2: _buf.read_f64::()?, + b3: _buf.read_f64::()?, + } ) + } +} + + +// L2C capability mask +// +// Please see ICD-GPS-200 (Chapter 20.3.3.5.1.4) for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSvConfigurationGPS { + pub t_nmct: GPSTimeSec, + // ^ Navigation Message Correction Table Valitidy Time + pub l2c_mask: u32, + // ^ L2C capability mask, SV32 bit being MSB, SV1 bit being LSB +} + +impl MsgSvConfigurationGPS { + pub const TYPE: u16 = 145; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSvConfigurationGPS{ + t_nmct: GPSTimeSec::parse(_buf)?, + l2c_mask: _buf.read_u32::()?, + } ) + } +} + + +// Group Delay +// +// Please see ICD-GPS-200 (30.3.3.3.1.1) for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgGroupDelayDepA { + pub t_op: GPSTimeDep, + // ^ Data Predict Time of Week + pub prn: u8, + // ^ Satellite number + pub valid: u8, + // ^ bit-field indicating validity of the values, LSB indicating tgd validity + // etc. 1 = value is valid, 0 = value is not valid. + pub tgd: i16, + pub isc_l1ca: i16, + pub isc_l2c: i16, +} + +impl MsgGroupDelayDepA { + pub const TYPE: u16 = 146; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgGroupDelayDepA{ + t_op: GPSTimeDep::parse(_buf)?, + prn: _buf.read_u8()?, + valid: _buf.read_u8()?, + tgd: _buf.read_i16::()?, + isc_l1ca: _buf.read_i16::()?, + isc_l2c: _buf.read_i16::()?, + } ) + } +} + + +// Group Delay +// +// Please see ICD-GPS-200 (30.3.3.3.1.1) for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgGroupDelayDepB { + pub t_op: GPSTimeSec, + // ^ Data Predict Time of Week + pub sid: GnssSignalDep, + // ^ GNSS signal identifier + pub valid: u8, + // ^ bit-field indicating validity of the values, LSB indicating tgd validity + // etc. 1 = value is valid, 0 = value is not valid. + pub tgd: i16, + pub isc_l1ca: i16, + pub isc_l2c: i16, +} + +impl MsgGroupDelayDepB { + pub const TYPE: u16 = 147; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgGroupDelayDepB{ + t_op: GPSTimeSec::parse(_buf)?, + sid: GnssSignalDep::parse(_buf)?, + valid: _buf.read_u8()?, + tgd: _buf.read_i16::()?, + isc_l1ca: _buf.read_i16::()?, + isc_l2c: _buf.read_i16::()?, + } ) + } +} + + +// Group Delay +// +// Please see ICD-GPS-200 (30.3.3.3.1.1) for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgGroupDelay { + pub t_op: GPSTimeSec, + // ^ Data Predict Time of Week + pub sid: GnssSignal, + // ^ GNSS signal identifier + pub valid: u8, + // ^ bit-field indicating validity of the values, LSB indicating tgd validity + // etc. 1 = value is valid, 0 = value is not valid. + pub tgd: i16, + pub isc_l1ca: i16, + pub isc_l2c: i16, +} + +impl MsgGroupDelay { + pub const TYPE: u16 = 148; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgGroupDelay{ + t_op: GPSTimeSec::parse(_buf)?, + sid: GnssSignal::parse(_buf)?, + valid: _buf.read_u8()?, + tgd: _buf.read_i16::()?, + isc_l1ca: _buf.read_i16::()?, + isc_l2c: _buf.read_i16::()?, + } ) + } +} + + +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct AlmanacCommonContent { + pub sid: GnssSignal, + // ^ GNSS signal identifier + pub toa: GPSTimeSec, + // ^ Reference time of almanac + pub ura: f64, + // ^ User Range Accuracy + pub fit_interval: u32, + // ^ Curve fit interval + pub valid: u8, + // ^ Status of almanac, 1 = valid, 0 = invalid + pub health_bits: u8, + // ^ Satellite health status for GPS: - bits 5-7: NAV data health status. + // See IS-GPS-200H Table 20-VII: NAV Data Health Indications. - bits + // 0-4: Signal health status. See IS-GPS-200H Table 20-VIII. Codes for + // Health of SV Signal Components. Satellite health status for GLO: + // See GLO ICD 5.1 table 5.1 for details - bit 0: C(n), "unhealthy" flag + // that is transmitted within non-immediate data and indicates overall + // constellation status at the moment of almanac uploading. '0' + // indicates malfunction of n-satellite. '1' indicates that n-satellite + // is operational. - bit 1: Bn(ln), '0' indicates the satellite is + // operational and suitable for navigation. +} + +impl AlmanacCommonContent { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( AlmanacCommonContent{ + sid: GnssSignal::parse(_buf)?, + toa: GPSTimeSec::parse(_buf)?, + ura: _buf.read_f64::()?, + fit_interval: _buf.read_u32::()?, + valid: _buf.read_u8()?, + health_bits: _buf.read_u8()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( AlmanacCommonContent::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( AlmanacCommonContent::parse(buf)? ); + } + Ok(v) + } +} + + +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct AlmanacCommonContentDep { + pub sid: GnssSignalDep, + // ^ GNSS signal identifier + pub toa: GPSTimeSec, + // ^ Reference time of almanac + pub ura: f64, + // ^ User Range Accuracy + pub fit_interval: u32, + // ^ Curve fit interval + pub valid: u8, + // ^ Status of almanac, 1 = valid, 0 = invalid + pub health_bits: u8, + // ^ Satellite health status for GPS: - bits 5-7: NAV data health status. + // See IS-GPS-200H Table 20-VII: NAV Data Health Indications. - bits + // 0-4: Signal health status. See IS-GPS-200H Table 20-VIII. Codes for + // Health of SV Signal Components. Satellite health status for GLO: + // See GLO ICD 5.1 table 5.1 for details - bit 0: C(n), "unhealthy" flag + // that is transmitted within non-immediate data and indicates overall + // constellation status at the moment of almanac uploading. '0' + // indicates malfunction of n-satellite. '1' indicates that n-satellite + // is operational. - bit 1: Bn(ln), '0' indicates the satellite is + // operational and suitable for navigation. +} + +impl AlmanacCommonContentDep { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( AlmanacCommonContentDep{ + sid: GnssSignalDep::parse(_buf)?, + toa: GPSTimeSec::parse(_buf)?, + ura: _buf.read_f64::()?, + fit_interval: _buf.read_u32::()?, + valid: _buf.read_u8()?, + health_bits: _buf.read_u8()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( AlmanacCommonContentDep::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( AlmanacCommonContentDep::parse(buf)? ); + } + Ok(v) + } +} + + +// Satellite broadcast ephemeris for GPS +// +// The almanac message returns a set of satellite orbit parameters. Almanac +// data is not very precise and is considered valid for up to several months. +// Please see the Navstar GPS Space Segment/Navigation user interfaces +// (ICD-GPS-200, Chapter 20.3.3.5.1.2 Almanac Data) for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgAlmanacGPSDep { + pub common: AlmanacCommonContentDep, + // ^ Values common for all almanac types + pub m0: f64, + // ^ Mean anomaly at reference time + pub ecc: f64, + // ^ Eccentricity of satellite orbit + pub sqrta: f64, + // ^ Square root of the semi-major axis of orbit + pub omega0: f64, + // ^ Longitude of ascending node of orbit plane at weekly epoch + pub omegadot: f64, + // ^ Rate of right ascension + pub w: f64, + // ^ Argument of perigee + pub inc: f64, + // ^ Inclination + pub af0: f64, + // ^ Polynomial clock correction coefficient (clock bias) + pub af1: f64, + // ^ Polynomial clock correction coefficient (clock drift) +} + +impl MsgAlmanacGPSDep { + pub const TYPE: u16 = 112; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgAlmanacGPSDep{ + common: AlmanacCommonContentDep::parse(_buf)?, + m0: _buf.read_f64::()?, + ecc: _buf.read_f64::()?, + sqrta: _buf.read_f64::()?, + omega0: _buf.read_f64::()?, + omegadot: _buf.read_f64::()?, + w: _buf.read_f64::()?, + inc: _buf.read_f64::()?, + af0: _buf.read_f64::()?, + af1: _buf.read_f64::()?, + } ) + } +} + + +// Satellite broadcast ephemeris for GPS +// +// The almanac message returns a set of satellite orbit parameters. Almanac +// data is not very precise and is considered valid for up to several months. +// Please see the Navstar GPS Space Segment/Navigation user interfaces +// (ICD-GPS-200, Chapter 20.3.3.5.1.2 Almanac Data) for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgAlmanacGPS { + pub common: AlmanacCommonContent, + // ^ Values common for all almanac types + pub m0: f64, + // ^ Mean anomaly at reference time + pub ecc: f64, + // ^ Eccentricity of satellite orbit + pub sqrta: f64, + // ^ Square root of the semi-major axis of orbit + pub omega0: f64, + // ^ Longitude of ascending node of orbit plane at weekly epoch + pub omegadot: f64, + // ^ Rate of right ascension + pub w: f64, + // ^ Argument of perigee + pub inc: f64, + // ^ Inclination + pub af0: f64, + // ^ Polynomial clock correction coefficient (clock bias) + pub af1: f64, + // ^ Polynomial clock correction coefficient (clock drift) +} + +impl MsgAlmanacGPS { + pub const TYPE: u16 = 114; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgAlmanacGPS{ + common: AlmanacCommonContent::parse(_buf)?, + m0: _buf.read_f64::()?, + ecc: _buf.read_f64::()?, + sqrta: _buf.read_f64::()?, + omega0: _buf.read_f64::()?, + omegadot: _buf.read_f64::()?, + w: _buf.read_f64::()?, + inc: _buf.read_f64::()?, + af0: _buf.read_f64::()?, + af1: _buf.read_f64::()?, + } ) + } +} + + +// Satellite broadcast ephemeris for GLO +// +// The almanac message returns a set of satellite orbit parameters. Almanac +// data is not very precise and is considered valid for up to several months. +// Please see the GLO ICD 5.1 "Chapter 4.5 Non-immediate information and +// almanac" for details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgAlmanacGloDep { + pub common: AlmanacCommonContentDep, + // ^ Values common for all almanac types + pub lambda_na: f64, + // ^ Longitude of the first ascending node of the orbit in PZ-90.02 + // coordinate system + pub t_lambda_na: f64, + // ^ Time of the first ascending node passage + pub i: f64, + // ^ Value of inclination at instant of t_lambda + pub t: f64, + // ^ Value of Draconian period at instant of t_lambda + pub t_dot: f64, + // ^ Rate of change of the Draconian period + pub epsilon: f64, + // ^ Eccentricity at instant of t_lambda + pub omega: f64, + // ^ Argument of perigee at instant of t_lambda +} + +impl MsgAlmanacGloDep { + pub const TYPE: u16 = 113; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgAlmanacGloDep{ + common: AlmanacCommonContentDep::parse(_buf)?, + lambda_na: _buf.read_f64::()?, + t_lambda_na: _buf.read_f64::()?, + i: _buf.read_f64::()?, + t: _buf.read_f64::()?, + t_dot: _buf.read_f64::()?, + epsilon: _buf.read_f64::()?, + omega: _buf.read_f64::()?, + } ) + } +} + + +// Satellite broadcast ephemeris for GLO +// +// The almanac message returns a set of satellite orbit parameters. Almanac +// data is not very precise and is considered valid for up to several months. +// Please see the GLO ICD 5.1 "Chapter 4.5 Non-immediate information and +// almanac" for details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgAlmanacGlo { + pub common: AlmanacCommonContent, + // ^ Values common for all almanac types + pub lambda_na: f64, + // ^ Longitude of the first ascending node of the orbit in PZ-90.02 + // coordinate system + pub t_lambda_na: f64, + // ^ Time of the first ascending node passage + pub i: f64, + // ^ Value of inclination at instant of t_lambda + pub t: f64, + // ^ Value of Draconian period at instant of t_lambda + pub t_dot: f64, + // ^ Rate of change of the Draconian period + pub epsilon: f64, + // ^ Eccentricity at instant of t_lambda + pub omega: f64, + // ^ Argument of perigee at instant of t_lambda +} + +impl MsgAlmanacGlo { + pub const TYPE: u16 = 115; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgAlmanacGlo{ + common: AlmanacCommonContent::parse(_buf)?, + lambda_na: _buf.read_f64::()?, + t_lambda_na: _buf.read_f64::()?, + i: _buf.read_f64::()?, + t: _buf.read_f64::()?, + t_dot: _buf.read_f64::()?, + epsilon: _buf.read_f64::()?, + omega: _buf.read_f64::()?, + } ) + } +} + + +// GLONASS L1/L2 Code-Phase biases +// +// The GLONASS L1/L2 Code-Phase biases allows to perform +// GPS+GLONASS integer ambiguity resolution for baselines +// with mixed receiver types (e.g. receiver of different +// manufacturers) +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgGloBiases { + pub mask: u8, + // ^ GLONASS FDMA signals mask + pub l1ca_bias: i16, + // ^ GLONASS L1 C/A Code-Phase Bias + pub l1p_bias: i16, + // ^ GLONASS L1 P Code-Phase Bias + pub l2ca_bias: i16, + // ^ GLONASS L2 C/A Code-Phase Bias + pub l2p_bias: i16, + // ^ GLONASS L2 P Code-Phase Bias +} + +impl MsgGloBiases { + pub const TYPE: u16 = 117; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgGloBiases{ + mask: _buf.read_u8()?, + l1ca_bias: _buf.read_i16::()?, + l1p_bias: _buf.read_i16::()?, + l2ca_bias: _buf.read_i16::()?, + l2p_bias: _buf.read_i16::()?, + } ) + } +} + diff --git a/rust/sbp/src/messages/orientation.rs b/rust/sbp/src/messages/orientation.rs new file mode 100644 index 0000000000..9c3ac0372e --- /dev/null +++ b/rust/sbp/src/messages/orientation.rs @@ -0,0 +1,187 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/orientation.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Orientation Messages +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; + + +// Heading relative to True North +// +// This message reports the baseline heading pointing from the base station +// to the rover relative to True North. The full GPS time is given by the +// preceding MSG_GPS_TIME with the matching time-of-week (tow). It is intended +// that time-matched RTK mode is used when the base station is moving. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgBaselineHeading { + pub tow: u32, + // ^ GPS Time of Week + pub heading: u32, + // ^ Heading + pub n_sats: u8, + // ^ Number of satellites used in solution + pub flags: u8, + // ^ Status flags +} + +impl MsgBaselineHeading { + pub const TYPE: u16 = 527; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgBaselineHeading{ + tow: _buf.read_u32::()?, + heading: _buf.read_u32::()?, + n_sats: _buf.read_u8()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Quaternion 4 component vector +// +// This message reports the quaternion vector describing the vehicle body frame's orientation +// with respect to a local-level NED frame. The components of the vector should sum to a unit +// vector assuming that the LSB of each component as a value of 2^-31. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgOrientQuat { + pub tow: u32, + // ^ GPS Time of Week + pub w: i32, + // ^ Real component + pub x: i32, + // ^ 1st imaginary component + pub y: i32, + // ^ 2nd imaginary component + pub z: i32, + // ^ 3rd imaginary component + pub acc_w: f32, + // ^ Estimated standard deviation of w + pub acc_x: f32, + // ^ Estimated standard deviation of x + pub acc_y: f32, + // ^ Estimated standard deviation of y + pub acc_z: f32, + // ^ Estimated standard deviation of z + pub flags: u8, + // ^ Status flags +} + +impl MsgOrientQuat { + pub const TYPE: u16 = 544; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgOrientQuat{ + tow: _buf.read_u32::()?, + w: _buf.read_i32::()?, + x: _buf.read_i32::()?, + y: _buf.read_i32::()?, + z: _buf.read_i32::()?, + acc_w: _buf.read_f32::()?, + acc_x: _buf.read_f32::()?, + acc_y: _buf.read_f32::()?, + acc_z: _buf.read_f32::()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Euler angles +// +// This message reports the yaw, pitch, and roll angles of the vehicle body frame. +// The rotations should applied intrinsically in the order yaw, pitch, and roll +// in order to rotate the from a frame aligned with the local-level NED frame +// to the vehicle body frame. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgOrientEuler { + pub tow: u32, + // ^ GPS Time of Week + pub roll: i32, + // ^ rotation about the forward axis of the vehicle + pub pitch: i32, + // ^ rotation about the rightward axis of the vehicle + pub yaw: i32, + // ^ rotation about the downward axis of the vehicle + pub var_roll: f32, + // ^ Estimated standard deviation of roll + pub var_pitch: f32, + // ^ Estimated standard deviation of pitch + pub var_yaw: f32, + // ^ Estimated standard deviation of yaw + pub flags: u8, + // ^ Status flags +} + +impl MsgOrientEuler { + pub const TYPE: u16 = 545; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgOrientEuler{ + tow: _buf.read_u32::()?, + roll: _buf.read_i32::()?, + pitch: _buf.read_i32::()?, + yaw: _buf.read_i32::()?, + var_roll: _buf.read_f32::()?, + var_pitch: _buf.read_f32::()?, + var_yaw: _buf.read_f32::()?, + flags: _buf.read_u8()?, + } ) + } +} + + +// Vehicle Body Frame instantaneous angular rates +// +// This message reports the orientation rates in the vehicle body frame. +// The values represent the measurements a strapped down gyroscope would +// make and are not equivalent to the time derivative of the Euler angles. +// The orientation and origin of the user frame is specified via device settings. +// By convention, the vehicle x-axis is expected to be aligned with the forward +// direction, while the vehicle y-axis is expected to be aligned with the right +// direction, and the vehicle z-axis should be aligned with the down direction. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgAngularRate { + pub tow: u32, + // ^ GPS Time of Week + pub x: i32, + // ^ angular rate about x axis + pub y: i32, + // ^ angular rate about y axis + pub z: i32, + // ^ angular rate about z axis + pub flags: u8, + // ^ Status flags +} + +impl MsgAngularRate { + pub const TYPE: u16 = 546; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgAngularRate{ + tow: _buf.read_u32::()?, + x: _buf.read_i32::()?, + y: _buf.read_i32::()?, + z: _buf.read_i32::()?, + flags: _buf.read_u8()?, + } ) + } +} + diff --git a/rust/sbp/src/messages/piksi.rs b/rust/sbp/src/messages/piksi.rs new file mode 100644 index 0000000000..006ceace44 --- /dev/null +++ b/rust/sbp/src/messages/piksi.rs @@ -0,0 +1,836 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/piksi.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// System health, configuration, and diagnostic messages specific to +// the Piksi L1 receiver, including a variety of legacy messages that +// may no longer be used. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; +use super::gnss::*; + + +// Legacy message to load satellite almanac (host => Piksi) +// +// This is a legacy message for sending and loading a satellite +// alamanac onto the Piksi's flash memory from the host. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgAlmanac { +} + +impl MsgAlmanac { + pub const TYPE: u16 = 105; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgAlmanac{ + } ) + } +} + + +// Send GPS time from host (host => Piksi) +// +// This message sets up timing functionality using a coarse GPS +// time estimate sent by the host. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSetTime { +} + +impl MsgSetTime { + pub const TYPE: u16 = 104; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSetTime{ + } ) + } +} + + +// Reset the device (host => Piksi) +// +// This message from the host resets the Piksi back into the +// bootloader. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgReset { + pub flags: u32, + // ^ Reset flags +} + +impl MsgReset { + pub const TYPE: u16 = 182; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgReset{ + flags: _buf.read_u32::()?, + } ) + } +} + + +// Reset the device (host => Piksi) +// +// This message from the host resets the Piksi back into the +// bootloader. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgResetDep { +} + +impl MsgResetDep { + pub const TYPE: u16 = 178; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgResetDep{ + } ) + } +} + + +// Legacy message for CW interference channel (Piksi => host) +// +// This is an unused legacy message for result reporting from the +// CW interference channel on the SwiftNAP. This message will be +// removed in a future release. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgCwResults { +} + +impl MsgCwResults { + pub const TYPE: u16 = 192; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgCwResults{ + } ) + } +} + + +// Legacy message for CW interference channel (host => Piksi) +// +// This is an unused legacy message from the host for starting +// the CW interference channel on the SwiftNAP. This message will +// be removed in a future release. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgCwStart { +} + +impl MsgCwStart { + pub const TYPE: u16 = 193; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgCwStart{ + } ) + } +} + + +// Reset IAR filters (host => Piksi) +// +// This message resets either the DGNSS Kalman filters or Integer +// Ambiguity Resolution (IAR) process. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgResetFilters { + pub filter: u8, + // ^ Filter flags +} + +impl MsgResetFilters { + pub const TYPE: u16 = 34; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgResetFilters{ + filter: _buf.read_u8()?, + } ) + } +} + + +// Initialize IAR from known baseline (host => device) +// +// This message initializes the integer ambiguity resolution (IAR) +// process on the Piksi to use an assumed baseline position between +// the base station and rover receivers. Warns via MSG_PRINT if +// there aren't a shared minimum number (4) of satellite +// observations between the two. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgInitBase { +} + +impl MsgInitBase { + pub const TYPE: u16 = 35; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgInitBase{ + } ) + } +} + + +// State of an RTOS thread +// +// The thread usage message from the device reports real-time +// operating system (RTOS) thread usage statistics for the named +// thread. The reported percentage values must be normalized. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgThreadState { + pub name: String, + // ^ Thread name (NULL terminated) + pub cpu: u16, + // ^ Percentage cpu use for this thread. Values range from 0 - 1000 and needs + // to be renormalized to 100 + pub stack_free: u32, + // ^ Free stack space for this thread +} + +impl MsgThreadState { + pub const TYPE: u16 = 23; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgThreadState{ + name: ::read_string_limit(_buf, 20)?, + cpu: _buf.read_u16::()?, + stack_free: _buf.read_u32::()?, + } ) + } +} + + +// State of the UART channel +// +// Throughput, utilization, and error counts on the RX/TX buffers +// of this UART channel. The reported percentage values must +// be normalized. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct UARTChannel { + pub tx_throughput: f32, + // ^ UART transmit throughput + pub rx_throughput: f32, + // ^ UART receive throughput + pub crc_error_count: u16, + // ^ UART CRC error count + pub io_error_count: u16, + // ^ UART IO error count + pub tx_buffer_level: u8, + // ^ UART transmit buffer percentage utilization (ranges from 0 to 255) + pub rx_buffer_level: u8, + // ^ UART receive buffer percentage utilization (ranges from 0 to 255) +} + +impl UARTChannel { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( UARTChannel{ + tx_throughput: _buf.read_f32::()?, + rx_throughput: _buf.read_f32::()?, + crc_error_count: _buf.read_u16::()?, + io_error_count: _buf.read_u16::()?, + tx_buffer_level: _buf.read_u8()?, + rx_buffer_level: _buf.read_u8()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( UARTChannel::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( UARTChannel::parse(buf)? ); + } + Ok(v) + } +} + + +// base station observation message receipt period +// +// Statistics on the period of observations received from the base +// station. As complete observation sets are received, their time +// of reception is compared with the prior set''s time of reception. +// This measurement provides a proxy for link quality as incomplete +// or missing sets will increase the period. Long periods +// can cause momentary RTK solution outages. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct Period { + pub avg: i32, + // ^ Average period + pub pmin: i32, + // ^ Minimum period + pub pmax: i32, + // ^ Maximum period + pub current: i32, + // ^ Smoothed estimate of the current period +} + +impl Period { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( Period{ + avg: _buf.read_i32::()?, + pmin: _buf.read_i32::()?, + pmax: _buf.read_i32::()?, + current: _buf.read_i32::()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( Period::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( Period::parse(buf)? ); + } + Ok(v) + } +} + + +// Receiver-to-base station latency +// +// Statistics on the latency of observations received from the base +// station. As observation packets are received their GPS time is +// compared to the current GPS time calculated locally by the +// receiver to give a precise measurement of the end-to-end +// communication latency in the system. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct Latency { + pub avg: i32, + // ^ Average latency + pub lmin: i32, + // ^ Minimum latency + pub lmax: i32, + // ^ Maximum latency + pub current: i32, + // ^ Smoothed estimate of the current latency +} + +impl Latency { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( Latency{ + avg: _buf.read_i32::()?, + lmin: _buf.read_i32::()?, + lmax: _buf.read_i32::()?, + current: _buf.read_i32::()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( Latency::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( Latency::parse(buf)? ); + } + Ok(v) + } +} + + +// State of the UART channels +// +// The UART message reports data latency and throughput of the UART +// channels providing SBP I/O. On the default Piksi configuration, +// UARTs A and B are used for telemetry radios, but can also be +// host access ports for embedded hosts, or other interfaces in +// future. The reported percentage values must be normalized. +// Observations latency and period can be used to assess the +// health of the differential corrections link. Latency provides +// the timeliness of received base observations while the +// period indicates their likelihood of transmission. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgUartState { + pub uart_a: UARTChannel, + // ^ State of UART A + pub uart_b: UARTChannel, + // ^ State of UART B + pub uart_ftdi: UARTChannel, + // ^ State of UART FTDI (USB logger) + pub latency: Latency, + // ^ UART communication latency + pub obs_period: Period, + // ^ Observation receipt period +} + +impl MsgUartState { + pub const TYPE: u16 = 29; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgUartState{ + uart_a: UARTChannel::parse(_buf)?, + uart_b: UARTChannel::parse(_buf)?, + uart_ftdi: UARTChannel::parse(_buf)?, + latency: Latency::parse(_buf)?, + obs_period: Period::parse(_buf)?, + } ) + } +} + + +// Deprecated +// +// Deprecated +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgUartStateDepa { + pub uart_a: UARTChannel, + // ^ State of UART A + pub uart_b: UARTChannel, + // ^ State of UART B + pub uart_ftdi: UARTChannel, + // ^ State of UART FTDI (USB logger) + pub latency: Latency, + // ^ UART communication latency +} + +impl MsgUartStateDepa { + pub const TYPE: u16 = 24; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgUartStateDepa{ + uart_a: UARTChannel::parse(_buf)?, + uart_b: UARTChannel::parse(_buf)?, + uart_ftdi: UARTChannel::parse(_buf)?, + latency: Latency::parse(_buf)?, + } ) + } +} + + +// State of the Integer Ambiguity Resolution (IAR) process +// +// This message reports the state of the Integer Ambiguity +// Resolution (IAR) process, which resolves unknown integer +// ambiguities from double-differenced carrier-phase measurements +// from satellite observations. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgIarState { + pub num_hyps: u32, + // ^ Number of integer ambiguity hypotheses remaining +} + +impl MsgIarState { + pub const TYPE: u16 = 25; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgIarState{ + num_hyps: _buf.read_u32::()?, + } ) + } +} + + +// Mask a satellite from use in Piksi subsystems +// +// This message allows setting a mask to prevent a particular satellite +// from being used in various Piksi subsystems. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgMaskSatellite { + pub mask: u8, + // ^ Mask of systems that should ignore this satellite. + pub sid: GnssSignal, + // ^ GNSS signal for which the mask is applied +} + +impl MsgMaskSatellite { + pub const TYPE: u16 = 43; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgMaskSatellite{ + mask: _buf.read_u8()?, + sid: GnssSignal::parse(_buf)?, + } ) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgMaskSatelliteDep { + pub mask: u8, + // ^ Mask of systems that should ignore this satellite. + pub sid: GnssSignalDep, + // ^ GNSS signal for which the mask is applied +} + +impl MsgMaskSatelliteDep { + pub const TYPE: u16 = 27; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgMaskSatelliteDep{ + mask: _buf.read_u8()?, + sid: GnssSignalDep::parse(_buf)?, + } ) + } +} + + +// Device temperature and voltage levels +// +// This message contains temperature and voltage level measurements from the +// processor's monitoring system and the RF frontend die temperature if +// available. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgDeviceMonitor { + pub dev_vin: i16, + // ^ Device V_in + pub cpu_vint: i16, + // ^ Processor V_int + pub cpu_vaux: i16, + // ^ Processor V_aux + pub cpu_temperature: i16, + // ^ Processor temperature + pub fe_temperature: i16, + // ^ Frontend temperature (if available) +} + +impl MsgDeviceMonitor { + pub const TYPE: u16 = 181; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgDeviceMonitor{ + dev_vin: _buf.read_i16::()?, + cpu_vint: _buf.read_i16::()?, + cpu_vaux: _buf.read_i16::()?, + cpu_temperature: _buf.read_i16::()?, + fe_temperature: _buf.read_i16::()?, + } ) + } +} + + +// Execute a command (host => device) +// +// Request the recipient to execute an command. +// Output will be sent in MSG_LOG messages, and the exit +// code will be returned with MSG_COMMAND_RESP. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgCommandReq { + pub sequence: u32, + // ^ Sequence number + pub command: String, + // ^ Command line to execute +} + +impl MsgCommandReq { + pub const TYPE: u16 = 184; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgCommandReq{ + sequence: _buf.read_u32::()?, + command: ::read_string(_buf)?, + } ) + } +} + + +// Exit code from executed command (device => host) +// +// The response to MSG_COMMAND_REQ with the return code of +// the command. A return code of zero indicates success. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgCommandResp { + pub sequence: u32, + // ^ Sequence number + pub code: i32, + // ^ Exit code +} + +impl MsgCommandResp { + pub const TYPE: u16 = 185; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgCommandResp{ + sequence: _buf.read_u32::()?, + code: _buf.read_i32::()?, + } ) + } +} + + +// Command output +// +// Returns the standard output and standard error of the +// command requested by MSG_COMMAND_REQ. +// The sequence number can be used to filter for filtering +// the correct command. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgCommandOutput { + pub sequence: u32, + // ^ Sequence number + pub line: String, + // ^ Line of standard output or standard error +} + +impl MsgCommandOutput { + pub const TYPE: u16 = 188; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgCommandOutput{ + sequence: _buf.read_u32::()?, + line: ::read_string(_buf)?, + } ) + } +} + + +// Request state of Piksi network interfaces +// +// Request state of Piksi network interfaces. +// Output will be sent in MSG_NETWORK_STATE_RESP messages +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgNetworkStateReq { +} + +impl MsgNetworkStateReq { + pub const TYPE: u16 = 186; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgNetworkStateReq{ + } ) + } +} + + +// State of network interface +// +// The state of a network interface on the Piksi. +// Data is made to reflect output of ifaddrs struct returned by getifaddrs +// in c. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgNetworkStateResp { + pub ipv4_address: Vec, + // ^ IPv4 address (all zero when unavailable) + pub ipv4_mask_size: u8, + // ^ IPv4 netmask CIDR notation + pub ipv6_address: Vec, + // ^ IPv6 address (all zero when unavailable) + pub ipv6_mask_size: u8, + // ^ IPv6 netmask CIDR notation + pub rx_bytes: u32, + // ^ Number of Rx bytes + pub tx_bytes: u32, + // ^ Number of Tx bytes + pub interface_name: String, + // ^ Interface Name + pub flags: u32, + // ^ Interface flags from SIOCGIFFLAGS +} + +impl MsgNetworkStateResp { + pub const TYPE: u16 = 187; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgNetworkStateResp{ + ipv4_address: ::read_u8_array_limit(_buf, 4)?, + ipv4_mask_size: _buf.read_u8()?, + ipv6_address: ::read_u8_array_limit(_buf, 16)?, + ipv6_mask_size: _buf.read_u8()?, + rx_bytes: _buf.read_u32::()?, + tx_bytes: _buf.read_u32::()?, + interface_name: ::read_string_limit(_buf, 16)?, + flags: _buf.read_u32::()?, + } ) + } +} + + +// Bandwidth usage measurement for a single interface. +// +// The bandwidth usage for each interface can be reported +// within this struct and utilize multiple fields to fully +// specify the type of traffic that is being tracked. As +// either the interval of collection or the collection time +// may vary, both a timestamp and period field is provided, +// though may not necessarily be populated with a value. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct NetworkUsage { + pub duration: u64, + // ^ Duration over which the measurement was collected + pub total_bytes: u64, + // ^ Number of bytes handled in total within period + pub rx_bytes: u32, + // ^ Number of bytes transmitted within period + pub tx_bytes: u32, + // ^ Number of bytes received within period + pub interface_name: String, + // ^ Interface Name +} + +impl NetworkUsage { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( NetworkUsage{ + duration: _buf.read_u64::()?, + total_bytes: _buf.read_u64::()?, + rx_bytes: _buf.read_u32::()?, + tx_bytes: _buf.read_u32::()?, + interface_name: ::read_string_limit(_buf, 16)?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( NetworkUsage::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( NetworkUsage::parse(buf)? ); + } + Ok(v) + } +} + + +// Bandwidth usage reporting message +// +// The bandwidth usage, a list of usage by interface. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgNetworkBandwidthUsage { + pub interfaces: Vec, + // ^ Usage measurement array +} + +impl MsgNetworkBandwidthUsage { + pub const TYPE: u16 = 189; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgNetworkBandwidthUsage{ + interfaces: NetworkUsage::parse_array(_buf)?, + } ) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSpecanDep { + pub channel_tag: u16, + // ^ Channel ID + pub t: GPSTimeDep, + // ^ Receiver time of this observation + pub freq_ref: f32, + // ^ Reference frequency of this packet + pub freq_step: f32, + // ^ Frequency step of points in this packet + pub amplitude_ref: f32, + // ^ Reference amplitude of this packet + pub amplitude_unit: f32, + // ^ Amplitude unit value of points in this packet + pub amplitude_value: Vec, + // ^ Amplitude values (in the above units) of points in this packet +} + +impl MsgSpecanDep { + pub const TYPE: u16 = 80; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSpecanDep{ + channel_tag: _buf.read_u16::()?, + t: GPSTimeDep::parse(_buf)?, + freq_ref: _buf.read_f32::()?, + freq_step: _buf.read_f32::()?, + amplitude_ref: _buf.read_f32::()?, + amplitude_unit: _buf.read_f32::()?, + amplitude_value: ::read_u8_array(_buf)?, + } ) + } +} + + +// Spectrum analyzer +// +// Spectrum analyzer packet. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSpecan { + pub channel_tag: u16, + // ^ Channel ID + pub t: GPSTime, + // ^ Receiver time of this observation + pub freq_ref: f32, + // ^ Reference frequency of this packet + pub freq_step: f32, + // ^ Frequency step of points in this packet + pub amplitude_ref: f32, + // ^ Reference amplitude of this packet + pub amplitude_unit: f32, + // ^ Amplitude unit value of points in this packet + pub amplitude_value: Vec, + // ^ Amplitude values (in the above units) of points in this packet +} + +impl MsgSpecan { + pub const TYPE: u16 = 81; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSpecan{ + channel_tag: _buf.read_u16::()?, + t: GPSTime::parse(_buf)?, + freq_ref: _buf.read_f32::()?, + freq_step: _buf.read_f32::()?, + amplitude_ref: _buf.read_f32::()?, + amplitude_unit: _buf.read_f32::()?, + amplitude_value: ::read_u8_array(_buf)?, + } ) + } +} + diff --git a/rust/sbp/src/messages/sbas.rs b/rust/sbp/src/messages/sbas.rs new file mode 100644 index 0000000000..37bfdc9d11 --- /dev/null +++ b/rust/sbp/src/messages/sbas.rs @@ -0,0 +1,52 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/sbas.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// SBAS data +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; +use super::gnss::*; + + +// Raw SBAS data +// +// This message is sent once per second per SBAS satellite. ME checks the +// parity of the data block and sends only blocks that pass the check. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSbasRaw { + pub sid: GnssSignal, + // ^ GNSS signal identifier. + pub tow: u32, + // ^ GPS time-of-week at the start of the data block. + pub message_type: u8, + // ^ SBAS message type (0-63) + pub data: Vec, + // ^ Raw SBAS data field of 212 bits (last byte padded with zeros). +} + +impl MsgSbasRaw { + pub const TYPE: u16 = 30583; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSbasRaw{ + sid: GnssSignal::parse(_buf)?, + tow: _buf.read_u32::()?, + message_type: _buf.read_u8()?, + data: ::read_u8_array_limit(_buf, 27)?, + } ) + } +} + diff --git a/rust/sbp/src/messages/settings.rs b/rust/sbp/src/messages/settings.rs new file mode 100644 index 0000000000..7211b03641 --- /dev/null +++ b/rust/sbp/src/messages/settings.rs @@ -0,0 +1,281 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/settings.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// +// Messages for reading, writing, and discovering device settings. Settings +// with a "string" field have multiple values in this field delimited with a +// null character (the c style null terminator). For instance, when querying +// the 'firmware_version' setting in the 'system_info' section, the following +// array of characters needs to be sent for the string field in +// MSG_SETTINGS_READ: "system_info\0firmware_version\0", where the delimiting +// null characters are specified with the escape sequence '\0' and all +// quotation marks should be omitted. +// +// +// In the message descriptions below, the generic strings SECTION_SETTING and +// SETTING are used to refer to the two strings that comprise the identifier +// of an individual setting.In firmware_version example above, SECTION_SETTING +// is the 'system_info', and the SETTING portion is 'firmware_version'. +// +// See the "Software Settings Manual" on support.swiftnav.com for detailed +// documentation about all settings and sections available for each Swift +// firmware version. Settings manuals are available for each firmware version +// at the following link: [Piksi Multi Specifications](https://support.swiftnav.com/customer/en/portal/articles/2628580-piksi-multi-specifications#settings). +// The latest settings document is also available at the following link: +// [Latest settings document](http://swiftnav.com/latest/piksi-multi-settings) . +// See lastly [settings.py](https://github.com/swift-nav/piksi_tools/blob/master/piksi_tools/settings.py) , +// the open source python command line utility for reading, writing, and +// saving settings in the piksi_tools repository on github as a helpful +// reference and example. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; + + +// Save settings to flash (host => device) +// +// The save settings message persists the device's current settings +// configuration to its onboard flash memory file system. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSettingsSave { +} + +impl MsgSettingsSave { + pub const TYPE: u16 = 161; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSettingsSave{ + } ) + } +} + + +// Write device configuration settings (host => device) +// +// The setting message writes the device configuration for a particular +// setting via A NULL-terminated and NULL-delimited string with contents +// "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes +// the NULL character and where quotation marks are omitted. A device will +// only process to this message when it is received from sender ID 0x42. +// An example string that could be sent to a device is +// "solution\0soln_freq\010\0". +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSettingsWrite { + pub setting: String, + // ^ A NULL-terminated and NULL-delimited string with contents + // "SECTION_SETTING\0SETTING\0VALUE\0" +} + +impl MsgSettingsWrite { + pub const TYPE: u16 = 160; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSettingsWrite{ + setting: ::read_string(_buf)?, + } ) + } +} + + +// Acknowledgement with status of MSG_SETTINGS_WRITE +// +// Return the status of a write request with the new value of the +// setting. If the requested value is rejected, the current value +// will be returned. The string field is a NULL-terminated and NULL-delimited +// string with contents "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' +// escape sequence denotes the NULL character and where quotation marks +// are omitted. An example string that could be sent from device is +// "solution\0soln_freq\010\0". +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSettingsWriteResp { + pub status: u8, + // ^ Write status + pub setting: String, + // ^ A NULL-terminated and delimited string with contents + // "SECTION_SETTING\0SETTING\0VALUE\0" +} + +impl MsgSettingsWriteResp { + pub const TYPE: u16 = 175; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSettingsWriteResp{ + status: _buf.read_u8()?, + setting: ::read_string(_buf)?, + } ) + } +} + + +// Read device configuration settings (host => device) +// +// The setting message that reads the device configuration. The string +// field is a NULL-terminated and NULL-delimited string with contents +// "SECTION_SETTING\0SETTING\0" where the '\0' escape sequence denotes the +// NULL character and where quotation marks are omitted. An example +// string that could be sent to a device is "solution\0soln_freq\0". A +// device will only respond to this message when it is received from +// sender ID 0x42. A device should respond with a MSG_SETTINGS_READ_RESP +// message (msg_id 0x00A5). +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSettingsReadReq { + pub setting: String, + // ^ A NULL-terminated and NULL-delimited string with contents + // "SECTION_SETTING\0SETTING\0" +} + +impl MsgSettingsReadReq { + pub const TYPE: u16 = 164; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSettingsReadReq{ + setting: ::read_string(_buf)?, + } ) + } +} + + +// Read device configuration settings (host <= device) +// +// The setting message wich which the device responds after a +// MSG_SETTING_READ_REQ is sent to device. The string field is a +// NULL-terminated and NULL-delimited string with contents +// "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence +// denotes the NULL character and where quotation marks are omitted. An +// example string that could be sent from device is +// "solution\0soln_freq\010\0". +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSettingsReadResp { + pub setting: String, + // ^ A NULL-terminated and NULL-delimited string with contents + // "SECTION_SETTING\0SETTING\0VALUE\0" +} + +impl MsgSettingsReadResp { + pub const TYPE: u16 = 165; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSettingsReadResp{ + setting: ::read_string(_buf)?, + } ) + } +} + + +// Read setting by direct index (host => device) +// +// The settings message for iterating through the settings +// values. A device will respond to this message with a +// "MSG_SETTINGS_READ_BY_INDEX_RESP". +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSettingsReadByIndexReq { + pub index: u16, + // ^ An index into the device settings, with values ranging from 0 to + // length(settings) +} + +impl MsgSettingsReadByIndexReq { + pub const TYPE: u16 = 162; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSettingsReadByIndexReq{ + index: _buf.read_u16::()?, + } ) + } +} + + +// Read setting by direct index (host <= device) +// +// The settings message that reports the value of a setting at an index. +// +// In the string field, it reports NULL-terminated and delimited string +// with contents "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0". where +// the '\0' escape sequence denotes the NULL character and where quotation +// marks are omitted. The FORMAT_TYPE field is optional and denotes +// possible string values of the setting as a hint to the user. If +// included, the format type portion of the string has the format +// "enum:value1,value2,value3". An example string that could be sent from +// the device is "simulator\0enabled\0True\0enum:True,False\0" +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSettingsReadByIndexResp { + pub index: u16, + // ^ An index into the device settings, with values ranging from 0 to + // length(settings) + pub setting: String, + // ^ A NULL-terminated and delimited string with contents + // "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0" +} + +impl MsgSettingsReadByIndexResp { + pub const TYPE: u16 = 167; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSettingsReadByIndexResp{ + index: _buf.read_u16::()?, + setting: ::read_string(_buf)?, + } ) + } +} + + +// Finished reading settings (host <= device) +// +// The settings message for indicating end of the settings values. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSettingsReadByIndexDone { +} + +impl MsgSettingsReadByIndexDone { + pub const TYPE: u16 = 166; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSettingsReadByIndexDone{ + } ) + } +} + + +// Register setting and default value (device => host) +// +// This message registers the presence and default value of a setting +// with a settings daemon. The host should reply with MSG_SETTINGS_WRITE +// for this setting to set the initial value. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSettingsRegister { + pub setting: String, + // ^ A NULL-terminated and delimited string with contents + // "SECTION_SETTING\0SETTING\0VALUE". +} + +impl MsgSettingsRegister { + pub const TYPE: u16 = 174; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSettingsRegister{ + setting: ::read_string(_buf)?, + } ) + } +} + diff --git a/rust/sbp/src/messages/ssr.rs b/rust/sbp/src/messages/ssr.rs new file mode 100644 index 0000000000..24d7508f16 --- /dev/null +++ b/rust/sbp/src/messages/ssr.rs @@ -0,0 +1,261 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/ssr.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Precise State Space Representation (SSR) corrections format +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; +use super::gnss::*; + + +// SSR code biases corrections for a particular satellite. +// +// Code biases are to be added to pseudorange. +// The corrections are conform with typical RTCMv3 MT1059 and 1065. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct CodeBiasesContent { + pub code: u8, + // ^ Signal constellation, band and code + pub value: i16, + // ^ Code bias value +} + +impl CodeBiasesContent { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( CodeBiasesContent{ + code: _buf.read_u8()?, + value: _buf.read_i16::()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( CodeBiasesContent::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( CodeBiasesContent::parse(buf)? ); + } + Ok(v) + } +} + + +// SSR phase biases corrections for a particular satellite. +// +// Phase biases are to be added to carrier phase measurements. +// The corrections are conform with typical RTCMv3 MT1059 and 1065. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct PhaseBiasesContent { + pub code: u8, + // ^ Signal constellation, band and code + pub integer_indicator: u8, + // ^ Indicator for integer property + pub widelane_integer_indicator: u8, + // ^ Indicator for two groups of Wide-Lane(s) integer property + pub discontinuity_counter: u8, + // ^ Signal phase discontinuity counter. Increased for every discontinuity + // in phase. + pub bias: i32, + // ^ Phase bias for specified signal +} + +impl PhaseBiasesContent { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( PhaseBiasesContent{ + code: _buf.read_u8()?, + integer_indicator: _buf.read_u8()?, + widelane_integer_indicator: _buf.read_u8()?, + discontinuity_counter: _buf.read_u8()?, + bias: _buf.read_i32::()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( PhaseBiasesContent::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( PhaseBiasesContent::parse(buf)? ); + } + Ok(v) + } +} + + +// Precise orbit and clock correction +// +// The precise orbit and clock correction message is +// to be applied as a delta correction to broadcast +// ephemeris and is typically an equivalent to the 1060 +// and 1066 RTCM message types +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSsrOrbitClock { + pub time: GPSTimeSec, + // ^ GNSS reference time of the correction + pub sid: GnssSignal, + // ^ GNSS signal identifier (16 bit) + pub update_interval: u8, + // ^ Update interval between consecutive corrections + pub iod_ssr: u8, + // ^ IOD of the SSR correction. A change of Issue Of Data SSR is used to + // indicate a change in the SSR generating configuration + pub iod: u8, + // ^ Issue of broadcast ephemeris data + pub radial: i32, + // ^ Orbit radial delta correction + pub along: i32, + // ^ Orbit along delta correction + pub cross: i32, + // ^ Orbit along delta correction + pub dot_radial: i32, + // ^ Velocity of orbit radial delta correction + pub dot_along: i32, + // ^ Velocity of orbit along delta correction + pub dot_cross: i32, + // ^ Velocity of orbit cross delta correction + pub c0: i32, + // ^ C0 polynomial coefficient for correction of broadcast satellite clock + pub c1: i32, + // ^ C1 polynomial coefficient for correction of broadcast satellite clock + pub c2: i32, + // ^ C2 polynomial coefficient for correction of broadcast satellite clock +} + +impl MsgSsrOrbitClock { + pub const TYPE: u16 = 1500; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSsrOrbitClock{ + time: GPSTimeSec::parse(_buf)?, + sid: GnssSignal::parse(_buf)?, + update_interval: _buf.read_u8()?, + iod_ssr: _buf.read_u8()?, + iod: _buf.read_u8()?, + radial: _buf.read_i32::()?, + along: _buf.read_i32::()?, + cross: _buf.read_i32::()?, + dot_radial: _buf.read_i32::()?, + dot_along: _buf.read_i32::()?, + dot_cross: _buf.read_i32::()?, + c0: _buf.read_i32::()?, + c1: _buf.read_i32::()?, + c2: _buf.read_i32::()?, + } ) + } +} + + +// Precise code biases correction +// +// The precise code biases message is to be added +// to the pseudorange of the corresponding signal +// to get corrected pseudorange. It is typically +// an equivalent to the 1059 and 1065 RTCM message types +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSsrCodeBiases { + pub time: GPSTimeSec, + // ^ GNSS reference time of the correction + pub sid: GnssSignal, + // ^ GNSS signal identifier (16 bit) + pub update_interval: u8, + // ^ Update interval between consecutive corrections + pub iod_ssr: u8, + // ^ IOD of the SSR correction. A change of Issue Of Data SSR is used to + // indicate a change in the SSR generating configuration + pub biases: Vec, + // ^ Code biases for the different satellite signals +} + +impl MsgSsrCodeBiases { + pub const TYPE: u16 = 1505; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSsrCodeBiases{ + time: GPSTimeSec::parse(_buf)?, + sid: GnssSignal::parse(_buf)?, + update_interval: _buf.read_u8()?, + iod_ssr: _buf.read_u8()?, + biases: CodeBiasesContent::parse_array(_buf)?, + } ) + } +} + + +// Precise phase biases correction +// +// The precise phase biases message contains the biases +// to be added to the carrier phase of the corresponding +// signal to get corrected carrier phase measurement, as +// well as the satellite yaw angle to be applied to compute +// the phase wind-up correction. +// It is typically an equivalent to the 1265 RTCM message types +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSsrPhaseBiases { + pub time: GPSTimeSec, + // ^ GNSS reference time of the correction + pub sid: GnssSignal, + // ^ GNSS signal identifier (16 bit) + pub update_interval: u8, + // ^ Update interval between consecutive corrections + pub iod_ssr: u8, + // ^ IOD of the SSR correction. A change of Issue Of Data SSR is used to + // indicate a change in the SSR generating configuration + pub dispersive_bias: u8, + // ^ Indicator for the dispersive phase biases property. + pub mw_consistency: u8, + // ^ Consistency indicator for Melbourne-Wubbena linear combinations + pub yaw: u16, + // ^ Satellite yaw angle + pub yaw_rate: i8, + // ^ Satellite yaw angle rate + pub biases: Vec, + // ^ Phase biases corrections for a satellite being tracked. +} + +impl MsgSsrPhaseBiases { + pub const TYPE: u16 = 1510; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgSsrPhaseBiases{ + time: GPSTimeSec::parse(_buf)?, + sid: GnssSignal::parse(_buf)?, + update_interval: _buf.read_u8()?, + iod_ssr: _buf.read_u8()?, + dispersive_bias: _buf.read_u8()?, + mw_consistency: _buf.read_u8()?, + yaw: _buf.read_u16::()?, + yaw_rate: _buf.read_i8()?, + biases: PhaseBiasesContent::parse_array(_buf)?, + } ) + } +} + diff --git a/rust/sbp/src/messages/system.rs b/rust/sbp/src/messages/system.rs new file mode 100644 index 0000000000..55eab44c7b --- /dev/null +++ b/rust/sbp/src/messages/system.rs @@ -0,0 +1,134 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/system.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Standardized system messages from Swift Navigation devices. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; + + +// System start-up message +// +// The system start-up message is sent once on system +// start-up. It notifies the host or other attached devices that +// the system has started and is now ready to respond to commands +// or configuration requests. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgStartup { + pub cause: u8, + // ^ Cause of startup + pub startup_type: u8, + // ^ Startup type + pub reserved: u16, + // ^ Reserved +} + +impl MsgStartup { + pub const TYPE: u16 = 65280; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgStartup{ + cause: _buf.read_u8()?, + startup_type: _buf.read_u8()?, + reserved: _buf.read_u16::()?, + } ) + } +} + + +// Status of received corrections +// +// This message provides information about the receipt of Differential +// corrections. It is expected to be sent with each receipt of a complete +// corrections packet. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgDgnssStatus { + pub flags: u8, + // ^ Status flags + pub latency: u16, + // ^ Latency of observation receipt + pub num_signals: u8, + // ^ Number of signals from base station + pub source: String, + // ^ Corrections source string +} + +impl MsgDgnssStatus { + pub const TYPE: u16 = 65282; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgDgnssStatus{ + flags: _buf.read_u8()?, + latency: _buf.read_u16::()?, + num_signals: _buf.read_u8()?, + source: ::read_string(_buf)?, + } ) + } +} + + +// System heartbeat message +// +// The heartbeat message is sent periodically to inform the host +// or other attached devices that the system is running. It is +// used to monitor system malfunctions. It also contains status +// flags that indicate to the host the status of the system and +// whether it is operating correctly. Currently, the expected +// heartbeat interval is 1 sec. +// +// The system error flag is used to indicate that an error has +// occurred in the system. To determine the source of the error, +// the remaining error flags should be inspected. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgHeartbeat { + pub flags: u32, + // ^ Status flags +} + +impl MsgHeartbeat { + pub const TYPE: u16 = 65535; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgHeartbeat{ + flags: _buf.read_u32::()?, + } ) + } +} + + +// Inertial Navigation System status message +// +// The INS status message describes the state of the operation +// and initialization of the inertial navigation system. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgInsStatus { + pub flags: u32, + // ^ Status flags +} + +impl MsgInsStatus { + pub const TYPE: u16 = 65283; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgInsStatus{ + flags: _buf.read_u32::()?, + } ) + } +} + diff --git a/rust/sbp/src/messages/tracking.rs b/rust/sbp/src/messages/tracking.rs new file mode 100644 index 0000000000..dadc09b580 --- /dev/null +++ b/rust/sbp/src/messages/tracking.rs @@ -0,0 +1,478 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/tracking.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Satellite code and carrier-phase tracking messages from the device. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; +use super::gnss::*; + + +// Detailed signal tracking channel states. DEPRECATED. +// +// The tracking message returns a set tracking channel parameters for a +// single tracking channel useful for debugging issues. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgTrackingStateDetailedDepA { + pub recv_time: u64, + // ^ Receiver clock time. + pub tot: GPSTime, + // ^ Time of transmission of signal from satellite. TOW only valid when TOW + // status is decoded or propagated. WN only valid when week number valid + // flag is set. + pub P: u32, + // ^ Pseudorange observation. Valid only when pseudorange valid flag is set. + pub P_std: u16, + // ^ Pseudorange observation standard deviation. Valid only when pseudorange + // valid flag is set. + pub L: CarrierPhase, + // ^ Carrier phase observation with typical sign convention. Valid only when + // PLL pessimistic lock is achieved. + pub cn0: u8, + // ^ Carrier-to-Noise density + pub lock: u16, + // ^ Lock time. It is encoded according to DF402 from the RTCM 10403.2 + // Amendment 2 specification. Valid values range from 0 to 15. + pub sid: GnssSignal, + // ^ GNSS signal identifier. + pub doppler: i32, + // ^ Carrier Doppler frequency. + pub doppler_std: u16, + // ^ Carrier Doppler frequency standard deviation. + pub uptime: u32, + // ^ Number of seconds of continuous tracking. Specifies how much time signal + // is in continuous track. + pub clock_offset: i16, + // ^ TCXO clock offset. Valid only when valid clock valid flag is set. + pub clock_drift: i16, + // ^ TCXO clock drift. Valid only when valid clock valid flag is set. + pub corr_spacing: u16, + // ^ Early-Prompt (EP) and Prompt-Late (PL) correlators spacing. + pub acceleration: i8, + // ^ Acceleration. Valid only when acceleration valid flag is set. + pub sync_flags: u8, + // ^ Synchronization status flags. + pub tow_flags: u8, + // ^ TOW status flags. + pub track_flags: u8, + // ^ Tracking loop status flags. + pub nav_flags: u8, + // ^ Navigation data status flags. + pub pset_flags: u8, + // ^ Parameters sets flags. + pub misc_flags: u8, + // ^ Miscellaneous flags. +} + +impl MsgTrackingStateDetailedDepA { + pub const TYPE: u16 = 33; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgTrackingStateDetailedDepA{ + recv_time: _buf.read_u64::()?, + tot: GPSTime::parse(_buf)?, + P: _buf.read_u32::()?, + P_std: _buf.read_u16::()?, + L: CarrierPhase::parse(_buf)?, + cn0: _buf.read_u8()?, + lock: _buf.read_u16::()?, + sid: GnssSignal::parse(_buf)?, + doppler: _buf.read_i32::()?, + doppler_std: _buf.read_u16::()?, + uptime: _buf.read_u32::()?, + clock_offset: _buf.read_i16::()?, + clock_drift: _buf.read_i16::()?, + corr_spacing: _buf.read_u16::()?, + acceleration: _buf.read_i8()?, + sync_flags: _buf.read_u8()?, + tow_flags: _buf.read_u8()?, + track_flags: _buf.read_u8()?, + nav_flags: _buf.read_u8()?, + pset_flags: _buf.read_u8()?, + misc_flags: _buf.read_u8()?, + } ) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgTrackingStateDetailedDep { + pub recv_time: u64, + // ^ Receiver clock time. + pub tot: GPSTimeDep, + // ^ Time of transmission of signal from satellite. TOW only valid when TOW + // status is decoded or propagated. WN only valid when week number valid + // flag is set. + pub P: u32, + // ^ Pseudorange observation. Valid only when pseudorange valid flag is set. + pub P_std: u16, + // ^ Pseudorange observation standard deviation. Valid only when pseudorange + // valid flag is set. + pub L: CarrierPhase, + // ^ Carrier phase observation with typical sign convention. Valid only when + // PLL pessimistic lock is achieved. + pub cn0: u8, + // ^ Carrier-to-Noise density + pub lock: u16, + // ^ Lock time. It is encoded according to DF402 from the RTCM 10403.2 + // Amendment 2 specification. Valid values range from 0 to 15. + pub sid: GnssSignalDep, + // ^ GNSS signal identifier. + pub doppler: i32, + // ^ Carrier Doppler frequency. + pub doppler_std: u16, + // ^ Carrier Doppler frequency standard deviation. + pub uptime: u32, + // ^ Number of seconds of continuous tracking. Specifies how much time signal + // is in continuous track. + pub clock_offset: i16, + // ^ TCXO clock offset. Valid only when valid clock valid flag is set. + pub clock_drift: i16, + // ^ TCXO clock drift. Valid only when valid clock valid flag is set. + pub corr_spacing: u16, + // ^ Early-Prompt (EP) and Prompt-Late (PL) correlators spacing. + pub acceleration: i8, + // ^ Acceleration. Valid only when acceleration valid flag is set. + pub sync_flags: u8, + // ^ Synchronization status flags. + pub tow_flags: u8, + // ^ TOW status flags. + pub track_flags: u8, + // ^ Tracking loop status flags. + pub nav_flags: u8, + // ^ Navigation data status flags. + pub pset_flags: u8, + // ^ Parameters sets flags. + pub misc_flags: u8, + // ^ Miscellaneous flags. +} + +impl MsgTrackingStateDetailedDep { + pub const TYPE: u16 = 17; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgTrackingStateDetailedDep{ + recv_time: _buf.read_u64::()?, + tot: GPSTimeDep::parse(_buf)?, + P: _buf.read_u32::()?, + P_std: _buf.read_u16::()?, + L: CarrierPhase::parse(_buf)?, + cn0: _buf.read_u8()?, + lock: _buf.read_u16::()?, + sid: GnssSignalDep::parse(_buf)?, + doppler: _buf.read_i32::()?, + doppler_std: _buf.read_u16::()?, + uptime: _buf.read_u32::()?, + clock_offset: _buf.read_i16::()?, + clock_drift: _buf.read_i16::()?, + corr_spacing: _buf.read_u16::()?, + acceleration: _buf.read_i8()?, + sync_flags: _buf.read_u8()?, + tow_flags: _buf.read_u8()?, + track_flags: _buf.read_u8()?, + nav_flags: _buf.read_u8()?, + pset_flags: _buf.read_u8()?, + misc_flags: _buf.read_u8()?, + } ) + } +} + + +// Signal tracking channel state +// +// Tracking channel state for a specific satellite signal and +// measured signal power. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct TrackingChannelState { + pub sid: GnssSignal, + // ^ GNSS signal being tracked + pub fcn: u8, + // ^ Frequency channel number (GLONASS only) + pub cn0: u8, + // ^ Carrier-to-Noise density. Zero implies invalid cn0. +} + +impl TrackingChannelState { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( TrackingChannelState{ + sid: GnssSignal::parse(_buf)?, + fcn: _buf.read_u8()?, + cn0: _buf.read_u8()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( TrackingChannelState::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( TrackingChannelState::parse(buf)? ); + } + Ok(v) + } +} + + +// Signal tracking channel states +// +// The tracking message returns a variable-length array of tracking +// channel states. It reports status and carrier-to-noise density +// measurements for all tracked satellites. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgTrackingState { + pub states: Vec, + // ^ Signal tracking channel state +} + +impl MsgTrackingState { + pub const TYPE: u16 = 65; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgTrackingState{ + states: TrackingChannelState::parse_array(_buf)?, + } ) + } +} + + +// Complex correlation structure +// +// Structure containing in-phase and quadrature correlation components. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct TrackingChannelCorrelation { + pub I: i32, + // ^ In-phase correlation + pub Q: i32, + // ^ Quadrature correlation +} + +impl TrackingChannelCorrelation { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( TrackingChannelCorrelation{ + I: _buf.read_i32::()?, + Q: _buf.read_i32::()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( TrackingChannelCorrelation::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( TrackingChannelCorrelation::parse(buf)? ); + } + Ok(v) + } +} + + +// Tracking channel correlations +// +// When enabled, a tracking channel can output the correlations at each +// update interval. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgTrackingIq { + pub channel: u8, + // ^ Tracking channel of origin + pub sid: GnssSignal, + // ^ GNSS signal identifier + pub corrs: Vec, + // ^ Early, Prompt and Late correlations +} + +impl MsgTrackingIq { + pub const TYPE: u16 = 44; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgTrackingIq{ + channel: _buf.read_u8()?, + sid: GnssSignal::parse(_buf)?, + corrs: TrackingChannelCorrelation::parse_array_limit(_buf, 3)?, + } ) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgTrackingIqDep { + pub channel: u8, + // ^ Tracking channel of origin + pub sid: GnssSignalDep, + // ^ GNSS signal identifier + pub corrs: Vec, + // ^ Early, Prompt and Late correlations +} + +impl MsgTrackingIqDep { + pub const TYPE: u16 = 28; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgTrackingIqDep{ + channel: _buf.read_u8()?, + sid: GnssSignalDep::parse(_buf)?, + corrs: TrackingChannelCorrelation::parse_array_limit(_buf, 3)?, + } ) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct TrackingChannelStateDepA { + pub state: u8, + // ^ Status of tracking channel + pub prn: u8, + // ^ PRN-1 being tracked + pub cn0: f32, + // ^ Carrier-to-noise density +} + +impl TrackingChannelStateDepA { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( TrackingChannelStateDepA{ + state: _buf.read_u8()?, + prn: _buf.read_u8()?, + cn0: _buf.read_f32::()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( TrackingChannelStateDepA::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( TrackingChannelStateDepA::parse(buf)? ); + } + Ok(v) + } +} + + +// Deprecated +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgTrackingStateDepA { + pub states: Vec, + // ^ Satellite tracking channel state +} + +impl MsgTrackingStateDepA { + pub const TYPE: u16 = 22; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgTrackingStateDepA{ + states: TrackingChannelStateDepA::parse_array(_buf)?, + } ) + } +} + + +// Deprecated. +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct TrackingChannelStateDepB { + pub state: u8, + // ^ Status of tracking channel + pub sid: GnssSignalDep, + // ^ GNSS signal being tracked + pub cn0: f32, + // ^ Carrier-to-noise density +} + +impl TrackingChannelStateDepB { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( TrackingChannelStateDepB{ + state: _buf.read_u8()?, + sid: GnssSignalDep::parse(_buf)?, + cn0: _buf.read_f32::()?, + } ) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push( TrackingChannelStateDepB::parse(buf)? ); + } + Ok(v) + } + + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + let mut v = Vec::new(); + for _ in 0..n { + v.push( TrackingChannelStateDepB::parse(buf)? ); + } + Ok(v) + } +} + + +// Deprecated. +// +// Deprecated. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgTrackingStateDepB { + pub states: Vec, + // ^ Signal tracking channel state +} + +impl MsgTrackingStateDepB { + pub const TYPE: u16 = 19; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgTrackingStateDepB{ + states: TrackingChannelStateDepB::parse_array(_buf)?, + } ) + } +} + diff --git a/rust/sbp/src/messages/user.rs b/rust/sbp/src/messages/user.rs new file mode 100644 index 0000000000..0001318d4b --- /dev/null +++ b/rust/sbp/src/messages/user.rs @@ -0,0 +1,42 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/user.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Messages reserved for use by the user. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; + + +// User data +// +// This message can contain any application specific user data up to a +// maximum length of 255 bytes per message. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgUserData { + pub contents: Vec, + // ^ User data payload +} + +impl MsgUserData { + pub const TYPE: u16 = 2048; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgUserData{ + contents: ::read_u8_array(_buf)?, + } ) + } +} + diff --git a/rust/sbp/src/messages/vehicle.rs b/rust/sbp/src/messages/vehicle.rs new file mode 100644 index 0000000000..0950dd7d21 --- /dev/null +++ b/rust/sbp/src/messages/vehicle.rs @@ -0,0 +1,53 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/vehicle.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ + +// Messages from a vehicle. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian,ReadBytesExt}; + + +// Vehicle forward (x-axis) velocity +// +// Message representing the x component of vehicle velocity in the user frame at the odometry +// reference point(s) specified by the user. The offset for the odometry reference point and +// the definition and origin of the user frame are defined through the device settings interface. +// There are 4 possible user-defined sources of this message which are labeled arbitrarily +// source 0 through 3. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgOdometry { + pub tow: u32, + // ^ Time field representing either milliseconds in the GPS Week or local CPU + // time from the producing system in milliseconds. See the tow_source flag + // for the exact source of this timestamp. + pub velocity: i32, + // ^ The signed forward component of vehicle velocity. + pub flags: u8, + // ^ Status flags +} + +impl MsgOdometry { + pub const TYPE: u16 = 2307; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok( MsgOdometry{ + tow: _buf.read_u32::()?, + velocity: _buf.read_i32::()?, + flags: _buf.read_u8()?, + } ) + } +} + From d435b6901f19ce6566f0efa12f3e8d35934f8053 Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Mon, 17 Jun 2019 08:43:42 -0700 Subject: [PATCH 10/25] Regenerated all the messages --- rust/sbp/src/messages/acquisition.rs | 172 +-- rust/sbp/src/messages/bootload.rs | 68 +- rust/sbp/src/messages/ext_events.rs | 23 +- rust/sbp/src/messages/file_io.rs | 157 +- rust/sbp/src/messages/flash.rs | 124 +- rust/sbp/src/messages/gnss.rs | 186 ++- rust/sbp/src/messages/imu.rs | 47 +- rust/sbp/src/messages/linux.rs | 293 ++++ rust/sbp/src/messages/logging.rs | 68 +- rust/sbp/src/messages/mag.rs | 23 +- rust/sbp/src/messages/mod.rs | 1015 +++++++----- rust/sbp/src/messages/navigation.rs | 562 ++++--- rust/sbp/src/messages/ndb.rs | 39 +- rust/sbp/src/messages/observation.rs | 2142 ++++++++++++++++++-------- rust/sbp/src/messages/orientation.rs | 131 +- rust/sbp/src/messages/piksi.rs | 481 +++--- rust/sbp/src/messages/sbas.rs | 21 +- rust/sbp/src/messages/settings.rs | 167 +- rust/sbp/src/messages/ssr.rs | 618 +++++++- rust/sbp/src/messages/system.rs | 106 +- rust/sbp/src/messages/tracking.rs | 433 ++++-- rust/sbp/src/messages/user.rs | 15 +- rust/sbp/src/messages/vehicle.rs | 25 +- 23 files changed, 4475 insertions(+), 2441 deletions(-) create mode 100644 rust/sbp/src/messages/linux.rs diff --git a/rust/sbp/src/messages/acquisition.rs b/rust/sbp/src/messages/acquisition.rs index bf5e98a5dd..07c2ae41c8 100644 --- a/rust/sbp/src/messages/acquisition.rs +++ b/rust/sbp/src/messages/acquisition.rs @@ -12,14 +12,12 @@ // Automatically generated from yaml/swiftnav/sbp/acquisition.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Satellite acquisition messages from the device. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; +use self::byteorder::{LittleEndian, ReadBytesExt}; use super::gnss::*; - // Satellite acquisition result // // This message describes the results from an attempted GPS signal @@ -32,28 +30,27 @@ use super::gnss::*; #[allow(non_snake_case)] pub struct MsgAcqResult { pub cn0: f32, - // ^ CN/0 of best point + // ^ CN/0 of best point pub cp: f32, - // ^ Code phase of best point + // ^ Code phase of best point pub cf: f32, - // ^ Carrier frequency of best point + // ^ Carrier frequency of best point pub sid: GnssSignal, - // ^ GNSS signal for which acquisition was attempted + // ^ GNSS signal for which acquisition was attempted } impl MsgAcqResult { pub const TYPE: u16 = 47; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgAcqResult{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgAcqResult { cn0: _buf.read_f32::()?, cp: _buf.read_f32::()?, cf: _buf.read_f32::()?, sid: GnssSignal::parse(_buf)?, - } ) + }) } } - // Deprecated // // Deprecated. @@ -62,28 +59,27 @@ impl MsgAcqResult { #[allow(non_snake_case)] pub struct MsgAcqResultDepC { pub cn0: f32, - // ^ CN/0 of best point + // ^ CN/0 of best point pub cp: f32, - // ^ Code phase of best point + // ^ Code phase of best point pub cf: f32, - // ^ Carrier frequency of best point + // ^ Carrier frequency of best point pub sid: GnssSignalDep, - // ^ GNSS signal for which acquisition was attempted + // ^ GNSS signal for which acquisition was attempted } impl MsgAcqResultDepC { pub const TYPE: u16 = 31; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgAcqResultDepC{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgAcqResultDepC { cn0: _buf.read_f32::()?, cp: _buf.read_f32::()?, cf: _buf.read_f32::()?, sid: GnssSignalDep::parse(_buf)?, - } ) + }) } } - // Deprecated // // Deprecated. @@ -92,29 +88,28 @@ impl MsgAcqResultDepC { #[allow(non_snake_case)] pub struct MsgAcqResultDepB { pub snr: f32, - // ^ SNR of best point. Currently in arbitrary SNR points, but will be in - // units of dB Hz in a later revision of this message. + // ^ SNR of best point. Currently in arbitrary SNR points, but will be in + // units of dB Hz in a later revision of this message. pub cp: f32, - // ^ Code phase of best point + // ^ Code phase of best point pub cf: f32, - // ^ Carrier frequency of best point + // ^ Carrier frequency of best point pub sid: GnssSignalDep, - // ^ GNSS signal for which acquisition was attempted + // ^ GNSS signal for which acquisition was attempted } impl MsgAcqResultDepB { pub const TYPE: u16 = 20; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgAcqResultDepB{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgAcqResultDepB { snr: _buf.read_f32::()?, cp: _buf.read_f32::()?, cf: _buf.read_f32::()?, sid: GnssSignalDep::parse(_buf)?, - } ) + }) } } - // Deprecated // // Deprecated. @@ -123,30 +118,29 @@ impl MsgAcqResultDepB { #[allow(non_snake_case)] pub struct MsgAcqResultDepA { pub snr: f32, - // ^ SNR of best point. Currently dimensonless, but will have units of dB Hz - // in the revision of this message. + // ^ SNR of best point. Currently dimensonless, but will have units of dB Hz + // in the revision of this message. pub cp: f32, - // ^ Code phase of best point + // ^ Code phase of best point pub cf: f32, - // ^ Carrier frequency of best point + // ^ Carrier frequency of best point pub prn: u8, - // ^ PRN-1 identifier of the satellite signal for which acquisition was - // attempted + // ^ PRN-1 identifier of the satellite signal for which acquisition was + // attempted } impl MsgAcqResultDepA { pub const TYPE: u16 = 21; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgAcqResultDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgAcqResultDepA { snr: _buf.read_f32::()?, cp: _buf.read_f32::()?, cf: _buf.read_f32::()?, prn: _buf.read_u8()?, - } ) + }) } } - // Acq perfomance measurement and debug // // Profile for a specific SV for debugging purposes @@ -157,34 +151,34 @@ impl MsgAcqResultDepA { #[allow(non_snake_case)] pub struct AcqSvProfile { pub job_type: u8, - // ^ SV search job type (deep, fallback, etc) + // ^ SV search job type (deep, fallback, etc) pub status: u8, - // ^ Acquisition status 1 is Success, 0 is Failure + // ^ Acquisition status 1 is Success, 0 is Failure pub cn0: u16, - // ^ CN0 value. Only valid if status is '1' + // ^ CN0 value. Only valid if status is '1' pub int_time: u8, - // ^ Acquisition integration time + // ^ Acquisition integration time pub sid: GnssSignal, - // ^ GNSS signal for which acquisition was attempted + // ^ GNSS signal for which acquisition was attempted pub bin_width: u16, - // ^ Acq frequency bin width + // ^ Acq frequency bin width pub timestamp: u32, - // ^ Timestamp of the job complete event + // ^ Timestamp of the job complete event pub time_spent: u32, - // ^ Time spent to search for sid.code + // ^ Time spent to search for sid.code pub cf_min: i32, - // ^ Doppler range lowest frequency + // ^ Doppler range lowest frequency pub cf_max: i32, - // ^ Doppler range highest frequency + // ^ Doppler range highest frequency pub cf: i32, - // ^ Doppler value of detected peak. Only valid if status is '1' + // ^ Doppler value of detected peak. Only valid if status is '1' pub cp: u32, - // ^ Codephase of detected peak. Only valid if status is '1' + // ^ Codephase of detected peak. Only valid if status is '1' } impl AcqSvProfile { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( AcqSvProfile{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(AcqSvProfile { job_type: _buf.read_u8()?, status: _buf.read_u8()?, cn0: _buf.read_u16::()?, @@ -197,26 +191,28 @@ impl AcqSvProfile { cf_max: _buf.read_i32::()?, cf: _buf.read_i32::()?, cp: _buf.read_u32::()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( AcqSvProfile::parse(buf)? ); + v.push(AcqSvProfile::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( AcqSvProfile::parse(buf)? ); + v.push(AcqSvProfile::parse(buf)?); } Ok(v) } } - // Deprecated // // Deprecated. @@ -225,34 +221,34 @@ impl AcqSvProfile { #[allow(non_snake_case)] pub struct AcqSvProfileDep { pub job_type: u8, - // ^ SV search job type (deep, fallback, etc) + // ^ SV search job type (deep, fallback, etc) pub status: u8, - // ^ Acquisition status 1 is Success, 0 is Failure + // ^ Acquisition status 1 is Success, 0 is Failure pub cn0: u16, - // ^ CN0 value. Only valid if status is '1' + // ^ CN0 value. Only valid if status is '1' pub int_time: u8, - // ^ Acquisition integration time + // ^ Acquisition integration time pub sid: GnssSignalDep, - // ^ GNSS signal for which acquisition was attempted + // ^ GNSS signal for which acquisition was attempted pub bin_width: u16, - // ^ Acq frequency bin width + // ^ Acq frequency bin width pub timestamp: u32, - // ^ Timestamp of the job complete event + // ^ Timestamp of the job complete event pub time_spent: u32, - // ^ Time spent to search for sid.code + // ^ Time spent to search for sid.code pub cf_min: i32, - // ^ Doppler range lowest frequency + // ^ Doppler range lowest frequency pub cf_max: i32, - // ^ Doppler range highest frequency + // ^ Doppler range highest frequency pub cf: i32, - // ^ Doppler value of detected peak. Only valid if status is '1' + // ^ Doppler value of detected peak. Only valid if status is '1' pub cp: u32, - // ^ Codephase of detected peak. Only valid if status is '1' + // ^ Codephase of detected peak. Only valid if status is '1' } impl AcqSvProfileDep { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( AcqSvProfileDep{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(AcqSvProfileDep { job_type: _buf.read_u8()?, status: _buf.read_u8()?, cn0: _buf.read_u16::()?, @@ -265,26 +261,28 @@ impl AcqSvProfileDep { cf_max: _buf.read_i32::()?, cf: _buf.read_i32::()?, cp: _buf.read_u32::()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( AcqSvProfileDep::parse(buf)? ); + v.push(AcqSvProfileDep::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( AcqSvProfileDep::parse(buf)? ); + v.push(AcqSvProfileDep::parse(buf)?); } Ok(v) } } - // Acquisition perfomance measurement and debug // // The message describes all SV profiles during acquisition time. @@ -294,19 +292,18 @@ impl AcqSvProfileDep { #[allow(non_snake_case)] pub struct MsgAcqSvProfile { pub acq_sv_profile: Vec, - // ^ SV profiles during acquisition time + // ^ SV profiles during acquisition time } impl MsgAcqSvProfile { pub const TYPE: u16 = 46; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgAcqSvProfile{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgAcqSvProfile { acq_sv_profile: AcqSvProfile::parse_array(_buf)?, - } ) + }) } } - // Deprecated. // // Deprecated. @@ -315,15 +312,14 @@ impl MsgAcqSvProfile { #[allow(non_snake_case)] pub struct MsgAcqSvProfileDep { pub acq_sv_profile: Vec, - // ^ SV profiles during acquisition time + // ^ SV profiles during acquisition time } impl MsgAcqSvProfileDep { pub const TYPE: u16 = 30; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgAcqSvProfileDep{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgAcqSvProfileDep { acq_sv_profile: AcqSvProfileDep::parse_array(_buf)?, - } ) + }) } } - diff --git a/rust/sbp/src/messages/bootload.rs b/rust/sbp/src/messages/bootload.rs index 7466c16a69..47c21f579c 100644 --- a/rust/sbp/src/messages/bootload.rs +++ b/rust/sbp/src/messages/bootload.rs @@ -12,16 +12,14 @@ // Automatically generated from yaml/swiftnav/sbp/bootload.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Messages for the bootloading configuration of a Piksi 2.3.1. This message // group does not apply to Piksi Multi. -// +// // Note that some of these messages share the same message type ID for both the // host request and the device response. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; - +use self::byteorder::{LittleEndian, ReadBytesExt}; // Bootloading handshake request (host => device) // @@ -31,18 +29,15 @@ use self::byteorder::{LittleEndian,ReadBytesExt}; // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgBootloaderHandshakeReq { -} +pub struct MsgBootloaderHandshakeReq {} impl MsgBootloaderHandshakeReq { pub const TYPE: u16 = 179; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgBootloaderHandshakeReq{ - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgBootloaderHandshakeReq {}) } } - // Bootloading handshake response (host <= device) // // The handshake message response from the device establishes a @@ -55,22 +50,21 @@ impl MsgBootloaderHandshakeReq { #[allow(non_snake_case)] pub struct MsgBootloaderHandshakeResp { pub flags: u32, - // ^ Bootloader flags + // ^ Bootloader flags pub version: String, - // ^ Bootloader version number + // ^ Bootloader version number } impl MsgBootloaderHandshakeResp { pub const TYPE: u16 = 180; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgBootloaderHandshakeResp{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgBootloaderHandshakeResp { flags: _buf.read_u32::()?, - version: ::read_string(_buf)?, - } ) + version: ::parser::read_string(_buf)?, + }) } } - // Bootloader jump to application (host => device) // // The host initiates the bootloader to jump to the application. @@ -79,19 +73,18 @@ impl MsgBootloaderHandshakeResp { #[allow(non_snake_case)] pub struct MsgBootloaderJumpToApp { pub jump: u8, - // ^ Ignored by the device + // ^ Ignored by the device } impl MsgBootloaderJumpToApp { pub const TYPE: u16 = 177; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgBootloaderJumpToApp{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgBootloaderJumpToApp { jump: _buf.read_u8()?, - } ) + }) } } - // Read FPGA device ID over UART request (host => device) // // The device message from the host reads a unique device @@ -103,18 +96,15 @@ impl MsgBootloaderJumpToApp { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgNapDeviceDnaReq { -} +pub struct MsgNapDeviceDnaReq {} impl MsgNapDeviceDnaReq { pub const TYPE: u16 = 222; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgNapDeviceDnaReq{ - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgNapDeviceDnaReq {}) } } - // Read FPGA device ID over UART response (host <= device) // // The device message from the host reads a unique device @@ -128,19 +118,18 @@ impl MsgNapDeviceDnaReq { #[allow(non_snake_case)] pub struct MsgNapDeviceDnaResp { pub dna: Vec, - // ^ 57-bit SwiftNAP FPGA Device ID. Remaining bits are padded on the right. + // ^ 57-bit SwiftNAP FPGA Device ID. Remaining bits are padded on the right. } impl MsgNapDeviceDnaResp { pub const TYPE: u16 = 221; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgNapDeviceDnaResp{ - dna: ::read_u8_array_limit(_buf, 8)?, - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgNapDeviceDnaResp { + dna: ::parser::read_u8_array_limit(_buf, 8)?, + }) } } - // Deprecated // // Deprecated. @@ -149,15 +138,14 @@ impl MsgNapDeviceDnaResp { #[allow(non_snake_case)] pub struct MsgBootloaderHandshakeDepA { pub handshake: Vec, - // ^ Version number string (not NULL terminated) + // ^ Version number string (not NULL terminated) } impl MsgBootloaderHandshakeDepA { pub const TYPE: u16 = 176; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgBootloaderHandshakeDepA{ - handshake: ::read_u8_array(_buf)?, - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgBootloaderHandshakeDepA { + handshake: ::parser::read_u8_array(_buf)?, + }) } } - diff --git a/rust/sbp/src/messages/ext_events.rs b/rust/sbp/src/messages/ext_events.rs index 14501997d3..ac65ea8d9d 100644 --- a/rust/sbp/src/messages/ext_events.rs +++ b/rust/sbp/src/messages/ext_events.rs @@ -12,13 +12,11 @@ // Automatically generated from yaml/swiftnav/sbp/ext_events.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Messages reporting accurately-timestamped external events, // e.g. camera shutter time. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; - +use self::byteorder::{LittleEndian, ReadBytesExt}; // Reports timestamped external pin event // @@ -29,28 +27,27 @@ use self::byteorder::{LittleEndian,ReadBytesExt}; #[allow(non_snake_case)] pub struct MsgExtEvent { pub wn: u16, - // ^ GPS week number + // ^ GPS week number pub tow: u32, - // ^ GPS time of week rounded to the nearest millisecond + // ^ GPS time of week rounded to the nearest millisecond pub ns_residual: i32, - // ^ Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to - // 500000) + // ^ Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to + // 500000) pub flags: u8, - // ^ Flags + // ^ Flags pub pin: u8, - // ^ Pin number. 0..9 = DEBUG0..9. + // ^ Pin number. 0..9 = DEBUG0..9. } impl MsgExtEvent { pub const TYPE: u16 = 257; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgExtEvent{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgExtEvent { wn: _buf.read_u16::()?, tow: _buf.read_u32::()?, ns_residual: _buf.read_i32::()?, flags: _buf.read_u8()?, pin: _buf.read_u8()?, - } ) + }) } } - diff --git a/rust/sbp/src/messages/file_io.rs b/rust/sbp/src/messages/file_io.rs index 066ea0376a..6937815731 100644 --- a/rust/sbp/src/messages/file_io.rs +++ b/rust/sbp/src/messages/file_io.rs @@ -12,19 +12,17 @@ // Automatically generated from yaml/swiftnav/sbp/file_io.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Messages for using device's onboard flash filesystem // functionality. This allows data to be stored persistently in the // device's program flash with wear-levelling using a simple filesystem // interface. The file system interface (CFS) defines an abstract API // for reading directories and for reading and writing files. -// +// // Note that some of these messages share the same message type ID for both the // host request and the device response. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; - +use self::byteorder::{LittleEndian, ReadBytesExt}; // Read file from the file system (host => device) // @@ -41,28 +39,27 @@ use self::byteorder::{LittleEndian,ReadBytesExt}; #[allow(non_snake_case)] pub struct MsgFileioReadReq { pub sequence: u32, - // ^ Read sequence number + // ^ Read sequence number pub offset: u32, - // ^ File offset + // ^ File offset pub chunk_size: u8, - // ^ Chunk size to read + // ^ Chunk size to read pub filename: String, - // ^ Name of the file to read from + // ^ Name of the file to read from } impl MsgFileioReadReq { pub const TYPE: u16 = 168; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgFileioReadReq{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgFileioReadReq { sequence: _buf.read_u32::()?, offset: _buf.read_u32::()?, chunk_size: _buf.read_u8()?, - filename: ::read_string(_buf)?, - } ) + filename: ::parser::read_string(_buf)?, + }) } } - // File read from the file system (host <= device) // // The file read message reads a certain length (up to 255 bytes) @@ -75,22 +72,21 @@ impl MsgFileioReadReq { #[allow(non_snake_case)] pub struct MsgFileioReadResp { pub sequence: u32, - // ^ Read sequence number + // ^ Read sequence number pub contents: Vec, - // ^ Contents of read file + // ^ Contents of read file } impl MsgFileioReadResp { pub const TYPE: u16 = 163; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgFileioReadResp{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgFileioReadResp { sequence: _buf.read_u32::()?, - contents: ::read_u8_array(_buf)?, - } ) + contents: ::parser::read_u8_array(_buf)?, + }) } } - // List files in a directory (host => device) // // The read directory message lists the files in a directory on the @@ -108,25 +104,24 @@ impl MsgFileioReadResp { #[allow(non_snake_case)] pub struct MsgFileioReadDirReq { pub sequence: u32, - // ^ Read sequence number + // ^ Read sequence number pub offset: u32, - // ^ The offset to skip the first n elements of the file list + // ^ The offset to skip the first n elements of the file list pub dirname: String, - // ^ Name of the directory to list + // ^ Name of the directory to list } impl MsgFileioReadDirReq { pub const TYPE: u16 = 169; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgFileioReadDirReq{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgFileioReadDirReq { sequence: _buf.read_u32::()?, offset: _buf.read_u32::()?, - dirname: ::read_string(_buf)?, - } ) + dirname: ::parser::read_string(_buf)?, + }) } } - // Files listed in a directory (host <= device) // // The read directory message lists the files in a directory on the @@ -140,22 +135,21 @@ impl MsgFileioReadDirReq { #[allow(non_snake_case)] pub struct MsgFileioReadDirResp { pub sequence: u32, - // ^ Read sequence number + // ^ Read sequence number pub contents: Vec, - // ^ Contents of read directory + // ^ Contents of read directory } impl MsgFileioReadDirResp { pub const TYPE: u16 = 170; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgFileioReadDirResp{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgFileioReadDirResp { sequence: _buf.read_u32::()?, - contents: ::read_u8_array(_buf)?, - } ) + contents: ::parser::read_u8_array(_buf)?, + }) } } - // Delete a file from the file system (host => device) // // The file remove message deletes a file from the file system. @@ -167,19 +161,18 @@ impl MsgFileioReadDirResp { #[allow(non_snake_case)] pub struct MsgFileioRemove { pub filename: String, - // ^ Name of the file to delete + // ^ Name of the file to delete } impl MsgFileioRemove { pub const TYPE: u16 = 172; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgFileioRemove{ - filename: ::read_string(_buf)?, - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgFileioRemove { + filename: ::parser::read_string(_buf)?, + }) } } - // Write to file (host => device) // // The file write message writes a certain length (up to 255 bytes) @@ -195,28 +188,27 @@ impl MsgFileioRemove { #[allow(non_snake_case)] pub struct MsgFileioWriteReq { pub sequence: u32, - // ^ Write sequence number + // ^ Write sequence number pub offset: u32, - // ^ Offset into the file at which to start writing in bytes + // ^ Offset into the file at which to start writing in bytes pub filename: String, - // ^ Name of the file to write to + // ^ Name of the file to write to pub data: Vec, - // ^ Variable-length array of data to write + // ^ Variable-length array of data to write } impl MsgFileioWriteReq { pub const TYPE: u16 = 173; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgFileioWriteReq{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgFileioWriteReq { sequence: _buf.read_u32::()?, offset: _buf.read_u32::()?, - filename: ::read_string(_buf)?, - data: ::read_u8_array(_buf)?, - } ) + filename: ::parser::read_string(_buf)?, + data: ::parser::read_u8_array(_buf)?, + }) } } - // File written to (host <= device) // // The file write message writes a certain length (up to 255 bytes) @@ -229,15 +221,70 @@ impl MsgFileioWriteReq { #[allow(non_snake_case)] pub struct MsgFileioWriteResp { pub sequence: u32, - // ^ Write sequence number + // ^ Write sequence number } impl MsgFileioWriteResp { pub const TYPE: u16 = 171; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgFileioWriteResp{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgFileioWriteResp { sequence: _buf.read_u32::()?, - } ) + }) } } +// Request advice on the optimal configuration for FileIO. +// +// Requests advice on the optimal configuration for a FileIO +// transfer. Newer version of FileIO can support greater +// throughput by supporting a large window of FileIO data +// that can be in-flight during read or write operations. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgFileioConfigReq { + pub sequence: u32, + // ^ Advice sequence number +} + +impl MsgFileioConfigReq { + pub const TYPE: u16 = 4097; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgFileioConfigReq { + sequence: _buf.read_u32::()?, + }) + } +} + +// Response with advice on the optimal configuration for FileIO. + +// +// The advice on the optimal configuration for a FileIO +// transfer. Newer version of FileIO can support greater +// throughput by supporting a large window of FileIO data +// that can be in-flight during read or write operations. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgFileioConfigResp { + pub sequence: u32, + // ^ Advice sequence number + pub window_size: u32, + // ^ The number of SBP packets in the data in-flight window + pub batch_size: u32, + // ^ The number of SBP packets sent in one PDU + pub fileio_version: u32, + // ^ The version of FileIO that is supported +} + +impl MsgFileioConfigResp { + pub const TYPE: u16 = 4098; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgFileioConfigResp { + sequence: _buf.read_u32::()?, + window_size: _buf.read_u32::()?, + batch_size: _buf.read_u32::()?, + fileio_version: _buf.read_u32::()?, + }) + } +} diff --git a/rust/sbp/src/messages/flash.rs b/rust/sbp/src/messages/flash.rs index c75c2f381f..dd62bcd374 100644 --- a/rust/sbp/src/messages/flash.rs +++ b/rust/sbp/src/messages/flash.rs @@ -12,16 +12,14 @@ // Automatically generated from yaml/swiftnav/sbp/flash.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Messages for reading/writing the device's onboard flash memory. Many // of these messages target specific flash memory peripherals used in // Swift Navigation devices: the STM32 flash and the M25Pxx FPGA -// configuration flash from Piksi 2.3.1. This module does not apply +// configuration flash from Piksi 2.3.1. This module does not apply // to Piksi Multi. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; - +use self::byteorder::{LittleEndian, ReadBytesExt}; // Program flash addresses // @@ -36,28 +34,27 @@ use self::byteorder::{LittleEndian,ReadBytesExt}; #[allow(non_snake_case)] pub struct MsgFlashProgram { pub target: u8, - // ^ Target flags + // ^ Target flags pub addr_start: Vec, - // ^ Starting address offset to program + // ^ Starting address offset to program pub addr_len: u8, - // ^ Length of set of addresses to program, counting up from starting address + // ^ Length of set of addresses to program, counting up from starting address pub data: Vec, - // ^ Data to program addresses with, with length N=addr_len + // ^ Data to program addresses with, with length N=addr_len } impl MsgFlashProgram { pub const TYPE: u16 = 230; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgFlashProgram{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgFlashProgram { target: _buf.read_u8()?, - addr_start: ::read_u8_array_limit(_buf, 3)?, + addr_start: ::parser::read_u8_array_limit(_buf, 3)?, addr_len: _buf.read_u8()?, - data: ::read_u8_array(_buf)?, - } ) + data: ::parser::read_u8_array(_buf)?, + }) } } - // Flash response message (host <= device). // // This message defines success or failure codes for a variety of @@ -69,19 +66,18 @@ impl MsgFlashProgram { #[allow(non_snake_case)] pub struct MsgFlashDone { pub response: u8, - // ^ Response flags + // ^ Response flags } impl MsgFlashDone { pub const TYPE: u16 = 224; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgFlashDone{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgFlashDone { response: _buf.read_u8()?, - } ) + }) } } - // Read STM or M25 flash address request (host => device). // // The flash read message reads a set of addresses of either the @@ -96,25 +92,24 @@ impl MsgFlashDone { #[allow(non_snake_case)] pub struct MsgFlashReadReq { pub target: u8, - // ^ Target flags + // ^ Target flags pub addr_start: Vec, - // ^ Starting address offset to read from + // ^ Starting address offset to read from pub addr_len: u8, - // ^ Length of set of addresses to read, counting up from starting address + // ^ Length of set of addresses to read, counting up from starting address } impl MsgFlashReadReq { pub const TYPE: u16 = 231; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgFlashReadReq{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgFlashReadReq { target: _buf.read_u8()?, - addr_start: ::read_u8_array_limit(_buf, 3)?, + addr_start: ::parser::read_u8_array_limit(_buf, 3)?, addr_len: _buf.read_u8()?, - } ) + }) } } - // Read STM or M25 flash address response (host <= device). // // The flash read message reads a set of addresses of either the @@ -129,25 +124,24 @@ impl MsgFlashReadReq { #[allow(non_snake_case)] pub struct MsgFlashReadResp { pub target: u8, - // ^ Target flags + // ^ Target flags pub addr_start: Vec, - // ^ Starting address offset to read from + // ^ Starting address offset to read from pub addr_len: u8, - // ^ Length of set of addresses to read, counting up from starting address + // ^ Length of set of addresses to read, counting up from starting address } impl MsgFlashReadResp { pub const TYPE: u16 = 225; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgFlashReadResp{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgFlashReadResp { target: _buf.read_u8()?, - addr_start: ::read_u8_array_limit(_buf, 3)?, + addr_start: ::parser::read_u8_array_limit(_buf, 3)?, addr_len: _buf.read_u8()?, - } ) + }) } } - // Erase sector of device flash memory (host => device). // // The flash erase message from the host erases a sector of either @@ -160,22 +154,21 @@ impl MsgFlashReadResp { #[allow(non_snake_case)] pub struct MsgFlashErase { pub target: u8, - // ^ Target flags + // ^ Target flags pub sector_num: u32, - // ^ Flash sector number to erase (0-11 for the STM, 0-15 for the M25) + // ^ Flash sector number to erase (0-11 for the STM, 0-15 for the M25) } impl MsgFlashErase { pub const TYPE: u16 = 226; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgFlashErase{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgFlashErase { target: _buf.read_u8()?, sector_num: _buf.read_u32::()?, - } ) + }) } } - // Lock sector of STM flash memory (host => device) // // The flash lock message locks a sector of the STM flash @@ -185,19 +178,18 @@ impl MsgFlashErase { #[allow(non_snake_case)] pub struct MsgStmFlashLockSector { pub sector: u32, - // ^ Flash sector number to lock + // ^ Flash sector number to lock } impl MsgStmFlashLockSector { pub const TYPE: u16 = 227; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgStmFlashLockSector{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgStmFlashLockSector { sector: _buf.read_u32::()?, - } ) + }) } } - // Unlock sector of STM flash memory (host => device) // // The flash unlock message unlocks a sector of the STM flash @@ -207,19 +199,18 @@ impl MsgStmFlashLockSector { #[allow(non_snake_case)] pub struct MsgStmFlashUnlockSector { pub sector: u32, - // ^ Flash sector number to unlock + // ^ Flash sector number to unlock } impl MsgStmFlashUnlockSector { pub const TYPE: u16 = 228; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgStmFlashUnlockSector{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgStmFlashUnlockSector { sector: _buf.read_u32::()?, - } ) + }) } } - // Read device's hardcoded unique ID request (host => device) // @@ -230,18 +221,15 @@ impl MsgStmFlashUnlockSector { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgStmUniqueIdReq { -} +pub struct MsgStmUniqueIdReq {} impl MsgStmUniqueIdReq { pub const TYPE: u16 = 232; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgStmUniqueIdReq{ - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgStmUniqueIdReq {}) } } - // Read device's hardcoded unique ID response (host <= device) // @@ -254,19 +242,18 @@ impl MsgStmUniqueIdReq { #[allow(non_snake_case)] pub struct MsgStmUniqueIdResp { pub stm_id: Vec, - // ^ Device unique ID + // ^ Device unique ID } impl MsgStmUniqueIdResp { pub const TYPE: u16 = 229; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgStmUniqueIdResp{ - stm_id: ::read_u8_array_limit(_buf, 12)?, - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgStmUniqueIdResp { + stm_id: ::parser::read_u8_array_limit(_buf, 12)?, + }) } } - // Write M25 flash status register (host => device) // // The flash status message writes to the 8-bit M25 flash status @@ -276,15 +263,14 @@ impl MsgStmUniqueIdResp { #[allow(non_snake_case)] pub struct MsgM25FlashWriteStatus { pub status: Vec, - // ^ Byte to write to the M25 flash status register + // ^ Byte to write to the M25 flash status register } impl MsgM25FlashWriteStatus { pub const TYPE: u16 = 243; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgM25FlashWriteStatus{ - status: ::read_u8_array_limit(_buf, 1)?, - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgM25FlashWriteStatus { + status: ::parser::read_u8_array_limit(_buf, 1)?, + }) } } - diff --git a/rust/sbp/src/messages/gnss.rs b/rust/sbp/src/messages/gnss.rs index 641dd2f9df..4b642c6c29 100644 --- a/rust/sbp/src/messages/gnss.rs +++ b/rust/sbp/src/messages/gnss.rs @@ -12,12 +12,10 @@ // Automatically generated from yaml/swiftnav/sbp/gnss.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Various structs shared between modules extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; - +use self::byteorder::{LittleEndian, ReadBytesExt}; // Represents all the relevant information about the signal // @@ -27,35 +25,79 @@ use self::byteorder::{LittleEndian,ReadBytesExt}; #[allow(non_snake_case)] pub struct GnssSignal { pub sat: u8, - // ^ Constellation-specific satellite identifier + // ^ Constellation-specific satellite identifier. This field for Glonass can + // either be (100+FCN) where FCN is in [-7,+6] or the Slot ID in [1,28] pub code: u8, - // ^ Signal constellation, band and code + // ^ Signal constellation, band and code } impl GnssSignal { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( GnssSignal{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(GnssSignal { sat: _buf.read_u8()?, code: _buf.read_u8()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( GnssSignal::parse(buf)? ); + v.push(GnssSignal::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( GnssSignal::parse(buf)? ); + v.push(GnssSignal::parse(buf)?); } Ok(v) } } +// Space vehicle identifier +// +// A (Constellation ID, satellite ID) tuple that uniquely identifies +// a space vehicle +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct SvId { + pub satId: u8, + // ^ ID of the space vehicle within its constellation + pub constellation: u8, + // ^ Constellation ID to which the SV belongs +} + +impl SvId { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(SvId { + satId: _buf.read_u8()?, + constellation: _buf.read_u8()?, + }) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push(SvId::parse(buf)?); + } + Ok(v) + } + + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(SvId::parse(buf)?); + } + Ok(v) + } +} // Deprecated // @@ -65,41 +107,43 @@ impl GnssSignal { #[allow(non_snake_case)] pub struct GnssSignalDep { pub sat: u16, - // ^ Constellation-specific satellite identifier. Note: unlike GnssSignal, - // GPS satellites are encoded as (PRN - 1). Other constellations do not - // have this offset. + // ^ Constellation-specific satellite identifier. Note: unlike GnssSignal, + // GPS satellites are encoded as (PRN - 1). Other constellations do not + // have this offset. pub code: u8, - // ^ Signal constellation, band and code + // ^ Signal constellation, band and code pub reserved: u8, - // ^ Reserved + // ^ Reserved } impl GnssSignalDep { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( GnssSignalDep{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(GnssSignalDep { sat: _buf.read_u16::()?, code: _buf.read_u8()?, reserved: _buf.read_u8()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( GnssSignalDep::parse(buf)? ); + v.push(GnssSignalDep::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( GnssSignalDep::parse(buf)? ); + v.push(GnssSignalDep::parse(buf)?); } Ok(v) } } - // Millisecond-accurate GPS time // // A wire-appropriate GPS time, defined as the number of @@ -110,36 +154,38 @@ impl GnssSignalDep { #[allow(non_snake_case)] pub struct GPSTimeDep { pub tow: u32, - // ^ Milliseconds since start of GPS week + // ^ Milliseconds since start of GPS week pub wn: u16, - // ^ GPS week number + // ^ GPS week number } impl GPSTimeDep { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( GPSTimeDep{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(GPSTimeDep { tow: _buf.read_u32::()?, wn: _buf.read_u16::()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( GPSTimeDep::parse(buf)? ); + v.push(GPSTimeDep::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( GPSTimeDep::parse(buf)? ); + v.push(GPSTimeDep::parse(buf)?); } Ok(v) } } - // Whole second accurate GPS time // // A GPS time, defined as the number of @@ -150,36 +196,38 @@ impl GPSTimeDep { #[allow(non_snake_case)] pub struct GPSTimeSec { pub tow: u32, - // ^ Seconds since start of GPS week + // ^ Seconds since start of GPS week pub wn: u16, - // ^ GPS week number + // ^ GPS week number } impl GPSTimeSec { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( GPSTimeSec{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(GPSTimeSec { tow: _buf.read_u32::()?, wn: _buf.read_u16::()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( GPSTimeSec::parse(buf)? ); + v.push(GPSTimeSec::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( GPSTimeSec::parse(buf)? ); + v.push(GPSTimeSec::parse(buf)?); } Ok(v) } } - // Nanosecond-accurate receiver clock time // // A wire-appropriate receiver clock time, defined as the time @@ -191,40 +239,42 @@ impl GPSTimeSec { #[allow(non_snake_case)] pub struct GPSTime { pub tow: u32, - // ^ Milliseconds since start of GPS week + // ^ Milliseconds since start of GPS week pub ns_residual: i32, - // ^ Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to - // 500000) + // ^ Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to + // 500000) pub wn: u16, - // ^ GPS week number + // ^ GPS week number } impl GPSTime { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( GPSTime{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(GPSTime { tow: _buf.read_u32::()?, ns_residual: _buf.read_i32::()?, wn: _buf.read_u16::()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( GPSTime::parse(buf)? ); + v.push(GPSTime::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( GPSTime::parse(buf)? ); + v.push(GPSTime::parse(buf)?); } Ok(v) } } - // GNSS carrier phase measurement. // // Carrier phase measurement in cycles represented as a 40-bit @@ -236,32 +286,34 @@ impl GPSTime { #[allow(non_snake_case)] pub struct CarrierPhase { pub i: i32, - // ^ Carrier phase whole cycles + // ^ Carrier phase whole cycles pub f: u8, - // ^ Carrier phase fractional part + // ^ Carrier phase fractional part } impl CarrierPhase { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( CarrierPhase{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(CarrierPhase { i: _buf.read_i32::()?, f: _buf.read_u8()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( CarrierPhase::parse(buf)? ); + v.push(CarrierPhase::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( CarrierPhase::parse(buf)? ); + v.push(CarrierPhase::parse(buf)?); } Ok(v) } } - diff --git a/rust/sbp/src/messages/imu.rs b/rust/sbp/src/messages/imu.rs index 0d1064e34f..78be1a17ac 100644 --- a/rust/sbp/src/messages/imu.rs +++ b/rust/sbp/src/messages/imu.rs @@ -12,45 +12,44 @@ // Automatically generated from yaml/swiftnav/sbp/imu.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Inertial Measurement Unit (IMU) messages. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; - +use self::byteorder::{LittleEndian, ReadBytesExt}; // Raw IMU data // // Raw data from the Inertial Measurement Unit, containing accelerometer and -// gyroscope readings. The sense of the measurements are to be aligned with -// the indications on the device itself. +// gyroscope readings. The sense of the measurements are to be aligned with +// the indications on the device itself. Measurement units, which are specific to the +// device hardware and settings, are communicated via the MSG_IMU_AUX message. // #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgImuRaw { pub tow: u32, - // ^ Milliseconds since start of GPS week. If the high bit is set, the time - // is unknown or invalid. + // ^ Milliseconds since start of GPS week. If the high bit is set, the time + // is unknown or invalid. pub tow_f: u8, - // ^ Milliseconds since start of GPS week, fractional part + // ^ Milliseconds since start of GPS week, fractional part pub acc_x: i16, - // ^ Acceleration in the IMU frame X axis + // ^ Acceleration in the IMU frame X axis pub acc_y: i16, - // ^ Acceleration in the IMU frame Y axis + // ^ Acceleration in the IMU frame Y axis pub acc_z: i16, - // ^ Acceleration in the IMU frame Z axis + // ^ Acceleration in the IMU frame Z axis pub gyr_x: i16, - // ^ Angular rate around IMU frame X axis + // ^ Angular rate around IMU frame X axis pub gyr_y: i16, - // ^ Angular rate around IMU frame Y axis + // ^ Angular rate around IMU frame Y axis pub gyr_z: i16, - // ^ Angular rate around IMU frame Z axis + // ^ Angular rate around IMU frame Z axis } impl MsgImuRaw { pub const TYPE: u16 = 2304; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgImuRaw{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgImuRaw { tow: _buf.read_u32::()?, tow_f: _buf.read_u8()?, acc_x: _buf.read_i16::()?, @@ -59,11 +58,10 @@ impl MsgImuRaw { gyr_x: _buf.read_i16::()?, gyr_y: _buf.read_i16::()?, gyr_z: _buf.read_i16::()?, - } ) + }) } } - // Auxiliary IMU data // // Auxiliary data specific to a particular IMU. The `imu_type` field will @@ -74,21 +72,20 @@ impl MsgImuRaw { #[allow(non_snake_case)] pub struct MsgImuAux { pub imu_type: u8, - // ^ IMU type + // ^ IMU type pub temp: i16, - // ^ Raw IMU temperature + // ^ Raw IMU temperature pub imu_conf: u8, - // ^ IMU configuration + // ^ IMU configuration } impl MsgImuAux { pub const TYPE: u16 = 2305; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgImuAux{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgImuAux { imu_type: _buf.read_u8()?, temp: _buf.read_i16::()?, imu_conf: _buf.read_u8()?, - } ) + }) } } - diff --git a/rust/sbp/src/messages/linux.rs b/rust/sbp/src/messages/linux.rs new file mode 100644 index 0000000000..605b34d7ec --- /dev/null +++ b/rust/sbp/src/messages/linux.rs @@ -0,0 +1,293 @@ +// Copyright (C) 2015-2018 Swift Navigation Inc. +// Contact: Swift Navigation +// +// This source is subject to the license found in the file 'LICENSE' which must +// be be distributed together with this source. All other rights reserved. +// +// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. + +//**************************************************************************** +// Automatically generated from yaml/swiftnav/sbp/linux.yaml +// with generate.py. Please do not hand edit! +//****************************************************************************/ +// Linux state monitoring. +extern crate byteorder; +#[allow(unused_imports)] +use self::byteorder::{LittleEndian, ReadBytesExt}; + +// List CPU state on the system +// +// This message indicates the process state of the top 10 heaviest +// consumers of CPU on the system. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgLinuxCpuState { + pub index: u8, + // ^ sequence of this status message, values from 0-9 + pub pid: u16, + // ^ the PID of the process + pub pcpu: u8, + // ^ percent of cpu used, expressed as a fraction of 256 + pub tname: String, + // ^ fixed length string representing the thread name + pub cmdline: String, + // ^ the command line (as much as it fits in the remaining packet) +} + +impl MsgLinuxCpuState { + pub const TYPE: u16 = 32512; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgLinuxCpuState { + index: _buf.read_u8()?, + pid: _buf.read_u16::()?, + pcpu: _buf.read_u8()?, + tname: ::parser::read_string_limit(_buf, 15)?, + cmdline: ::parser::read_string(_buf)?, + }) + } +} + +// List CPU state on the system +// +// This message indicates the process state of the top 10 heaviest +// consumers of memory on the system. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgLinuxMemState { + pub index: u8, + // ^ sequence of this status message, values from 0-9 + pub pid: u16, + // ^ the PID of the process + pub pmem: u8, + // ^ percent of memory used, expressed as a fraction of 256 + pub tname: String, + // ^ fixed length string representing the thread name + pub cmdline: String, + // ^ the command line (as much as it fits in the remaining packet) +} + +impl MsgLinuxMemState { + pub const TYPE: u16 = 32513; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgLinuxMemState { + index: _buf.read_u8()?, + pid: _buf.read_u16::()?, + pmem: _buf.read_u8()?, + tname: ::parser::read_string_limit(_buf, 15)?, + cmdline: ::parser::read_string(_buf)?, + }) + } +} + +// CPU, Memory and Process Starts/Stops +// +// This presents a summary of CPU and memory utilization. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgLinuxSysState { + pub mem_total: u16, + // ^ total system memory + pub pcpu: u8, + // ^ percent of total cpu currently utilized + pub pmem: u8, + // ^ percent of total memory currently utilized + pub procs_starting: u16, + // ^ number of processes that started during collection phase + pub procs_stopping: u16, + // ^ number of processes that stopped during collection phase + pub pid_count: u16, + // ^ the count of processes on the system +} + +impl MsgLinuxSysState { + pub const TYPE: u16 = 32514; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgLinuxSysState { + mem_total: _buf.read_u16::()?, + pcpu: _buf.read_u8()?, + pmem: _buf.read_u8()?, + procs_starting: _buf.read_u16::()?, + procs_stopping: _buf.read_u16::()?, + pid_count: _buf.read_u16::()?, + }) + } +} + +// A list of processes with high socket counts +// +// Top 10 list of processes with high socket counts. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgLinuxProcessSocketCounts { + pub index: u8, + // ^ sequence of this status message, values from 0-9 + pub pid: u16, + // ^ the PID of the process in question + pub socket_count: u16, + // ^ the number of sockets the process is using + pub socket_types: u16, + // ^ A bitfield indicating the socket types used: 0x1 (tcp), 0x2 (udp), 0x4 + // (unix stream), 0x8 (unix dgram), 0x10 (netlink), and 0x8000 (unknown) + pub socket_states: u16, + // ^ A bitfield indicating the socket states: 0x1 (established), 0x2 (syn- + // sent), 0x4 (syn-recv), 0x8 (fin-wait-1), 0x10 (fin-wait-2), 0x20 + // (time-wait), 0x40 (closed), 0x80 (close-wait), 0x100 (last-ack), 0x200 + // (listen), 0x400 (closing), 0x800 (unconnected), and 0x8000 (unknown) + pub cmdline: String, + // ^ the command line of the process in question +} + +impl MsgLinuxProcessSocketCounts { + pub const TYPE: u16 = 32515; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgLinuxProcessSocketCounts { + index: _buf.read_u8()?, + pid: _buf.read_u16::()?, + socket_count: _buf.read_u16::()?, + socket_types: _buf.read_u16::()?, + socket_states: _buf.read_u16::()?, + cmdline: ::parser::read_string(_buf)?, + }) + } +} + +// A list of processes with deep socket queues +// +// Top 10 list of sockets with deep queues. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgLinuxProcessSocketQueues { + pub index: u8, + // ^ sequence of this status message, values from 0-9 + pub pid: u16, + // ^ the PID of the process in question + pub recv_queued: u16, + // ^ the total amount of receive data queued for this process + pub send_queued: u16, + // ^ the total amount of send data queued for this process + pub socket_types: u16, + // ^ A bitfield indicating the socket types used: 0x1 (tcp), 0x2 (udp), 0x4 + // (unix stream), 0x8 (unix dgram), 0x10 (netlink), and 0x8000 (unknown) + pub socket_states: u16, + // ^ A bitfield indicating the socket states: 0x1 (established), 0x2 (syn- + // sent), 0x4 (syn-recv), 0x8 (fin-wait-1), 0x10 (fin-wait-2), 0x20 + // (time-wait), 0x40 (closed), 0x80 (close-wait), 0x100 (last-ack), 0x200 + // (listen), 0x400 (closing), 0x800 (unconnected), and 0x8000 (unknown) + pub address_of_largest: String, + // ^ Address of the largest queue, remote or local depending on the + // directionality of the connection. + pub cmdline: String, + // ^ the command line of the process in question +} + +impl MsgLinuxProcessSocketQueues { + pub const TYPE: u16 = 32516; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgLinuxProcessSocketQueues { + index: _buf.read_u8()?, + pid: _buf.read_u16::()?, + recv_queued: _buf.read_u16::()?, + send_queued: _buf.read_u16::()?, + socket_types: _buf.read_u16::()?, + socket_states: _buf.read_u16::()?, + address_of_largest: ::parser::read_string_limit(_buf, 64)?, + cmdline: ::parser::read_string(_buf)?, + }) + } +} + +// Summary of socket usage across the system +// +// Summaries the socket usage across the system. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgLinuxSocketUsage { + pub avg_queue_depth: u32, + // ^ average socket queue depths across all sockets on the system + pub max_queue_depth: u32, + // ^ the max queue depth seen within the reporting period + pub socket_state_counts: Vec, + // ^ A count for each socket type reported in the `socket_types_reported` + // field, the first entry corresponds to the first enabled bit in + // `types_reported`. + pub socket_type_counts: Vec, + // ^ A count for each socket type reported in the `socket_types_reported` + // field, the first entry corresponds to the first enabled bit in + // `types_reported`. +} + +impl MsgLinuxSocketUsage { + pub const TYPE: u16 = 32517; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgLinuxSocketUsage { + avg_queue_depth: _buf.read_u32::()?, + max_queue_depth: _buf.read_u32::()?, + socket_state_counts: ::parser::read_u16_array_limit(_buf, 16)?, + socket_type_counts: ::parser::read_u16_array_limit(_buf, 16)?, + }) + } +} + +// Summary of processes with large amounts of open file descriptors +// +// Top 10 list of processes with a large number of open file descriptors. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgLinuxProcessFdCount { + pub index: u8, + // ^ sequence of this status message, values from 0-9 + pub pid: u16, + // ^ the PID of the process in question + pub fd_count: u16, + // ^ a count of the number of file descriptors opened by the process + pub cmdline: String, + // ^ the command line of the process in question +} + +impl MsgLinuxProcessFdCount { + pub const TYPE: u16 = 32518; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgLinuxProcessFdCount { + index: _buf.read_u8()?, + pid: _buf.read_u16::()?, + fd_count: _buf.read_u16::()?, + cmdline: ::parser::read_string(_buf)?, + }) + } +} + +// Summary of open file descriptors on the system +// +// Summary of open file descriptors on the system. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgLinuxProcessFdSummary { + pub sys_fd_count: u32, + // ^ count of total FDs open on the system + pub most_opened: String, + // ^ A null delimited list of strings which alternates between a string + // representation of the process count and the file name whose count it + // being reported. That is, in C string syntax + // "32\0/var/log/syslog\012\0/tmp/foo\0" with the end of the list being 2 + // NULL terminators in a row. +} + +impl MsgLinuxProcessFdSummary { + pub const TYPE: u16 = 32519; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgLinuxProcessFdSummary { + sys_fd_count: _buf.read_u32::()?, + most_opened: ::parser::read_string(_buf)?, + }) + } +} diff --git a/rust/sbp/src/messages/logging.rs b/rust/sbp/src/messages/logging.rs index ff25099ab3..34dd32f057 100644 --- a/rust/sbp/src/messages/logging.rs +++ b/rust/sbp/src/messages/logging.rs @@ -12,12 +12,10 @@ // Automatically generated from yaml/swiftnav/sbp/logging.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Logging and debugging messages from the device. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; - +use self::byteorder::{LittleEndian, ReadBytesExt}; // Plaintext logging messages with levels // @@ -29,28 +27,27 @@ use self::byteorder::{LittleEndian,ReadBytesExt}; #[allow(non_snake_case)] pub struct MsgLog { pub level: u8, - // ^ Logging level + // ^ Logging level pub text: String, - // ^ Human-readable string + // ^ Human-readable string } impl MsgLog { pub const TYPE: u16 = 1025; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgLog{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgLog { level: _buf.read_u8()?, - text: ::read_string(_buf)?, - } ) + text: ::parser::read_string(_buf)?, + }) } } - // Wrapper for FWD a separate stream of information over SBP // // This message provides the ability to forward messages over SBP. This may take the form -// of wrapping up SBP messages received by Piksi for logging purposes or wrapping +// of wrapping up SBP messages received by Piksi for logging purposes or wrapping // another protocol with SBP. -// +// // The source identifier indicates from what interface a forwarded stream derived. // The protocol identifier identifies what the expected protocol the forwarded msg contains. // Protocol 0 represents SBP and the remaining values are implementation defined. @@ -59,46 +56,24 @@ impl MsgLog { #[allow(non_snake_case)] pub struct MsgFwd { pub source: u8, - // ^ source identifier + // ^ source identifier pub protocol: u8, - // ^ protocol identifier + // ^ protocol identifier pub fwd_payload: String, - // ^ variable length wrapped binary message + // ^ variable length wrapped binary message } impl MsgFwd { pub const TYPE: u16 = 1026; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgFwd{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgFwd { source: _buf.read_u8()?, protocol: _buf.read_u8()?, - fwd_payload: ::read_string(_buf)?, - } ) - } -} - - -// Tweet -// -// All the news fit to tweet. -// -#[derive(Debug)] -#[allow(non_snake_case)] -pub struct MsgTweet { - pub tweet: String, - // ^ Human-readable string -} - -impl MsgTweet { - pub const TYPE: u16 = 18; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgTweet{ - tweet: ::read_string_limit(_buf, 140)?, - } ) + fwd_payload: ::parser::read_string(_buf)?, + }) } } - // Deprecated // // Deprecated. @@ -107,15 +82,14 @@ impl MsgTweet { #[allow(non_snake_case)] pub struct MsgPrintDep { pub text: String, - // ^ Human-readable string + // ^ Human-readable string } impl MsgPrintDep { pub const TYPE: u16 = 16; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgPrintDep{ - text: ::read_string(_buf)?, - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgPrintDep { + text: ::parser::read_string(_buf)?, + }) } } - diff --git a/rust/sbp/src/messages/mag.rs b/rust/sbp/src/messages/mag.rs index 6b0dfa93d0..74965bfdef 100644 --- a/rust/sbp/src/messages/mag.rs +++ b/rust/sbp/src/messages/mag.rs @@ -12,12 +12,10 @@ // Automatically generated from yaml/swiftnav/sbp/mag.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Magnetometer (mag) messages. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; - +use self::byteorder::{LittleEndian, ReadBytesExt}; // Raw magnetometer data // @@ -27,28 +25,27 @@ use self::byteorder::{LittleEndian,ReadBytesExt}; #[allow(non_snake_case)] pub struct MsgMagRaw { pub tow: u32, - // ^ Milliseconds since start of GPS week. If the high bit is set, the time - // is unknown or invalid. + // ^ Milliseconds since start of GPS week. If the high bit is set, the time + // is unknown or invalid. pub tow_f: u8, - // ^ Milliseconds since start of GPS week, fractional part + // ^ Milliseconds since start of GPS week, fractional part pub mag_x: i16, - // ^ Magnetic field in the body frame X axis + // ^ Magnetic field in the body frame X axis pub mag_y: i16, - // ^ Magnetic field in the body frame Y axis + // ^ Magnetic field in the body frame Y axis pub mag_z: i16, - // ^ Magnetic field in the body frame Z axis + // ^ Magnetic field in the body frame Z axis } impl MsgMagRaw { pub const TYPE: u16 = 2306; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgMagRaw{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgMagRaw { tow: _buf.read_u32::()?, tow_f: _buf.read_u8()?, mag_x: _buf.read_i16::()?, mag_y: _buf.read_i16::()?, mag_z: _buf.read_i16::()?, - } ) + }) } } - diff --git a/rust/sbp/src/messages/mod.rs b/rust/sbp/src/messages/mod.rs index f601d92b35..11fbca7e5b 100644 --- a/rust/sbp/src/messages/mod.rs +++ b/rust/sbp/src/messages/mod.rs @@ -7,470 +7,657 @@ // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, // EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. -pub mod settings; -pub mod user; +pub mod acquisition; +pub mod bootload; +pub mod ext_events; +pub mod file_io; +pub mod flash; +pub mod gnss; +pub mod imu; +pub mod linux; +pub mod logging; pub mod mag; +pub mod navigation; pub mod ndb; -pub mod ext_events; pub mod observation; -pub mod gnss; +pub mod orientation; pub mod piksi; -pub mod ssr; -pub mod acquisition; pub mod sbas; -pub mod bootload; -pub mod logging; -pub mod file_io; -pub mod vehicle; +pub mod settings; +pub mod ssr; pub mod system; -pub mod imu; -pub mod flash; -pub mod orientation; pub mod tracking; -pub mod navigation; -use self::settings::MsgSettingsSave; -use self::settings::MsgSettingsWrite; -use self::settings::MsgSettingsWriteResp; -use self::settings::MsgSettingsReadReq; -use self::settings::MsgSettingsReadResp; -use self::settings::MsgSettingsReadByIndexReq; -use self::settings::MsgSettingsReadByIndexResp; -use self::settings::MsgSettingsReadByIndexDone; -use self::settings::MsgSettingsRegister; -use self::user::MsgUserData; -use self::mag::MsgMagRaw; -use self::ndb::MsgNdbEvent; -use self::ext_events::MsgExtEvent; -use self::observation::MsgObs; -use self::observation::MsgBasePosLLH; -use self::observation::MsgBasePosECEF; -use self::observation::MsgEphemerisGPSDepE; -use self::observation::MsgEphemerisGPS; -use self::observation::MsgEphemerisSbasDepA; -use self::observation::MsgEphemerisGloDepA; -use self::observation::MsgEphemerisSbas; -use self::observation::MsgEphemerisGloDepB; -use self::observation::MsgEphemerisGloDepC; -use self::observation::MsgEphemerisGlo; -use self::observation::MsgEphemerisDepD; -use self::observation::MsgEphemerisDepA; -use self::observation::MsgEphemerisDepB; -use self::observation::MsgEphemerisDepC; -use self::observation::MsgObsDepA; -use self::observation::MsgObsDepB; -use self::observation::MsgObsDepC; -use self::observation::MsgIono; -use self::observation::MsgSvConfigurationGPS; -use self::observation::MsgGroupDelayDepA; -use self::observation::MsgGroupDelayDepB; -use self::observation::MsgGroupDelay; -use self::observation::MsgAlmanacGPSDep; -use self::observation::MsgAlmanacGPS; -use self::observation::MsgAlmanacGloDep; -use self::observation::MsgAlmanacGlo; -use self::observation::MsgGloBiases; -use self::piksi::MsgAlmanac; -use self::piksi::MsgSetTime; -use self::piksi::MsgReset; -use self::piksi::MsgResetDep; -use self::piksi::MsgCwResults; -use self::piksi::MsgCwStart; -use self::piksi::MsgResetFilters; -use self::piksi::MsgInitBase; -use self::piksi::MsgThreadState; -use self::piksi::MsgUartState; -use self::piksi::MsgUartStateDepa; -use self::piksi::MsgIarState; -use self::piksi::MsgMaskSatellite; -use self::piksi::MsgMaskSatelliteDep; -use self::piksi::MsgDeviceMonitor; -use self::piksi::MsgCommandReq; -use self::piksi::MsgCommandResp; -use self::piksi::MsgCommandOutput; -use self::piksi::MsgNetworkStateReq; -use self::piksi::MsgNetworkStateResp; -use self::piksi::MsgNetworkBandwidthUsage; -use self::piksi::MsgSpecanDep; -use self::piksi::MsgSpecan; -use self::ssr::MsgSsrOrbitClock; -use self::ssr::MsgSsrCodeBiases; -use self::ssr::MsgSsrPhaseBiases; +pub mod user; +pub mod vehicle; use self::acquisition::MsgAcqResult; -use self::acquisition::MsgAcqResultDepC; -use self::acquisition::MsgAcqResultDepB; use self::acquisition::MsgAcqResultDepA; +use self::acquisition::MsgAcqResultDepB; +use self::acquisition::MsgAcqResultDepC; use self::acquisition::MsgAcqSvProfile; use self::acquisition::MsgAcqSvProfileDep; -use self::sbas::MsgSbasRaw; +use self::bootload::MsgBootloaderHandshakeDepA; use self::bootload::MsgBootloaderHandshakeReq; use self::bootload::MsgBootloaderHandshakeResp; use self::bootload::MsgBootloaderJumpToApp; use self::bootload::MsgNapDeviceDnaReq; use self::bootload::MsgNapDeviceDnaResp; -use self::bootload::MsgBootloaderHandshakeDepA; -use self::logging::MsgLog; -use self::logging::MsgFwd; -use self::logging::MsgTweet; -use self::logging::MsgPrintDep; -use self::file_io::MsgFileioReadReq; -use self::file_io::MsgFileioReadResp; +use self::ext_events::MsgExtEvent; +use self::file_io::MsgFileioConfigReq; +use self::file_io::MsgFileioConfigResp; use self::file_io::MsgFileioReadDirReq; use self::file_io::MsgFileioReadDirResp; +use self::file_io::MsgFileioReadReq; +use self::file_io::MsgFileioReadResp; use self::file_io::MsgFileioRemove; use self::file_io::MsgFileioWriteReq; use self::file_io::MsgFileioWriteResp; -use self::vehicle::MsgOdometry; -use self::system::MsgStartup; -use self::system::MsgDgnssStatus; -use self::system::MsgHeartbeat; -use self::system::MsgInsStatus; -use self::imu::MsgImuRaw; -use self::imu::MsgImuAux; -use self::flash::MsgFlashProgram; use self::flash::MsgFlashDone; +use self::flash::MsgFlashErase; +use self::flash::MsgFlashProgram; use self::flash::MsgFlashReadReq; use self::flash::MsgFlashReadResp; -use self::flash::MsgFlashErase; +use self::flash::MsgM25FlashWriteStatus; use self::flash::MsgStmFlashLockSector; use self::flash::MsgStmFlashUnlockSector; use self::flash::MsgStmUniqueIdReq; use self::flash::MsgStmUniqueIdResp; -use self::flash::MsgM25FlashWriteStatus; -use self::orientation::MsgBaselineHeading; -use self::orientation::MsgOrientQuat; -use self::orientation::MsgOrientEuler; -use self::orientation::MsgAngularRate; -use self::tracking::MsgTrackingStateDetailedDepA; -use self::tracking::MsgTrackingStateDetailedDep; -use self::tracking::MsgTrackingState; -use self::tracking::MsgTrackingIq; -use self::tracking::MsgTrackingIqDep; -use self::tracking::MsgTrackingStateDepA; -use self::tracking::MsgTrackingStateDepB; -use self::navigation::MsgGPSTime; -use self::navigation::MsgUtcTime; +use self::imu::MsgImuAux; +use self::imu::MsgImuRaw; +use self::linux::MsgLinuxCpuState; +use self::linux::MsgLinuxMemState; +use self::linux::MsgLinuxProcessFdCount; +use self::linux::MsgLinuxProcessFdSummary; +use self::linux::MsgLinuxProcessSocketCounts; +use self::linux::MsgLinuxProcessSocketQueues; +use self::linux::MsgLinuxSocketUsage; +use self::linux::MsgLinuxSysState; +use self::logging::MsgFwd; +use self::logging::MsgLog; +use self::logging::MsgPrintDep; +use self::mag::MsgMagRaw; +use self::navigation::MsgAgeCorrections; +use self::navigation::MsgBaselineECEF; +use self::navigation::MsgBaselineECEFDepA; +use self::navigation::MsgBaselineHeadingDepA; +use self::navigation::MsgBaselineNED; +use self::navigation::MsgBaselineNEDDepA; use self::navigation::MsgDops; +use self::navigation::MsgDopsDepA; +use self::navigation::MsgGPSTime; +use self::navigation::MsgGPSTimeDepA; use self::navigation::MsgPosECEF; use self::navigation::MsgPosECEFCov; +use self::navigation::MsgPosECEFDepA; use self::navigation::MsgPosLLH; use self::navigation::MsgPosLLHCov; -use self::navigation::MsgBaselineECEF; -use self::navigation::MsgBaselineNED; +use self::navigation::MsgPosLLHDepA; +use self::navigation::MsgUtcTime; +use self::navigation::MsgVelBody; use self::navigation::MsgVelECEF; use self::navigation::MsgVelECEFCov; +use self::navigation::MsgVelECEFDepA; use self::navigation::MsgVelNED; use self::navigation::MsgVelNEDCov; -use self::navigation::MsgVelBody; -use self::navigation::MsgAgeCorrections; -use self::navigation::MsgGPSTimeDepA; -use self::navigation::MsgDopsDepA; -use self::navigation::MsgPosECEFDepA; -use self::navigation::MsgPosLLHDepA; -use self::navigation::MsgBaselineECEFDepA; -use self::navigation::MsgBaselineNEDDepA; -use self::navigation::MsgVelECEFDepA; use self::navigation::MsgVelNEDDepA; -use self::navigation::MsgBaselineHeadingDepA; +use self::ndb::MsgNdbEvent; +use self::observation::MsgAlmanacGPS; +use self::observation::MsgAlmanacGPSDep; +use self::observation::MsgAlmanacGlo; +use self::observation::MsgAlmanacGloDep; +use self::observation::MsgBasePosECEF; +use self::observation::MsgBasePosLLH; +use self::observation::MsgEphemerisBds; +use self::observation::MsgEphemerisDepA; +use self::observation::MsgEphemerisDepB; +use self::observation::MsgEphemerisDepC; +use self::observation::MsgEphemerisDepD; +use self::observation::MsgEphemerisGPS; +use self::observation::MsgEphemerisGPSDepE; +use self::observation::MsgEphemerisGPSDepF; +use self::observation::MsgEphemerisGal; +use self::observation::MsgEphemerisGalDepA; +use self::observation::MsgEphemerisGlo; +use self::observation::MsgEphemerisGloDepA; +use self::observation::MsgEphemerisGloDepB; +use self::observation::MsgEphemerisGloDepC; +use self::observation::MsgEphemerisGloDepD; +use self::observation::MsgEphemerisQzss; +use self::observation::MsgEphemerisSbas; +use self::observation::MsgEphemerisSbasDepA; +use self::observation::MsgEphemerisSbasDepB; +use self::observation::MsgGloBiases; +use self::observation::MsgGnssCapb; +use self::observation::MsgGroupDelay; +use self::observation::MsgGroupDelayDepA; +use self::observation::MsgGroupDelayDepB; +use self::observation::MsgIono; +use self::observation::MsgObs; +use self::observation::MsgObsDepA; +use self::observation::MsgObsDepB; +use self::observation::MsgObsDepC; +use self::observation::MsgOsr; +use self::observation::MsgSvAzEl; +use self::observation::MsgSvConfigurationGPSDep; +use self::orientation::MsgAngularRate; +use self::orientation::MsgBaselineHeading; +use self::orientation::MsgOrientEuler; +use self::orientation::MsgOrientQuat; +use self::piksi::MsgAlmanac; +use self::piksi::MsgCellModemStatus; +use self::piksi::MsgCommandOutput; +use self::piksi::MsgCommandReq; +use self::piksi::MsgCommandResp; +use self::piksi::MsgCwResults; +use self::piksi::MsgCwStart; +use self::piksi::MsgDeviceMonitor; +use self::piksi::MsgFrontEndGain; +use self::piksi::MsgIarState; +use self::piksi::MsgInitBaseDep; +use self::piksi::MsgMaskSatellite; +use self::piksi::MsgMaskSatelliteDep; +use self::piksi::MsgNetworkBandwidthUsage; +use self::piksi::MsgNetworkStateReq; +use self::piksi::MsgNetworkStateResp; +use self::piksi::MsgReset; +use self::piksi::MsgResetDep; +use self::piksi::MsgResetFilters; +use self::piksi::MsgSetTime; +use self::piksi::MsgSpecan; +use self::piksi::MsgSpecanDep; +use self::piksi::MsgThreadState; +use self::piksi::MsgUartState; +use self::piksi::MsgUartStateDepa; +use self::sbas::MsgSbasRaw; +use self::settings::MsgSettingsReadByIndexDone; +use self::settings::MsgSettingsReadByIndexReq; +use self::settings::MsgSettingsReadByIndexResp; +use self::settings::MsgSettingsReadReq; +use self::settings::MsgSettingsReadResp; +use self::settings::MsgSettingsRegister; +use self::settings::MsgSettingsRegisterResp; +use self::settings::MsgSettingsSave; +use self::settings::MsgSettingsWrite; +use self::settings::MsgSettingsWriteResp; +use self::ssr::MsgSsrCodeBiases; +use self::ssr::MsgSsrGridDefinition; +use self::ssr::MsgSsrGriddedCorrection; +use self::ssr::MsgSsrOrbitClock; +use self::ssr::MsgSsrOrbitClockDepA; +use self::ssr::MsgSsrPhaseBiases; +use self::ssr::MsgSsrStecCorrection; +use self::system::MsgCsacTelemetry; +use self::system::MsgCsacTelemetryLabels; +use self::system::MsgDgnssStatus; +use self::system::MsgHeartbeat; +use self::system::MsgInsStatus; +use self::system::MsgStartup; +use self::tracking::MsgMeasurementState; +use self::tracking::MsgTrackingIq; +use self::tracking::MsgTrackingIqDepA; +use self::tracking::MsgTrackingIqDepB; +use self::tracking::MsgTrackingState; +use self::tracking::MsgTrackingStateDepA; +use self::tracking::MsgTrackingStateDepB; +use self::tracking::MsgTrackingStateDetailedDep; +use self::tracking::MsgTrackingStateDetailedDepA; +use self::user::MsgUserData; +use self::vehicle::MsgOdometry; #[derive(Debug)] pub enum SBP { Unknown { id: u16 }, - MsgVelNEDDepA( MsgVelNEDDepA ), - MsgBaselineHeadingDepA( MsgBaselineHeadingDepA ), - MsgPosECEF( MsgPosECEF ), - MsgPosECEFCov( MsgPosECEFCov ), - MsgPosLLH( MsgPosLLH ), - MsgPosLLHCov( MsgPosLLHCov ), - MsgBaselineECEF( MsgBaselineECEF ), - MsgBaselineNED( MsgBaselineNED ), - MsgVelECEF( MsgVelECEF ), - MsgVelECEFCov( MsgVelECEFCov ), - MsgVelNED( MsgVelNED ), - MsgVelNEDCov( MsgVelNEDCov ), - MsgVelBody( MsgVelBody ), - MsgAgeCorrections( MsgAgeCorrections ), - MsgGPSTimeDepA( MsgGPSTimeDepA ), - MsgDopsDepA( MsgDopsDepA ), - MsgPosECEFDepA( MsgPosECEFDepA ), - MsgPosLLHDepA( MsgPosLLHDepA ), - MsgBaselineECEFDepA( MsgBaselineECEFDepA ), - MsgBaselineNEDDepA( MsgBaselineNEDDepA ), - MsgVelECEFDepA( MsgVelECEFDepA ), - MsgFlashReadReq( MsgFlashReadReq ), - MsgFlashReadResp( MsgFlashReadResp ), - MsgFlashErase( MsgFlashErase ), - MsgStmFlashLockSector( MsgStmFlashLockSector ), - MsgStmFlashUnlockSector( MsgStmFlashUnlockSector ), - MsgStmUniqueIdReq( MsgStmUniqueIdReq ), - MsgStmUniqueIdResp( MsgStmUniqueIdResp ), - MsgM25FlashWriteStatus( MsgM25FlashWriteStatus ), - MsgBaselineHeading( MsgBaselineHeading ), - MsgOrientQuat( MsgOrientQuat ), - MsgOrientEuler( MsgOrientEuler ), - MsgAngularRate( MsgAngularRate ), - MsgTrackingStateDetailedDepA( MsgTrackingStateDetailedDepA ), - MsgTrackingStateDetailedDep( MsgTrackingStateDetailedDep ), - MsgTrackingState( MsgTrackingState ), - MsgTrackingIq( MsgTrackingIq ), - MsgTrackingIqDep( MsgTrackingIqDep ), - MsgTrackingStateDepA( MsgTrackingStateDepA ), - MsgTrackingStateDepB( MsgTrackingStateDepB ), - MsgGPSTime( MsgGPSTime ), - MsgUtcTime( MsgUtcTime ), - MsgDops( MsgDops ), - MsgSsrOrbitClock( MsgSsrOrbitClock ), - MsgSsrCodeBiases( MsgSsrCodeBiases ), - MsgSsrPhaseBiases( MsgSsrPhaseBiases ), - MsgAcqResult( MsgAcqResult ), - MsgAcqResultDepC( MsgAcqResultDepC ), - MsgAcqResultDepB( MsgAcqResultDepB ), - MsgAcqResultDepA( MsgAcqResultDepA ), - MsgAcqSvProfile( MsgAcqSvProfile ), - MsgAcqSvProfileDep( MsgAcqSvProfileDep ), - MsgSbasRaw( MsgSbasRaw ), - MsgBootloaderHandshakeReq( MsgBootloaderHandshakeReq ), - MsgBootloaderHandshakeResp( MsgBootloaderHandshakeResp ), - MsgBootloaderJumpToApp( MsgBootloaderJumpToApp ), - MsgNapDeviceDnaReq( MsgNapDeviceDnaReq ), - MsgNapDeviceDnaResp( MsgNapDeviceDnaResp ), - MsgBootloaderHandshakeDepA( MsgBootloaderHandshakeDepA ), - MsgLog( MsgLog ), - MsgFwd( MsgFwd ), - MsgTweet( MsgTweet ), - MsgPrintDep( MsgPrintDep ), - MsgFileioReadReq( MsgFileioReadReq ), - MsgFileioReadResp( MsgFileioReadResp ), - MsgFileioReadDirReq( MsgFileioReadDirReq ), - MsgFileioReadDirResp( MsgFileioReadDirResp ), - MsgFileioRemove( MsgFileioRemove ), - MsgFileioWriteReq( MsgFileioWriteReq ), - MsgFileioWriteResp( MsgFileioWriteResp ), - MsgOdometry( MsgOdometry ), - MsgStartup( MsgStartup ), - MsgDgnssStatus( MsgDgnssStatus ), - MsgHeartbeat( MsgHeartbeat ), - MsgInsStatus( MsgInsStatus ), - MsgImuRaw( MsgImuRaw ), - MsgImuAux( MsgImuAux ), - MsgFlashProgram( MsgFlashProgram ), - MsgFlashDone( MsgFlashDone ), - MsgGroupDelayDepA( MsgGroupDelayDepA ), - MsgGroupDelayDepB( MsgGroupDelayDepB ), - MsgGroupDelay( MsgGroupDelay ), - MsgAlmanacGPSDep( MsgAlmanacGPSDep ), - MsgAlmanacGPS( MsgAlmanacGPS ), - MsgAlmanacGloDep( MsgAlmanacGloDep ), - MsgAlmanacGlo( MsgAlmanacGlo ), - MsgGloBiases( MsgGloBiases ), - MsgAlmanac( MsgAlmanac ), - MsgSetTime( MsgSetTime ), - MsgReset( MsgReset ), - MsgResetDep( MsgResetDep ), - MsgCwResults( MsgCwResults ), - MsgCwStart( MsgCwStart ), - MsgResetFilters( MsgResetFilters ), - MsgInitBase( MsgInitBase ), - MsgThreadState( MsgThreadState ), - MsgUartState( MsgUartState ), - MsgSpecan( MsgSpecan ), - MsgEphemerisGlo( MsgEphemerisGlo ), - MsgEphemerisDepD( MsgEphemerisDepD ), - MsgEphemerisDepA( MsgEphemerisDepA ), - MsgEphemerisDepB( MsgEphemerisDepB ), - MsgEphemerisDepC( MsgEphemerisDepC ), - MsgObsDepA( MsgObsDepA ), - MsgObsDepB( MsgObsDepB ), - MsgObsDepC( MsgObsDepC ), - MsgIono( MsgIono ), - MsgSvConfigurationGPS( MsgSvConfigurationGPS ), - MsgMagRaw( MsgMagRaw ), - MsgNdbEvent( MsgNdbEvent ), - MsgExtEvent( MsgExtEvent ), - MsgObs( MsgObs ), - MsgBasePosLLH( MsgBasePosLLH ), - MsgBasePosECEF( MsgBasePosECEF ), - MsgEphemerisGPSDepE( MsgEphemerisGPSDepE ), - MsgEphemerisGPS( MsgEphemerisGPS ), - MsgEphemerisSbasDepA( MsgEphemerisSbasDepA ), - MsgEphemerisGloDepA( MsgEphemerisGloDepA ), - MsgEphemerisSbas( MsgEphemerisSbas ), - MsgEphemerisGloDepB( MsgEphemerisGloDepB ), - MsgEphemerisGloDepC( MsgEphemerisGloDepC ), - MsgSettingsSave( MsgSettingsSave ), - MsgSettingsWrite( MsgSettingsWrite ), - MsgSettingsWriteResp( MsgSettingsWriteResp ), - MsgSettingsReadReq( MsgSettingsReadReq ), - MsgSettingsReadResp( MsgSettingsReadResp ), - MsgSettingsReadByIndexReq( MsgSettingsReadByIndexReq ), - MsgSettingsReadByIndexResp( MsgSettingsReadByIndexResp ), - MsgSettingsReadByIndexDone( MsgSettingsReadByIndexDone ), - MsgSettingsRegister( MsgSettingsRegister ), - MsgUserData( MsgUserData ), - MsgNetworkBandwidthUsage( MsgNetworkBandwidthUsage ), - MsgSpecanDep( MsgSpecanDep ), - MsgCommandReq( MsgCommandReq ), - MsgCommandResp( MsgCommandResp ), - MsgCommandOutput( MsgCommandOutput ), - MsgNetworkStateReq( MsgNetworkStateReq ), - MsgNetworkStateResp( MsgNetworkStateResp ), - MsgUartStateDepa( MsgUartStateDepa ), - MsgIarState( MsgIarState ), - MsgMaskSatellite( MsgMaskSatellite ), - MsgMaskSatelliteDep( MsgMaskSatelliteDep ), - MsgDeviceMonitor( MsgDeviceMonitor ), + MsgSsrOrbitClock(MsgSsrOrbitClock), + MsgSsrOrbitClockDepA(MsgSsrOrbitClockDepA), + MsgSsrCodeBiases(MsgSsrCodeBiases), + MsgSsrPhaseBiases(MsgSsrPhaseBiases), + MsgSsrStecCorrection(MsgSsrStecCorrection), + MsgSsrGriddedCorrection(MsgSsrGriddedCorrection), + MsgSsrGridDefinition(MsgSsrGridDefinition), + MsgNdbEvent(MsgNdbEvent), + MsgImuRaw(MsgImuRaw), + MsgImuAux(MsgImuAux), + MsgUserData(MsgUserData), + MsgOdometry(MsgOdometry), + MsgSbasRaw(MsgSbasRaw), + MsgAcqResult(MsgAcqResult), + MsgAcqResultDepC(MsgAcqResultDepC), + MsgAcqResultDepB(MsgAcqResultDepB), + MsgAcqResultDepA(MsgAcqResultDepA), + MsgAcqSvProfile(MsgAcqSvProfile), + MsgAcqSvProfileDep(MsgAcqSvProfileDep), + MsgSettingsSave(MsgSettingsSave), + MsgSettingsWrite(MsgSettingsWrite), + MsgSettingsWriteResp(MsgSettingsWriteResp), + MsgSettingsReadReq(MsgSettingsReadReq), + MsgSettingsReadResp(MsgSettingsReadResp), + MsgSettingsReadByIndexReq(MsgSettingsReadByIndexReq), + MsgSettingsReadByIndexResp(MsgSettingsReadByIndexResp), + MsgSettingsReadByIndexDone(MsgSettingsReadByIndexDone), + MsgSettingsRegister(MsgSettingsRegister), + MsgSettingsRegisterResp(MsgSettingsRegisterResp), + MsgFileioReadReq(MsgFileioReadReq), + MsgFileioReadResp(MsgFileioReadResp), + MsgFileioReadDirReq(MsgFileioReadDirReq), + MsgFileioReadDirResp(MsgFileioReadDirResp), + MsgFileioRemove(MsgFileioRemove), + MsgFileioWriteReq(MsgFileioWriteReq), + MsgFileioWriteResp(MsgFileioWriteResp), + MsgFileioConfigReq(MsgFileioConfigReq), + MsgFileioConfigResp(MsgFileioConfigResp), + MsgStartup(MsgStartup), + MsgDgnssStatus(MsgDgnssStatus), + MsgHeartbeat(MsgHeartbeat), + MsgInsStatus(MsgInsStatus), + MsgCsacTelemetry(MsgCsacTelemetry), + MsgCsacTelemetryLabels(MsgCsacTelemetryLabels), + MsgLinuxCpuState(MsgLinuxCpuState), + MsgLinuxMemState(MsgLinuxMemState), + MsgLinuxSysState(MsgLinuxSysState), + MsgLinuxProcessSocketCounts(MsgLinuxProcessSocketCounts), + MsgLinuxProcessSocketQueues(MsgLinuxProcessSocketQueues), + MsgLinuxSocketUsage(MsgLinuxSocketUsage), + MsgLinuxProcessFdCount(MsgLinuxProcessFdCount), + MsgLinuxProcessFdSummary(MsgLinuxProcessFdSummary), + MsgExtEvent(MsgExtEvent), + MsgObs(MsgObs), + MsgBasePosLLH(MsgBasePosLLH), + MsgBasePosECEF(MsgBasePosECEF), + MsgEphemerisGPSDepE(MsgEphemerisGPSDepE), + MsgEphemerisGPSDepF(MsgEphemerisGPSDepF), + MsgEphemerisGPS(MsgEphemerisGPS), + MsgEphemerisQzss(MsgEphemerisQzss), + MsgEphemerisBds(MsgEphemerisBds), + MsgEphemerisGalDepA(MsgEphemerisGalDepA), + MsgEphemerisGal(MsgEphemerisGal), + MsgEphemerisSbasDepA(MsgEphemerisSbasDepA), + MsgEphemerisGloDepA(MsgEphemerisGloDepA), + MsgEphemerisSbasDepB(MsgEphemerisSbasDepB), + MsgEphemerisSbas(MsgEphemerisSbas), + MsgEphemerisGloDepB(MsgEphemerisGloDepB), + MsgEphemerisGloDepC(MsgEphemerisGloDepC), + MsgEphemerisGloDepD(MsgEphemerisGloDepD), + MsgEphemerisGlo(MsgEphemerisGlo), + MsgEphemerisDepD(MsgEphemerisDepD), + MsgEphemerisDepA(MsgEphemerisDepA), + MsgEphemerisDepB(MsgEphemerisDepB), + MsgEphemerisDepC(MsgEphemerisDepC), + MsgObsDepA(MsgObsDepA), + MsgObsDepB(MsgObsDepB), + MsgObsDepC(MsgObsDepC), + MsgIono(MsgIono), + MsgSvConfigurationGPSDep(MsgSvConfigurationGPSDep), + MsgGnssCapb(MsgGnssCapb), + MsgGroupDelayDepA(MsgGroupDelayDepA), + MsgGroupDelayDepB(MsgGroupDelayDepB), + MsgGroupDelay(MsgGroupDelay), + MsgAlmanacGPSDep(MsgAlmanacGPSDep), + MsgAlmanacGPS(MsgAlmanacGPS), + MsgAlmanacGloDep(MsgAlmanacGloDep), + MsgAlmanacGlo(MsgAlmanacGlo), + MsgGloBiases(MsgGloBiases), + MsgSvAzEl(MsgSvAzEl), + MsgOsr(MsgOsr), + MsgFlashProgram(MsgFlashProgram), + MsgFlashDone(MsgFlashDone), + MsgFlashReadReq(MsgFlashReadReq), + MsgFlashReadResp(MsgFlashReadResp), + MsgFlashErase(MsgFlashErase), + MsgStmFlashLockSector(MsgStmFlashLockSector), + MsgStmFlashUnlockSector(MsgStmFlashUnlockSector), + MsgStmUniqueIdReq(MsgStmUniqueIdReq), + MsgStmUniqueIdResp(MsgStmUniqueIdResp), + MsgM25FlashWriteStatus(MsgM25FlashWriteStatus), + MsgGPSTime(MsgGPSTime), + MsgUtcTime(MsgUtcTime), + MsgDops(MsgDops), + MsgPosECEF(MsgPosECEF), + MsgPosECEFCov(MsgPosECEFCov), + MsgPosLLH(MsgPosLLH), + MsgPosLLHCov(MsgPosLLHCov), + MsgBaselineECEF(MsgBaselineECEF), + MsgBaselineNED(MsgBaselineNED), + MsgVelECEF(MsgVelECEF), + MsgVelECEFCov(MsgVelECEFCov), + MsgVelNED(MsgVelNED), + MsgVelNEDCov(MsgVelNEDCov), + MsgVelBody(MsgVelBody), + MsgAgeCorrections(MsgAgeCorrections), + MsgGPSTimeDepA(MsgGPSTimeDepA), + MsgDopsDepA(MsgDopsDepA), + MsgPosECEFDepA(MsgPosECEFDepA), + MsgPosLLHDepA(MsgPosLLHDepA), + MsgBaselineECEFDepA(MsgBaselineECEFDepA), + MsgBaselineNEDDepA(MsgBaselineNEDDepA), + MsgVelECEFDepA(MsgVelECEFDepA), + MsgVelNEDDepA(MsgVelNEDDepA), + MsgBaselineHeadingDepA(MsgBaselineHeadingDepA), + MsgBaselineHeading(MsgBaselineHeading), + MsgOrientQuat(MsgOrientQuat), + MsgOrientEuler(MsgOrientEuler), + MsgAngularRate(MsgAngularRate), + MsgTrackingStateDetailedDepA(MsgTrackingStateDetailedDepA), + MsgTrackingStateDetailedDep(MsgTrackingStateDetailedDep), + MsgTrackingState(MsgTrackingState), + MsgMeasurementState(MsgMeasurementState), + MsgTrackingIq(MsgTrackingIq), + MsgTrackingIqDepB(MsgTrackingIqDepB), + MsgTrackingIqDepA(MsgTrackingIqDepA), + MsgTrackingStateDepA(MsgTrackingStateDepA), + MsgTrackingStateDepB(MsgTrackingStateDepB), + MsgLog(MsgLog), + MsgFwd(MsgFwd), + MsgPrintDep(MsgPrintDep), + MsgBootloaderHandshakeReq(MsgBootloaderHandshakeReq), + MsgBootloaderHandshakeResp(MsgBootloaderHandshakeResp), + MsgBootloaderJumpToApp(MsgBootloaderJumpToApp), + MsgNapDeviceDnaReq(MsgNapDeviceDnaReq), + MsgNapDeviceDnaResp(MsgNapDeviceDnaResp), + MsgBootloaderHandshakeDepA(MsgBootloaderHandshakeDepA), + MsgAlmanac(MsgAlmanac), + MsgSetTime(MsgSetTime), + MsgReset(MsgReset), + MsgResetDep(MsgResetDep), + MsgCwResults(MsgCwResults), + MsgCwStart(MsgCwStart), + MsgResetFilters(MsgResetFilters), + MsgInitBaseDep(MsgInitBaseDep), + MsgThreadState(MsgThreadState), + MsgUartState(MsgUartState), + MsgUartStateDepa(MsgUartStateDepa), + MsgIarState(MsgIarState), + MsgMaskSatellite(MsgMaskSatellite), + MsgMaskSatelliteDep(MsgMaskSatelliteDep), + MsgDeviceMonitor(MsgDeviceMonitor), + MsgCommandReq(MsgCommandReq), + MsgCommandResp(MsgCommandResp), + MsgCommandOutput(MsgCommandOutput), + MsgNetworkStateReq(MsgNetworkStateReq), + MsgNetworkStateResp(MsgNetworkStateResp), + MsgNetworkBandwidthUsage(MsgNetworkBandwidthUsage), + MsgCellModemStatus(MsgCellModemStatus), + MsgSpecanDep(MsgSpecanDep), + MsgSpecan(MsgSpecan), + MsgFrontEndGain(MsgFrontEndGain), + MsgMagRaw(MsgMagRaw), } impl SBP { pub fn parse(id: u16, payload: &mut &[u8]) -> Result { let x: Result = match id { - 517 => Ok(SBP::MsgVelNEDDepA( MsgVelNEDDepA::parse(payload)? )), - 519 => Ok(SBP::MsgBaselineHeadingDepA( MsgBaselineHeadingDepA::parse(payload)? )), - 521 => Ok(SBP::MsgPosECEF( MsgPosECEF::parse(payload)? )), - 532 => Ok(SBP::MsgPosECEFCov( MsgPosECEFCov::parse(payload)? )), - 522 => Ok(SBP::MsgPosLLH( MsgPosLLH::parse(payload)? )), - 529 => Ok(SBP::MsgPosLLHCov( MsgPosLLHCov::parse(payload)? )), - 523 => Ok(SBP::MsgBaselineECEF( MsgBaselineECEF::parse(payload)? )), - 524 => Ok(SBP::MsgBaselineNED( MsgBaselineNED::parse(payload)? )), - 525 => Ok(SBP::MsgVelECEF( MsgVelECEF::parse(payload)? )), - 533 => Ok(SBP::MsgVelECEFCov( MsgVelECEFCov::parse(payload)? )), - 526 => Ok(SBP::MsgVelNED( MsgVelNED::parse(payload)? )), - 530 => Ok(SBP::MsgVelNEDCov( MsgVelNEDCov::parse(payload)? )), - 531 => Ok(SBP::MsgVelBody( MsgVelBody::parse(payload)? )), - 528 => Ok(SBP::MsgAgeCorrections( MsgAgeCorrections::parse(payload)? )), - 256 => Ok(SBP::MsgGPSTimeDepA( MsgGPSTimeDepA::parse(payload)? )), - 518 => Ok(SBP::MsgDopsDepA( MsgDopsDepA::parse(payload)? )), - 512 => Ok(SBP::MsgPosECEFDepA( MsgPosECEFDepA::parse(payload)? )), - 513 => Ok(SBP::MsgPosLLHDepA( MsgPosLLHDepA::parse(payload)? )), - 514 => Ok(SBP::MsgBaselineECEFDepA( MsgBaselineECEFDepA::parse(payload)? )), - 515 => Ok(SBP::MsgBaselineNEDDepA( MsgBaselineNEDDepA::parse(payload)? )), - 516 => Ok(SBP::MsgVelECEFDepA( MsgVelECEFDepA::parse(payload)? )), - 231 => Ok(SBP::MsgFlashReadReq( MsgFlashReadReq::parse(payload)? )), - 225 => Ok(SBP::MsgFlashReadResp( MsgFlashReadResp::parse(payload)? )), - 226 => Ok(SBP::MsgFlashErase( MsgFlashErase::parse(payload)? )), - 227 => Ok(SBP::MsgStmFlashLockSector( MsgStmFlashLockSector::parse(payload)? )), - 228 => Ok(SBP::MsgStmFlashUnlockSector( MsgStmFlashUnlockSector::parse(payload)? )), - 232 => Ok(SBP::MsgStmUniqueIdReq( MsgStmUniqueIdReq::parse(payload)? )), - 229 => Ok(SBP::MsgStmUniqueIdResp( MsgStmUniqueIdResp::parse(payload)? )), - 243 => Ok(SBP::MsgM25FlashWriteStatus( MsgM25FlashWriteStatus::parse(payload)? )), - 527 => Ok(SBP::MsgBaselineHeading( MsgBaselineHeading::parse(payload)? )), - 544 => Ok(SBP::MsgOrientQuat( MsgOrientQuat::parse(payload)? )), - 545 => Ok(SBP::MsgOrientEuler( MsgOrientEuler::parse(payload)? )), - 546 => Ok(SBP::MsgAngularRate( MsgAngularRate::parse(payload)? )), - 33 => Ok(SBP::MsgTrackingStateDetailedDepA( MsgTrackingStateDetailedDepA::parse(payload)? )), - 17 => Ok(SBP::MsgTrackingStateDetailedDep( MsgTrackingStateDetailedDep::parse(payload)? )), - 65 => Ok(SBP::MsgTrackingState( MsgTrackingState::parse(payload)? )), - 44 => Ok(SBP::MsgTrackingIq( MsgTrackingIq::parse(payload)? )), - 28 => Ok(SBP::MsgTrackingIqDep( MsgTrackingIqDep::parse(payload)? )), - 22 => Ok(SBP::MsgTrackingStateDepA( MsgTrackingStateDepA::parse(payload)? )), - 19 => Ok(SBP::MsgTrackingStateDepB( MsgTrackingStateDepB::parse(payload)? )), - 258 => Ok(SBP::MsgGPSTime( MsgGPSTime::parse(payload)? )), - 259 => Ok(SBP::MsgUtcTime( MsgUtcTime::parse(payload)? )), - 520 => Ok(SBP::MsgDops( MsgDops::parse(payload)? )), - 1500 => Ok(SBP::MsgSsrOrbitClock( MsgSsrOrbitClock::parse(payload)? )), - 1505 => Ok(SBP::MsgSsrCodeBiases( MsgSsrCodeBiases::parse(payload)? )), - 1510 => Ok(SBP::MsgSsrPhaseBiases( MsgSsrPhaseBiases::parse(payload)? )), - 47 => Ok(SBP::MsgAcqResult( MsgAcqResult::parse(payload)? )), - 31 => Ok(SBP::MsgAcqResultDepC( MsgAcqResultDepC::parse(payload)? )), - 20 => Ok(SBP::MsgAcqResultDepB( MsgAcqResultDepB::parse(payload)? )), - 21 => Ok(SBP::MsgAcqResultDepA( MsgAcqResultDepA::parse(payload)? )), - 46 => Ok(SBP::MsgAcqSvProfile( MsgAcqSvProfile::parse(payload)? )), - 30 => Ok(SBP::MsgAcqSvProfileDep( MsgAcqSvProfileDep::parse(payload)? )), - 30583 => Ok(SBP::MsgSbasRaw( MsgSbasRaw::parse(payload)? )), - 179 => Ok(SBP::MsgBootloaderHandshakeReq( MsgBootloaderHandshakeReq::parse(payload)? )), - 180 => Ok(SBP::MsgBootloaderHandshakeResp( MsgBootloaderHandshakeResp::parse(payload)? )), - 177 => Ok(SBP::MsgBootloaderJumpToApp( MsgBootloaderJumpToApp::parse(payload)? )), - 222 => Ok(SBP::MsgNapDeviceDnaReq( MsgNapDeviceDnaReq::parse(payload)? )), - 221 => Ok(SBP::MsgNapDeviceDnaResp( MsgNapDeviceDnaResp::parse(payload)? )), - 176 => Ok(SBP::MsgBootloaderHandshakeDepA( MsgBootloaderHandshakeDepA::parse(payload)? )), - 1025 => Ok(SBP::MsgLog( MsgLog::parse(payload)? )), - 1026 => Ok(SBP::MsgFwd( MsgFwd::parse(payload)? )), - 18 => Ok(SBP::MsgTweet( MsgTweet::parse(payload)? )), - 16 => Ok(SBP::MsgPrintDep( MsgPrintDep::parse(payload)? )), - 168 => Ok(SBP::MsgFileioReadReq( MsgFileioReadReq::parse(payload)? )), - 163 => Ok(SBP::MsgFileioReadResp( MsgFileioReadResp::parse(payload)? )), - 169 => Ok(SBP::MsgFileioReadDirReq( MsgFileioReadDirReq::parse(payload)? )), - 170 => Ok(SBP::MsgFileioReadDirResp( MsgFileioReadDirResp::parse(payload)? )), - 172 => Ok(SBP::MsgFileioRemove( MsgFileioRemove::parse(payload)? )), - 173 => Ok(SBP::MsgFileioWriteReq( MsgFileioWriteReq::parse(payload)? )), - 171 => Ok(SBP::MsgFileioWriteResp( MsgFileioWriteResp::parse(payload)? )), - 2307 => Ok(SBP::MsgOdometry( MsgOdometry::parse(payload)? )), - 65280 => Ok(SBP::MsgStartup( MsgStartup::parse(payload)? )), - 65282 => Ok(SBP::MsgDgnssStatus( MsgDgnssStatus::parse(payload)? )), - 65535 => Ok(SBP::MsgHeartbeat( MsgHeartbeat::parse(payload)? )), - 65283 => Ok(SBP::MsgInsStatus( MsgInsStatus::parse(payload)? )), - 2304 => Ok(SBP::MsgImuRaw( MsgImuRaw::parse(payload)? )), - 2305 => Ok(SBP::MsgImuAux( MsgImuAux::parse(payload)? )), - 230 => Ok(SBP::MsgFlashProgram( MsgFlashProgram::parse(payload)? )), - 224 => Ok(SBP::MsgFlashDone( MsgFlashDone::parse(payload)? )), - 146 => Ok(SBP::MsgGroupDelayDepA( MsgGroupDelayDepA::parse(payload)? )), - 147 => Ok(SBP::MsgGroupDelayDepB( MsgGroupDelayDepB::parse(payload)? )), - 148 => Ok(SBP::MsgGroupDelay( MsgGroupDelay::parse(payload)? )), - 112 => Ok(SBP::MsgAlmanacGPSDep( MsgAlmanacGPSDep::parse(payload)? )), - 114 => Ok(SBP::MsgAlmanacGPS( MsgAlmanacGPS::parse(payload)? )), - 113 => Ok(SBP::MsgAlmanacGloDep( MsgAlmanacGloDep::parse(payload)? )), - 115 => Ok(SBP::MsgAlmanacGlo( MsgAlmanacGlo::parse(payload)? )), - 117 => Ok(SBP::MsgGloBiases( MsgGloBiases::parse(payload)? )), - 105 => Ok(SBP::MsgAlmanac( MsgAlmanac::parse(payload)? )), - 104 => Ok(SBP::MsgSetTime( MsgSetTime::parse(payload)? )), - 182 => Ok(SBP::MsgReset( MsgReset::parse(payload)? )), - 178 => Ok(SBP::MsgResetDep( MsgResetDep::parse(payload)? )), - 192 => Ok(SBP::MsgCwResults( MsgCwResults::parse(payload)? )), - 193 => Ok(SBP::MsgCwStart( MsgCwStart::parse(payload)? )), - 34 => Ok(SBP::MsgResetFilters( MsgResetFilters::parse(payload)? )), - 35 => Ok(SBP::MsgInitBase( MsgInitBase::parse(payload)? )), - 23 => Ok(SBP::MsgThreadState( MsgThreadState::parse(payload)? )), - 29 => Ok(SBP::MsgUartState( MsgUartState::parse(payload)? )), - 81 => Ok(SBP::MsgSpecan( MsgSpecan::parse(payload)? )), - 136 => Ok(SBP::MsgEphemerisGlo( MsgEphemerisGlo::parse(payload)? )), - 128 => Ok(SBP::MsgEphemerisDepD( MsgEphemerisDepD::parse(payload)? )), - 26 => Ok(SBP::MsgEphemerisDepA( MsgEphemerisDepA::parse(payload)? )), - 70 => Ok(SBP::MsgEphemerisDepB( MsgEphemerisDepB::parse(payload)? )), - 71 => Ok(SBP::MsgEphemerisDepC( MsgEphemerisDepC::parse(payload)? )), - 69 => Ok(SBP::MsgObsDepA( MsgObsDepA::parse(payload)? )), - 67 => Ok(SBP::MsgObsDepB( MsgObsDepB::parse(payload)? )), - 73 => Ok(SBP::MsgObsDepC( MsgObsDepC::parse(payload)? )), - 144 => Ok(SBP::MsgIono( MsgIono::parse(payload)? )), - 145 => Ok(SBP::MsgSvConfigurationGPS( MsgSvConfigurationGPS::parse(payload)? )), - 2306 => Ok(SBP::MsgMagRaw( MsgMagRaw::parse(payload)? )), - 1024 => Ok(SBP::MsgNdbEvent( MsgNdbEvent::parse(payload)? )), - 257 => Ok(SBP::MsgExtEvent( MsgExtEvent::parse(payload)? )), - 74 => Ok(SBP::MsgObs( MsgObs::parse(payload)? )), - 68 => Ok(SBP::MsgBasePosLLH( MsgBasePosLLH::parse(payload)? )), - 72 => Ok(SBP::MsgBasePosECEF( MsgBasePosECEF::parse(payload)? )), - 129 => Ok(SBP::MsgEphemerisGPSDepE( MsgEphemerisGPSDepE::parse(payload)? )), - 134 => Ok(SBP::MsgEphemerisGPS( MsgEphemerisGPS::parse(payload)? )), - 130 => Ok(SBP::MsgEphemerisSbasDepA( MsgEphemerisSbasDepA::parse(payload)? )), - 131 => Ok(SBP::MsgEphemerisGloDepA( MsgEphemerisGloDepA::parse(payload)? )), - 132 => Ok(SBP::MsgEphemerisSbas( MsgEphemerisSbas::parse(payload)? )), - 133 => Ok(SBP::MsgEphemerisGloDepB( MsgEphemerisGloDepB::parse(payload)? )), - 135 => Ok(SBP::MsgEphemerisGloDepC( MsgEphemerisGloDepC::parse(payload)? )), - 161 => Ok(SBP::MsgSettingsSave( MsgSettingsSave::parse(payload)? )), - 160 => Ok(SBP::MsgSettingsWrite( MsgSettingsWrite::parse(payload)? )), - 175 => Ok(SBP::MsgSettingsWriteResp( MsgSettingsWriteResp::parse(payload)? )), - 164 => Ok(SBP::MsgSettingsReadReq( MsgSettingsReadReq::parse(payload)? )), - 165 => Ok(SBP::MsgSettingsReadResp( MsgSettingsReadResp::parse(payload)? )), - 162 => Ok(SBP::MsgSettingsReadByIndexReq( MsgSettingsReadByIndexReq::parse(payload)? )), - 167 => Ok(SBP::MsgSettingsReadByIndexResp( MsgSettingsReadByIndexResp::parse(payload)? )), - 166 => Ok(SBP::MsgSettingsReadByIndexDone( MsgSettingsReadByIndexDone::parse(payload)? )), - 174 => Ok(SBP::MsgSettingsRegister( MsgSettingsRegister::parse(payload)? )), - 2048 => Ok(SBP::MsgUserData( MsgUserData::parse(payload)? )), - 189 => Ok(SBP::MsgNetworkBandwidthUsage( MsgNetworkBandwidthUsage::parse(payload)? )), - 80 => Ok(SBP::MsgSpecanDep( MsgSpecanDep::parse(payload)? )), - 184 => Ok(SBP::MsgCommandReq( MsgCommandReq::parse(payload)? )), - 185 => Ok(SBP::MsgCommandResp( MsgCommandResp::parse(payload)? )), - 188 => Ok(SBP::MsgCommandOutput( MsgCommandOutput::parse(payload)? )), - 186 => Ok(SBP::MsgNetworkStateReq( MsgNetworkStateReq::parse(payload)? )), - 187 => Ok(SBP::MsgNetworkStateResp( MsgNetworkStateResp::parse(payload)? )), - 24 => Ok(SBP::MsgUartStateDepa( MsgUartStateDepa::parse(payload)? )), - 25 => Ok(SBP::MsgIarState( MsgIarState::parse(payload)? )), - 43 => Ok(SBP::MsgMaskSatellite( MsgMaskSatellite::parse(payload)? )), - 27 => Ok(SBP::MsgMaskSatelliteDep( MsgMaskSatelliteDep::parse(payload)? )), - 181 => Ok(SBP::MsgDeviceMonitor( MsgDeviceMonitor::parse(payload)? )), - _ => Ok(SBP::Unknown {id}) + 1501 => Ok(SBP::MsgSsrOrbitClock(MsgSsrOrbitClock::parse(payload)?)), + 1500 => Ok(SBP::MsgSsrOrbitClockDepA(MsgSsrOrbitClockDepA::parse( + payload, + )?)), + 1505 => Ok(SBP::MsgSsrCodeBiases(MsgSsrCodeBiases::parse(payload)?)), + 1510 => Ok(SBP::MsgSsrPhaseBiases(MsgSsrPhaseBiases::parse(payload)?)), + 1515 => Ok(SBP::MsgSsrStecCorrection(MsgSsrStecCorrection::parse( + payload, + )?)), + 1520 => Ok(SBP::MsgSsrGriddedCorrection( + MsgSsrGriddedCorrection::parse(payload)?, + )), + 1525 => Ok(SBP::MsgSsrGridDefinition(MsgSsrGridDefinition::parse( + payload, + )?)), + 1024 => Ok(SBP::MsgNdbEvent(MsgNdbEvent::parse(payload)?)), + 2304 => Ok(SBP::MsgImuRaw(MsgImuRaw::parse(payload)?)), + 2305 => Ok(SBP::MsgImuAux(MsgImuAux::parse(payload)?)), + 2048 => Ok(SBP::MsgUserData(MsgUserData::parse(payload)?)), + 2307 => Ok(SBP::MsgOdometry(MsgOdometry::parse(payload)?)), + 30583 => Ok(SBP::MsgSbasRaw(MsgSbasRaw::parse(payload)?)), + 47 => Ok(SBP::MsgAcqResult(MsgAcqResult::parse(payload)?)), + 31 => Ok(SBP::MsgAcqResultDepC(MsgAcqResultDepC::parse(payload)?)), + 20 => Ok(SBP::MsgAcqResultDepB(MsgAcqResultDepB::parse(payload)?)), + 21 => Ok(SBP::MsgAcqResultDepA(MsgAcqResultDepA::parse(payload)?)), + 46 => Ok(SBP::MsgAcqSvProfile(MsgAcqSvProfile::parse(payload)?)), + 30 => Ok(SBP::MsgAcqSvProfileDep(MsgAcqSvProfileDep::parse(payload)?)), + 161 => Ok(SBP::MsgSettingsSave(MsgSettingsSave::parse(payload)?)), + 160 => Ok(SBP::MsgSettingsWrite(MsgSettingsWrite::parse(payload)?)), + 175 => Ok(SBP::MsgSettingsWriteResp(MsgSettingsWriteResp::parse( + payload, + )?)), + 164 => Ok(SBP::MsgSettingsReadReq(MsgSettingsReadReq::parse(payload)?)), + 165 => Ok(SBP::MsgSettingsReadResp(MsgSettingsReadResp::parse( + payload, + )?)), + 162 => Ok(SBP::MsgSettingsReadByIndexReq( + MsgSettingsReadByIndexReq::parse(payload)?, + )), + 167 => Ok(SBP::MsgSettingsReadByIndexResp( + MsgSettingsReadByIndexResp::parse(payload)?, + )), + 166 => Ok(SBP::MsgSettingsReadByIndexDone( + MsgSettingsReadByIndexDone::parse(payload)?, + )), + 174 => Ok(SBP::MsgSettingsRegister(MsgSettingsRegister::parse( + payload, + )?)), + 431 => Ok(SBP::MsgSettingsRegisterResp( + MsgSettingsRegisterResp::parse(payload)?, + )), + 168 => Ok(SBP::MsgFileioReadReq(MsgFileioReadReq::parse(payload)?)), + 163 => Ok(SBP::MsgFileioReadResp(MsgFileioReadResp::parse(payload)?)), + 169 => Ok(SBP::MsgFileioReadDirReq(MsgFileioReadDirReq::parse( + payload, + )?)), + 170 => Ok(SBP::MsgFileioReadDirResp(MsgFileioReadDirResp::parse( + payload, + )?)), + 172 => Ok(SBP::MsgFileioRemove(MsgFileioRemove::parse(payload)?)), + 173 => Ok(SBP::MsgFileioWriteReq(MsgFileioWriteReq::parse(payload)?)), + 171 => Ok(SBP::MsgFileioWriteResp(MsgFileioWriteResp::parse(payload)?)), + 4097 => Ok(SBP::MsgFileioConfigReq(MsgFileioConfigReq::parse(payload)?)), + 4098 => Ok(SBP::MsgFileioConfigResp(MsgFileioConfigResp::parse( + payload, + )?)), + 65280 => Ok(SBP::MsgStartup(MsgStartup::parse(payload)?)), + 65282 => Ok(SBP::MsgDgnssStatus(MsgDgnssStatus::parse(payload)?)), + 65535 => Ok(SBP::MsgHeartbeat(MsgHeartbeat::parse(payload)?)), + 65283 => Ok(SBP::MsgInsStatus(MsgInsStatus::parse(payload)?)), + 65284 => Ok(SBP::MsgCsacTelemetry(MsgCsacTelemetry::parse(payload)?)), + 65285 => Ok(SBP::MsgCsacTelemetryLabels(MsgCsacTelemetryLabels::parse( + payload, + )?)), + 32512 => Ok(SBP::MsgLinuxCpuState(MsgLinuxCpuState::parse(payload)?)), + 32513 => Ok(SBP::MsgLinuxMemState(MsgLinuxMemState::parse(payload)?)), + 32514 => Ok(SBP::MsgLinuxSysState(MsgLinuxSysState::parse(payload)?)), + 32515 => Ok(SBP::MsgLinuxProcessSocketCounts( + MsgLinuxProcessSocketCounts::parse(payload)?, + )), + 32516 => Ok(SBP::MsgLinuxProcessSocketQueues( + MsgLinuxProcessSocketQueues::parse(payload)?, + )), + 32517 => Ok(SBP::MsgLinuxSocketUsage(MsgLinuxSocketUsage::parse( + payload, + )?)), + 32518 => Ok(SBP::MsgLinuxProcessFdCount(MsgLinuxProcessFdCount::parse( + payload, + )?)), + 32519 => Ok(SBP::MsgLinuxProcessFdSummary( + MsgLinuxProcessFdSummary::parse(payload)?, + )), + 257 => Ok(SBP::MsgExtEvent(MsgExtEvent::parse(payload)?)), + 74 => Ok(SBP::MsgObs(MsgObs::parse(payload)?)), + 68 => Ok(SBP::MsgBasePosLLH(MsgBasePosLLH::parse(payload)?)), + 72 => Ok(SBP::MsgBasePosECEF(MsgBasePosECEF::parse(payload)?)), + 129 => Ok(SBP::MsgEphemerisGPSDepE(MsgEphemerisGPSDepE::parse( + payload, + )?)), + 134 => Ok(SBP::MsgEphemerisGPSDepF(MsgEphemerisGPSDepF::parse( + payload, + )?)), + 138 => Ok(SBP::MsgEphemerisGPS(MsgEphemerisGPS::parse(payload)?)), + 142 => Ok(SBP::MsgEphemerisQzss(MsgEphemerisQzss::parse(payload)?)), + 137 => Ok(SBP::MsgEphemerisBds(MsgEphemerisBds::parse(payload)?)), + 149 => Ok(SBP::MsgEphemerisGalDepA(MsgEphemerisGalDepA::parse( + payload, + )?)), + 141 => Ok(SBP::MsgEphemerisGal(MsgEphemerisGal::parse(payload)?)), + 130 => Ok(SBP::MsgEphemerisSbasDepA(MsgEphemerisSbasDepA::parse( + payload, + )?)), + 131 => Ok(SBP::MsgEphemerisGloDepA(MsgEphemerisGloDepA::parse( + payload, + )?)), + 132 => Ok(SBP::MsgEphemerisSbasDepB(MsgEphemerisSbasDepB::parse( + payload, + )?)), + 140 => Ok(SBP::MsgEphemerisSbas(MsgEphemerisSbas::parse(payload)?)), + 133 => Ok(SBP::MsgEphemerisGloDepB(MsgEphemerisGloDepB::parse( + payload, + )?)), + 135 => Ok(SBP::MsgEphemerisGloDepC(MsgEphemerisGloDepC::parse( + payload, + )?)), + 136 => Ok(SBP::MsgEphemerisGloDepD(MsgEphemerisGloDepD::parse( + payload, + )?)), + 139 => Ok(SBP::MsgEphemerisGlo(MsgEphemerisGlo::parse(payload)?)), + 128 => Ok(SBP::MsgEphemerisDepD(MsgEphemerisDepD::parse(payload)?)), + 26 => Ok(SBP::MsgEphemerisDepA(MsgEphemerisDepA::parse(payload)?)), + 70 => Ok(SBP::MsgEphemerisDepB(MsgEphemerisDepB::parse(payload)?)), + 71 => Ok(SBP::MsgEphemerisDepC(MsgEphemerisDepC::parse(payload)?)), + 69 => Ok(SBP::MsgObsDepA(MsgObsDepA::parse(payload)?)), + 67 => Ok(SBP::MsgObsDepB(MsgObsDepB::parse(payload)?)), + 73 => Ok(SBP::MsgObsDepC(MsgObsDepC::parse(payload)?)), + 144 => Ok(SBP::MsgIono(MsgIono::parse(payload)?)), + 145 => Ok(SBP::MsgSvConfigurationGPSDep( + MsgSvConfigurationGPSDep::parse(payload)?, + )), + 150 => Ok(SBP::MsgGnssCapb(MsgGnssCapb::parse(payload)?)), + 146 => Ok(SBP::MsgGroupDelayDepA(MsgGroupDelayDepA::parse(payload)?)), + 147 => Ok(SBP::MsgGroupDelayDepB(MsgGroupDelayDepB::parse(payload)?)), + 148 => Ok(SBP::MsgGroupDelay(MsgGroupDelay::parse(payload)?)), + 112 => Ok(SBP::MsgAlmanacGPSDep(MsgAlmanacGPSDep::parse(payload)?)), + 114 => Ok(SBP::MsgAlmanacGPS(MsgAlmanacGPS::parse(payload)?)), + 113 => Ok(SBP::MsgAlmanacGloDep(MsgAlmanacGloDep::parse(payload)?)), + 115 => Ok(SBP::MsgAlmanacGlo(MsgAlmanacGlo::parse(payload)?)), + 117 => Ok(SBP::MsgGloBiases(MsgGloBiases::parse(payload)?)), + 151 => Ok(SBP::MsgSvAzEl(MsgSvAzEl::parse(payload)?)), + 1600 => Ok(SBP::MsgOsr(MsgOsr::parse(payload)?)), + 230 => Ok(SBP::MsgFlashProgram(MsgFlashProgram::parse(payload)?)), + 224 => Ok(SBP::MsgFlashDone(MsgFlashDone::parse(payload)?)), + 231 => Ok(SBP::MsgFlashReadReq(MsgFlashReadReq::parse(payload)?)), + 225 => Ok(SBP::MsgFlashReadResp(MsgFlashReadResp::parse(payload)?)), + 226 => Ok(SBP::MsgFlashErase(MsgFlashErase::parse(payload)?)), + 227 => Ok(SBP::MsgStmFlashLockSector(MsgStmFlashLockSector::parse( + payload, + )?)), + 228 => Ok(SBP::MsgStmFlashUnlockSector( + MsgStmFlashUnlockSector::parse(payload)?, + )), + 232 => Ok(SBP::MsgStmUniqueIdReq(MsgStmUniqueIdReq::parse(payload)?)), + 229 => Ok(SBP::MsgStmUniqueIdResp(MsgStmUniqueIdResp::parse(payload)?)), + 243 => Ok(SBP::MsgM25FlashWriteStatus(MsgM25FlashWriteStatus::parse( + payload, + )?)), + 258 => Ok(SBP::MsgGPSTime(MsgGPSTime::parse(payload)?)), + 259 => Ok(SBP::MsgUtcTime(MsgUtcTime::parse(payload)?)), + 520 => Ok(SBP::MsgDops(MsgDops::parse(payload)?)), + 521 => Ok(SBP::MsgPosECEF(MsgPosECEF::parse(payload)?)), + 532 => Ok(SBP::MsgPosECEFCov(MsgPosECEFCov::parse(payload)?)), + 522 => Ok(SBP::MsgPosLLH(MsgPosLLH::parse(payload)?)), + 529 => Ok(SBP::MsgPosLLHCov(MsgPosLLHCov::parse(payload)?)), + 523 => Ok(SBP::MsgBaselineECEF(MsgBaselineECEF::parse(payload)?)), + 524 => Ok(SBP::MsgBaselineNED(MsgBaselineNED::parse(payload)?)), + 525 => Ok(SBP::MsgVelECEF(MsgVelECEF::parse(payload)?)), + 533 => Ok(SBP::MsgVelECEFCov(MsgVelECEFCov::parse(payload)?)), + 526 => Ok(SBP::MsgVelNED(MsgVelNED::parse(payload)?)), + 530 => Ok(SBP::MsgVelNEDCov(MsgVelNEDCov::parse(payload)?)), + 531 => Ok(SBP::MsgVelBody(MsgVelBody::parse(payload)?)), + 528 => Ok(SBP::MsgAgeCorrections(MsgAgeCorrections::parse(payload)?)), + 256 => Ok(SBP::MsgGPSTimeDepA(MsgGPSTimeDepA::parse(payload)?)), + 518 => Ok(SBP::MsgDopsDepA(MsgDopsDepA::parse(payload)?)), + 512 => Ok(SBP::MsgPosECEFDepA(MsgPosECEFDepA::parse(payload)?)), + 513 => Ok(SBP::MsgPosLLHDepA(MsgPosLLHDepA::parse(payload)?)), + 514 => Ok(SBP::MsgBaselineECEFDepA(MsgBaselineECEFDepA::parse( + payload, + )?)), + 515 => Ok(SBP::MsgBaselineNEDDepA(MsgBaselineNEDDepA::parse(payload)?)), + 516 => Ok(SBP::MsgVelECEFDepA(MsgVelECEFDepA::parse(payload)?)), + 517 => Ok(SBP::MsgVelNEDDepA(MsgVelNEDDepA::parse(payload)?)), + 519 => Ok(SBP::MsgBaselineHeadingDepA(MsgBaselineHeadingDepA::parse( + payload, + )?)), + 527 => Ok(SBP::MsgBaselineHeading(MsgBaselineHeading::parse(payload)?)), + 544 => Ok(SBP::MsgOrientQuat(MsgOrientQuat::parse(payload)?)), + 545 => Ok(SBP::MsgOrientEuler(MsgOrientEuler::parse(payload)?)), + 546 => Ok(SBP::MsgAngularRate(MsgAngularRate::parse(payload)?)), + 33 => Ok(SBP::MsgTrackingStateDetailedDepA( + MsgTrackingStateDetailedDepA::parse(payload)?, + )), + 17 => Ok(SBP::MsgTrackingStateDetailedDep( + MsgTrackingStateDetailedDep::parse(payload)?, + )), + 65 => Ok(SBP::MsgTrackingState(MsgTrackingState::parse(payload)?)), + 97 => Ok(SBP::MsgMeasurementState(MsgMeasurementState::parse( + payload, + )?)), + 45 => Ok(SBP::MsgTrackingIq(MsgTrackingIq::parse(payload)?)), + 44 => Ok(SBP::MsgTrackingIqDepB(MsgTrackingIqDepB::parse(payload)?)), + 28 => Ok(SBP::MsgTrackingIqDepA(MsgTrackingIqDepA::parse(payload)?)), + 22 => Ok(SBP::MsgTrackingStateDepA(MsgTrackingStateDepA::parse( + payload, + )?)), + 19 => Ok(SBP::MsgTrackingStateDepB(MsgTrackingStateDepB::parse( + payload, + )?)), + 1025 => Ok(SBP::MsgLog(MsgLog::parse(payload)?)), + 1026 => Ok(SBP::MsgFwd(MsgFwd::parse(payload)?)), + 16 => Ok(SBP::MsgPrintDep(MsgPrintDep::parse(payload)?)), + 179 => Ok(SBP::MsgBootloaderHandshakeReq( + MsgBootloaderHandshakeReq::parse(payload)?, + )), + 180 => Ok(SBP::MsgBootloaderHandshakeResp( + MsgBootloaderHandshakeResp::parse(payload)?, + )), + 177 => Ok(SBP::MsgBootloaderJumpToApp(MsgBootloaderJumpToApp::parse( + payload, + )?)), + 222 => Ok(SBP::MsgNapDeviceDnaReq(MsgNapDeviceDnaReq::parse(payload)?)), + 221 => Ok(SBP::MsgNapDeviceDnaResp(MsgNapDeviceDnaResp::parse( + payload, + )?)), + 176 => Ok(SBP::MsgBootloaderHandshakeDepA( + MsgBootloaderHandshakeDepA::parse(payload)?, + )), + 105 => Ok(SBP::MsgAlmanac(MsgAlmanac::parse(payload)?)), + 104 => Ok(SBP::MsgSetTime(MsgSetTime::parse(payload)?)), + 182 => Ok(SBP::MsgReset(MsgReset::parse(payload)?)), + 178 => Ok(SBP::MsgResetDep(MsgResetDep::parse(payload)?)), + 192 => Ok(SBP::MsgCwResults(MsgCwResults::parse(payload)?)), + 193 => Ok(SBP::MsgCwStart(MsgCwStart::parse(payload)?)), + 34 => Ok(SBP::MsgResetFilters(MsgResetFilters::parse(payload)?)), + 35 => Ok(SBP::MsgInitBaseDep(MsgInitBaseDep::parse(payload)?)), + 23 => Ok(SBP::MsgThreadState(MsgThreadState::parse(payload)?)), + 29 => Ok(SBP::MsgUartState(MsgUartState::parse(payload)?)), + 24 => Ok(SBP::MsgUartStateDepa(MsgUartStateDepa::parse(payload)?)), + 25 => Ok(SBP::MsgIarState(MsgIarState::parse(payload)?)), + 43 => Ok(SBP::MsgMaskSatellite(MsgMaskSatellite::parse(payload)?)), + 27 => Ok(SBP::MsgMaskSatelliteDep(MsgMaskSatelliteDep::parse( + payload, + )?)), + 181 => Ok(SBP::MsgDeviceMonitor(MsgDeviceMonitor::parse(payload)?)), + 184 => Ok(SBP::MsgCommandReq(MsgCommandReq::parse(payload)?)), + 185 => Ok(SBP::MsgCommandResp(MsgCommandResp::parse(payload)?)), + 188 => Ok(SBP::MsgCommandOutput(MsgCommandOutput::parse(payload)?)), + 186 => Ok(SBP::MsgNetworkStateReq(MsgNetworkStateReq::parse(payload)?)), + 187 => Ok(SBP::MsgNetworkStateResp(MsgNetworkStateResp::parse( + payload, + )?)), + 189 => Ok(SBP::MsgNetworkBandwidthUsage( + MsgNetworkBandwidthUsage::parse(payload)?, + )), + 190 => Ok(SBP::MsgCellModemStatus(MsgCellModemStatus::parse(payload)?)), + 80 => Ok(SBP::MsgSpecanDep(MsgSpecanDep::parse(payload)?)), + 81 => Ok(SBP::MsgSpecan(MsgSpecan::parse(payload)?)), + 191 => Ok(SBP::MsgFrontEndGain(MsgFrontEndGain::parse(payload)?)), + 2306 => Ok(SBP::MsgMagRaw(MsgMagRaw::parse(payload)?)), + _ => Ok(SBP::Unknown { id }), }; match x { Ok(x) => Ok(x), Err(_) => Err(::Error::ParseError), } } -} \ No newline at end of file +} diff --git a/rust/sbp/src/messages/navigation.rs b/rust/sbp/src/messages/navigation.rs index 0abf5dfd57..7fa77b8e66 100644 --- a/rust/sbp/src/messages/navigation.rs +++ b/rust/sbp/src/messages/navigation.rs @@ -12,28 +12,27 @@ // Automatically generated from yaml/swiftnav/sbp/navigation.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Geodetic navigation messages reporting GPS time, position, velocity, // and baseline position solutions. For position solutions, these // messages define several different position solutions: single-point // (SPP), RTK, and pseudo-absolute position solutions. -// +// // The SPP is the standalone, absolute GPS position solution using only // a single receiver. The RTK solution is the differential GPS // solution, which can use either a fixed/integer or floating carrier // phase ambiguity. The pseudo-absolute position solution uses a // user-provided, well-surveyed base station position (if available) // and the RTK solution in tandem. -// +// // When the inertial navigation mode indicates that the IMU is used, // all messages are reported in the vehicle body frame as defined by // device settings. By default, the vehicle body frame is configured to be -// coincident with the antenna phase center. When there is no inertial +// coincident with the antenna phase center. When there is no inertial // navigation, the solution will be reported at the phase center of the antenna. +// There is no inertial navigation capability on Piksi Multi or Duro. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; - +use self::byteorder::{LittleEndian, ReadBytesExt}; // GPS Time // @@ -42,7 +41,7 @@ use self::byteorder::{LittleEndian,ReadBytesExt}; // counts the weeks and seconds of the week. The weeks begin at the // Saturday/Sunday transition. GPS week 0 began at the beginning of // the GPS time scale. -// +// // Within each week number, the GPS time of the week is between // between 0 and 604800 seconds (=60*60*24*7). Note that GPS time // does not accumulate leap seconds, and as of now, has a small @@ -55,29 +54,28 @@ use self::byteorder::{LittleEndian,ReadBytesExt}; #[allow(non_snake_case)] pub struct MsgGPSTime { pub wn: u16, - // ^ GPS week number + // ^ GPS week number pub tow: u32, - // ^ GPS time of week rounded to the nearest millisecond + // ^ GPS time of week rounded to the nearest millisecond pub ns_residual: i32, - // ^ Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to - // 500000) + // ^ Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to + // 500000) pub flags: u8, - // ^ Status flags (reserved) + // ^ Status flags (reserved) } impl MsgGPSTime { pub const TYPE: u16 = 258; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgGPSTime{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgGPSTime { wn: _buf.read_u16::()?, tow: _buf.read_u32::()?, ns_residual: _buf.read_i32::()?, flags: _buf.read_u8()?, - } ) + }) } } - // UTC Time // // This message reports the Universal Coordinated Time (UTC). Note the flags @@ -87,29 +85,29 @@ impl MsgGPSTime { #[allow(non_snake_case)] pub struct MsgUtcTime { pub flags: u8, - // ^ Indicates source and time validity + // ^ Indicates source and time validity pub tow: u32, - // ^ GPS time of week rounded to the nearest millisecond + // ^ GPS time of week rounded to the nearest millisecond pub year: u16, - // ^ Year + // ^ Year pub month: u8, - // ^ Month (range 1 .. 12) + // ^ Month (range 1 .. 12) pub day: u8, - // ^ days in the month (range 1-31) + // ^ days in the month (range 1-31) pub hours: u8, - // ^ hours of day (range 0-23) + // ^ hours of day (range 0-23) pub minutes: u8, - // ^ minutes of hour (range 0-59) + // ^ minutes of hour (range 0-59) pub seconds: u8, - // ^ seconds of minute (range 0-60) rounded down + // ^ seconds of minute (range 0-60) rounded down pub ns: u32, - // ^ nanoseconds of second (range 0-999999999) + // ^ nanoseconds of second (range 0-999999999) } impl MsgUtcTime { pub const TYPE: u16 = 259; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgUtcTime{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgUtcTime { flags: _buf.read_u8()?, tow: _buf.read_u32::()?, year: _buf.read_u16::()?, @@ -119,11 +117,10 @@ impl MsgUtcTime { minutes: _buf.read_u8()?, seconds: _buf.read_u8()?, ns: _buf.read_u32::()?, - } ) + }) } } - // Dilution of Precision // // This dilution of precision (DOP) message describes the effect of @@ -135,25 +132,25 @@ impl MsgUtcTime { #[allow(non_snake_case)] pub struct MsgDops { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub gdop: u16, - // ^ Geometric Dilution of Precision + // ^ Geometric Dilution of Precision pub pdop: u16, - // ^ Position Dilution of Precision + // ^ Position Dilution of Precision pub tdop: u16, - // ^ Time Dilution of Precision + // ^ Time Dilution of Precision pub hdop: u16, - // ^ Horizontal Dilution of Precision + // ^ Horizontal Dilution of Precision pub vdop: u16, - // ^ Vertical Dilution of Precision + // ^ Vertical Dilution of Precision pub flags: u8, - // ^ Indicates the position solution with which the DOPS message corresponds + // ^ Indicates the position solution with which the DOPS message corresponds } impl MsgDops { pub const TYPE: u16 = 520; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgDops{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgDops { tow: _buf.read_u32::()?, gdop: _buf.read_u16::()?, pdop: _buf.read_u16::()?, @@ -161,11 +158,10 @@ impl MsgDops { hdop: _buf.read_u16::()?, vdop: _buf.read_u16::()?, flags: _buf.read_u8()?, - } ) + }) } } - // Single-point position in ECEF // // The position solution message reports absolute Earth Centered @@ -181,25 +177,25 @@ impl MsgDops { #[allow(non_snake_case)] pub struct MsgPosECEF { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub x: f64, - // ^ ECEF X coordinate + // ^ ECEF X coordinate pub y: f64, - // ^ ECEF Y coordinate + // ^ ECEF Y coordinate pub z: f64, - // ^ ECEF Z coordinate + // ^ ECEF Z coordinate pub accuracy: u16, - // ^ Position estimated standard deviation + // ^ Position estimated standard deviation pub n_sats: u8, - // ^ Number of satellites used in solution + // ^ Number of satellites used in solution pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgPosECEF { pub const TYPE: u16 = 521; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgPosECEF{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgPosECEF { tow: _buf.read_u32::()?, x: _buf.read_f64::()?, y: _buf.read_f64::()?, @@ -207,11 +203,10 @@ impl MsgPosECEF { accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Single-point position in ECEF // // The position solution message reports absolute Earth Centered @@ -228,35 +223,35 @@ impl MsgPosECEF { #[allow(non_snake_case)] pub struct MsgPosECEFCov { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub x: f64, - // ^ ECEF X coordinate + // ^ ECEF X coordinate pub y: f64, - // ^ ECEF Y coordinate + // ^ ECEF Y coordinate pub z: f64, - // ^ ECEF Z coordinate + // ^ ECEF Z coordinate pub cov_x_x: f32, - // ^ Estimated variance of x + // ^ Estimated variance of x pub cov_x_y: f32, - // ^ Estimated covariance of x and y + // ^ Estimated covariance of x and y pub cov_x_z: f32, - // ^ Estimated covariance of x and z + // ^ Estimated covariance of x and z pub cov_y_y: f32, - // ^ Estimated variance of y + // ^ Estimated variance of y pub cov_y_z: f32, - // ^ Estimated covariance of y and z + // ^ Estimated covariance of y and z pub cov_z_z: f32, - // ^ Estimated variance of z + // ^ Estimated variance of z pub n_sats: u8, - // ^ Number of satellites used in solution + // ^ Number of satellites used in solution pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgPosECEFCov { pub const TYPE: u16 = 532; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgPosECEFCov{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgPosECEFCov { tow: _buf.read_u32::()?, x: _buf.read_f64::()?, y: _buf.read_f64::()?, @@ -269,11 +264,10 @@ impl MsgPosECEFCov { cov_z_z: _buf.read_f32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Geodetic Position // // This position solution message reports the absolute geodetic @@ -289,27 +283,27 @@ impl MsgPosECEFCov { #[allow(non_snake_case)] pub struct MsgPosLLH { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub lat: f64, - // ^ Latitude + // ^ Latitude pub lon: f64, - // ^ Longitude + // ^ Longitude pub height: f64, - // ^ Height above WGS84 ellipsoid + // ^ Height above WGS84 ellipsoid pub h_accuracy: u16, - // ^ Horizontal position estimated standard deviation + // ^ Horizontal position estimated standard deviation pub v_accuracy: u16, - // ^ Vertical position estimated standard deviation + // ^ Vertical position estimated standard deviation pub n_sats: u8, - // ^ Number of satellites used in solution. + // ^ Number of satellites used in solution. pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgPosLLH { pub const TYPE: u16 = 522; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgPosLLH{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgPosLLH { tow: _buf.read_u32::()?, lat: _buf.read_f64::()?, lon: _buf.read_f64::()?, @@ -318,11 +312,10 @@ impl MsgPosLLH { v_accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Geodetic Position // // This position solution message reports the absolute geodetic @@ -338,35 +331,35 @@ impl MsgPosLLH { #[allow(non_snake_case)] pub struct MsgPosLLHCov { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub lat: f64, - // ^ Latitude + // ^ Latitude pub lon: f64, - // ^ Longitude + // ^ Longitude pub height: f64, - // ^ Height above WGS84 ellipsoid + // ^ Height above WGS84 ellipsoid pub cov_n_n: f32, - // ^ Estimated variance of northing + // ^ Estimated variance of northing pub cov_n_e: f32, - // ^ Covariance of northing and easting + // ^ Covariance of northing and easting pub cov_n_d: f32, - // ^ Covariance of northing and downward measurement + // ^ Covariance of northing and downward measurement pub cov_e_e: f32, - // ^ Estimated variance of easting + // ^ Estimated variance of easting pub cov_e_d: f32, - // ^ Covariance of easting and downward measurement + // ^ Covariance of easting and downward measurement pub cov_d_d: f32, - // ^ Estimated variance of downward measurement + // ^ Estimated variance of downward measurement pub n_sats: u8, - // ^ Number of satellites used in solution. + // ^ Number of satellites used in solution. pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgPosLLHCov { pub const TYPE: u16 = 529; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgPosLLHCov{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgPosLLHCov { tow: _buf.read_u32::()?, lat: _buf.read_f64::()?, lon: _buf.read_f64::()?, @@ -379,11 +372,10 @@ impl MsgPosLLHCov { cov_d_d: _buf.read_f32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Baseline Position in ECEF // // This message reports the baseline solution in Earth Centered @@ -396,25 +388,25 @@ impl MsgPosLLHCov { #[allow(non_snake_case)] pub struct MsgBaselineECEF { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub x: i32, - // ^ Baseline ECEF X coordinate + // ^ Baseline ECEF X coordinate pub y: i32, - // ^ Baseline ECEF Y coordinate + // ^ Baseline ECEF Y coordinate pub z: i32, - // ^ Baseline ECEF Z coordinate + // ^ Baseline ECEF Z coordinate pub accuracy: u16, - // ^ Position estimated standard deviation + // ^ Position estimated standard deviation pub n_sats: u8, - // ^ Number of satellites used in solution + // ^ Number of satellites used in solution pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgBaselineECEF { pub const TYPE: u16 = 523; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgBaselineECEF{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgBaselineECEF { tow: _buf.read_u32::()?, x: _buf.read_i32::()?, y: _buf.read_i32::()?, @@ -422,11 +414,10 @@ impl MsgBaselineECEF { accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Baseline in NED // // This message reports the baseline solution in North East Down @@ -440,27 +431,27 @@ impl MsgBaselineECEF { #[allow(non_snake_case)] pub struct MsgBaselineNED { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub n: i32, - // ^ Baseline North coordinate + // ^ Baseline North coordinate pub e: i32, - // ^ Baseline East coordinate + // ^ Baseline East coordinate pub d: i32, - // ^ Baseline Down coordinate + // ^ Baseline Down coordinate pub h_accuracy: u16, - // ^ Horizontal position estimated standard deviation + // ^ Horizontal position estimated standard deviation pub v_accuracy: u16, - // ^ Vertical position estimated standard deviation + // ^ Vertical position estimated standard deviation pub n_sats: u8, - // ^ Number of satellites used in solution + // ^ Number of satellites used in solution pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgBaselineNED { pub const TYPE: u16 = 524; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgBaselineNED{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgBaselineNED { tow: _buf.read_u32::()?, n: _buf.read_i32::()?, e: _buf.read_i32::()?, @@ -469,11 +460,10 @@ impl MsgBaselineNED { v_accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Velocity in ECEF // // This message reports the velocity in Earth Centered Earth Fixed @@ -484,25 +474,25 @@ impl MsgBaselineNED { #[allow(non_snake_case)] pub struct MsgVelECEF { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub x: i32, - // ^ Velocity ECEF X coordinate + // ^ Velocity ECEF X coordinate pub y: i32, - // ^ Velocity ECEF Y coordinate + // ^ Velocity ECEF Y coordinate pub z: i32, - // ^ Velocity ECEF Z coordinate + // ^ Velocity ECEF Z coordinate pub accuracy: u16, - // ^ Velocity estimated standard deviation + // ^ Velocity estimated standard deviation pub n_sats: u8, - // ^ Number of satellites used in solution + // ^ Number of satellites used in solution pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgVelECEF { pub const TYPE: u16 = 525; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgVelECEF{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgVelECEF { tow: _buf.read_u32::()?, x: _buf.read_i32::()?, y: _buf.read_i32::()?, @@ -510,11 +500,10 @@ impl MsgVelECEF { accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Velocity in ECEF // // This message reports the velocity in Earth Centered Earth Fixed @@ -525,35 +514,35 @@ impl MsgVelECEF { #[allow(non_snake_case)] pub struct MsgVelECEFCov { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub x: i32, - // ^ Velocity ECEF X coordinate + // ^ Velocity ECEF X coordinate pub y: i32, - // ^ Velocity ECEF Y coordinate + // ^ Velocity ECEF Y coordinate pub z: i32, - // ^ Velocity ECEF Z coordinate + // ^ Velocity ECEF Z coordinate pub cov_x_x: f32, - // ^ Estimated variance of x + // ^ Estimated variance of x pub cov_x_y: f32, - // ^ Estimated covariance of x and y + // ^ Estimated covariance of x and y pub cov_x_z: f32, - // ^ Estimated covariance of x and z + // ^ Estimated covariance of x and z pub cov_y_y: f32, - // ^ Estimated variance of y + // ^ Estimated variance of y pub cov_y_z: f32, - // ^ Estimated covariance of y and z + // ^ Estimated covariance of y and z pub cov_z_z: f32, - // ^ Estimated variance of z + // ^ Estimated variance of z pub n_sats: u8, - // ^ Number of satellites used in solution + // ^ Number of satellites used in solution pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgVelECEFCov { pub const TYPE: u16 = 533; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgVelECEFCov{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgVelECEFCov { tow: _buf.read_u32::()?, x: _buf.read_i32::()?, y: _buf.read_i32::()?, @@ -566,11 +555,10 @@ impl MsgVelECEFCov { cov_z_z: _buf.read_f32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Velocity in NED // // This message reports the velocity in local North East Down (NED) @@ -582,27 +570,27 @@ impl MsgVelECEFCov { #[allow(non_snake_case)] pub struct MsgVelNED { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub n: i32, - // ^ Velocity North coordinate + // ^ Velocity North coordinate pub e: i32, - // ^ Velocity East coordinate + // ^ Velocity East coordinate pub d: i32, - // ^ Velocity Down coordinate + // ^ Velocity Down coordinate pub h_accuracy: u16, - // ^ Horizontal velocity estimated standard deviation + // ^ Horizontal velocity estimated standard deviation pub v_accuracy: u16, - // ^ Vertical velocity estimated standard deviation + // ^ Vertical velocity estimated standard deviation pub n_sats: u8, - // ^ Number of satellites used in solution + // ^ Number of satellites used in solution pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgVelNED { pub const TYPE: u16 = 526; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgVelNED{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgVelNED { tow: _buf.read_u32::()?, n: _buf.read_i32::()?, e: _buf.read_i32::()?, @@ -611,11 +599,10 @@ impl MsgVelNED { v_accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Velocity in NED // // This message reports the velocity in local North East Down (NED) @@ -629,35 +616,35 @@ impl MsgVelNED { #[allow(non_snake_case)] pub struct MsgVelNEDCov { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub n: i32, - // ^ Velocity North coordinate + // ^ Velocity North coordinate pub e: i32, - // ^ Velocity East coordinate + // ^ Velocity East coordinate pub d: i32, - // ^ Velocity Down coordinate + // ^ Velocity Down coordinate pub cov_n_n: f32, - // ^ Estimated variance of northward measurement + // ^ Estimated variance of northward measurement pub cov_n_e: f32, - // ^ Covariance of northward and eastward measurement + // ^ Covariance of northward and eastward measurement pub cov_n_d: f32, - // ^ Covariance of northward and downward measurement + // ^ Covariance of northward and downward measurement pub cov_e_e: f32, - // ^ Estimated variance of eastward measurement + // ^ Estimated variance of eastward measurement pub cov_e_d: f32, - // ^ Covariance of eastward and downward measurement + // ^ Covariance of eastward and downward measurement pub cov_d_d: f32, - // ^ Estimated variance of downward measurement + // ^ Estimated variance of downward measurement pub n_sats: u8, - // ^ Number of satellites used in solution + // ^ Number of satellites used in solution pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgVelNEDCov { pub const TYPE: u16 = 530; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgVelNEDCov{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgVelNEDCov { tow: _buf.read_u32::()?, n: _buf.read_i32::()?, e: _buf.read_i32::()?, @@ -670,11 +657,10 @@ impl MsgVelNEDCov { cov_d_d: _buf.read_f32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Velocity in User Frame // // This message reports the velocity in the Vehicle Body Frame. By convention, @@ -683,41 +669,42 @@ impl MsgVelNEDCov { // Since this is a right handed system, z should point out the bottom of the vehicle. // The orientation and origin of the Vehicle Body Frame are specified via the device settings. // The full GPS time is given by the preceding MSG_GPS_TIME with the -// matching time-of-week (tow). +// matching time-of-week (tow). This message is only produced by inertial versions of Swift +// products and is not available from Piksi Multi or Duro. // #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgVelBody { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub x: i32, - // ^ Velocity in x direction + // ^ Velocity in x direction pub y: i32, - // ^ Velocity in y direction + // ^ Velocity in y direction pub z: i32, - // ^ Velocity in z direction + // ^ Velocity in z direction pub cov_x_x: f32, - // ^ Estimated variance of x + // ^ Estimated variance of x pub cov_x_y: f32, - // ^ Covariance of x and y + // ^ Covariance of x and y pub cov_x_z: f32, - // ^ Covariance of x and z + // ^ Covariance of x and z pub cov_y_y: f32, - // ^ Estimated variance of y + // ^ Estimated variance of y pub cov_y_z: f32, - // ^ Covariance of y and z + // ^ Covariance of y and z pub cov_z_z: f32, - // ^ Estimated variance of z + // ^ Estimated variance of z pub n_sats: u8, - // ^ Number of satellites used in solution + // ^ Number of satellites used in solution pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgVelBody { pub const TYPE: u16 = 531; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgVelBody{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgVelBody { tow: _buf.read_u32::()?, x: _buf.read_i32::()?, y: _buf.read_i32::()?, @@ -730,11 +717,10 @@ impl MsgVelBody { cov_z_z: _buf.read_f32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Age of corrections // // This message reports the Age of the corrections used for the current @@ -744,22 +730,21 @@ impl MsgVelBody { #[allow(non_snake_case)] pub struct MsgAgeCorrections { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub age: u16, - // ^ Age of the corrections (0xFFFF indicates invalid) + // ^ Age of the corrections (0xFFFF indicates invalid) } impl MsgAgeCorrections { pub const TYPE: u16 = 528; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgAgeCorrections{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgAgeCorrections { tow: _buf.read_u32::()?, age: _buf.read_u16::()?, - } ) + }) } } - // GPS Time (v1.0) // // This message reports the GPS time, representing the time since @@ -767,7 +752,7 @@ impl MsgAgeCorrections { // counts the weeks and seconds of the week. The weeks begin at the // Saturday/Sunday transition. GPS week 0 began at the beginning of // the GPS time scale. -// +// // Within each week number, the GPS time of the week is between // between 0 and 604800 seconds (=60*60*24*7). Note that GPS time // does not accumulate leap seconds, and as of now, has a small @@ -780,29 +765,28 @@ impl MsgAgeCorrections { #[allow(non_snake_case)] pub struct MsgGPSTimeDepA { pub wn: u16, - // ^ GPS week number + // ^ GPS week number pub tow: u32, - // ^ GPS time of week rounded to the nearest millisecond + // ^ GPS time of week rounded to the nearest millisecond pub ns_residual: i32, - // ^ Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to - // 500000) + // ^ Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to + // 500000) pub flags: u8, - // ^ Status flags (reserved) + // ^ Status flags (reserved) } impl MsgGPSTimeDepA { pub const TYPE: u16 = 256; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgGPSTimeDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgGPSTimeDepA { wn: _buf.read_u16::()?, tow: _buf.read_u32::()?, ns_residual: _buf.read_i32::()?, flags: _buf.read_u8()?, - } ) + }) } } - // Dilution of Precision // // This dilution of precision (DOP) message describes the effect of @@ -813,34 +797,33 @@ impl MsgGPSTimeDepA { #[allow(non_snake_case)] pub struct MsgDopsDepA { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub gdop: u16, - // ^ Geometric Dilution of Precision + // ^ Geometric Dilution of Precision pub pdop: u16, - // ^ Position Dilution of Precision + // ^ Position Dilution of Precision pub tdop: u16, - // ^ Time Dilution of Precision + // ^ Time Dilution of Precision pub hdop: u16, - // ^ Horizontal Dilution of Precision + // ^ Horizontal Dilution of Precision pub vdop: u16, - // ^ Vertical Dilution of Precision + // ^ Vertical Dilution of Precision } impl MsgDopsDepA { pub const TYPE: u16 = 518; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgDopsDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgDopsDepA { tow: _buf.read_u32::()?, gdop: _buf.read_u16::()?, pdop: _buf.read_u16::()?, tdop: _buf.read_u16::()?, hdop: _buf.read_u16::()?, vdop: _buf.read_u16::()?, - } ) + }) } } - // Single-point position in ECEF // // The position solution message reports absolute Earth Centered @@ -856,25 +839,25 @@ impl MsgDopsDepA { #[allow(non_snake_case)] pub struct MsgPosECEFDepA { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub x: f64, - // ^ ECEF X coordinate + // ^ ECEF X coordinate pub y: f64, - // ^ ECEF Y coordinate + // ^ ECEF Y coordinate pub z: f64, - // ^ ECEF Z coordinate + // ^ ECEF Z coordinate pub accuracy: u16, - // ^ Position accuracy estimate (not implemented). Defaults to 0. + // ^ Position accuracy estimate (not implemented). Defaults to 0. pub n_sats: u8, - // ^ Number of satellites used in solution + // ^ Number of satellites used in solution pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgPosECEFDepA { pub const TYPE: u16 = 512; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgPosECEFDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgPosECEFDepA { tow: _buf.read_u32::()?, x: _buf.read_f64::()?, y: _buf.read_f64::()?, @@ -882,11 +865,10 @@ impl MsgPosECEFDepA { accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Geodetic Position // // This position solution message reports the absolute geodetic @@ -902,27 +884,27 @@ impl MsgPosECEFDepA { #[allow(non_snake_case)] pub struct MsgPosLLHDepA { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub lat: f64, - // ^ Latitude + // ^ Latitude pub lon: f64, - // ^ Longitude + // ^ Longitude pub height: f64, - // ^ Height + // ^ Height pub h_accuracy: u16, - // ^ Horizontal position accuracy estimate (not implemented). Defaults to 0. + // ^ Horizontal position accuracy estimate (not implemented). Defaults to 0. pub v_accuracy: u16, - // ^ Vertical position accuracy estimate (not implemented). Defaults to 0. + // ^ Vertical position accuracy estimate (not implemented). Defaults to 0. pub n_sats: u8, - // ^ Number of satellites used in solution. + // ^ Number of satellites used in solution. pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgPosLLHDepA { pub const TYPE: u16 = 513; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgPosLLHDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgPosLLHDepA { tow: _buf.read_u32::()?, lat: _buf.read_f64::()?, lon: _buf.read_f64::()?, @@ -931,11 +913,10 @@ impl MsgPosLLHDepA { v_accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Baseline Position in ECEF // // This message reports the baseline solution in Earth Centered @@ -948,25 +929,25 @@ impl MsgPosLLHDepA { #[allow(non_snake_case)] pub struct MsgBaselineECEFDepA { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub x: i32, - // ^ Baseline ECEF X coordinate + // ^ Baseline ECEF X coordinate pub y: i32, - // ^ Baseline ECEF Y coordinate + // ^ Baseline ECEF Y coordinate pub z: i32, - // ^ Baseline ECEF Z coordinate + // ^ Baseline ECEF Z coordinate pub accuracy: u16, - // ^ Position accuracy estimate + // ^ Position accuracy estimate pub n_sats: u8, - // ^ Number of satellites used in solution + // ^ Number of satellites used in solution pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgBaselineECEFDepA { pub const TYPE: u16 = 514; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgBaselineECEFDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgBaselineECEFDepA { tow: _buf.read_u32::()?, x: _buf.read_i32::()?, y: _buf.read_i32::()?, @@ -974,11 +955,10 @@ impl MsgBaselineECEFDepA { accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Baseline in NED // // This message reports the baseline solution in North East Down @@ -992,27 +972,27 @@ impl MsgBaselineECEFDepA { #[allow(non_snake_case)] pub struct MsgBaselineNEDDepA { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub n: i32, - // ^ Baseline North coordinate + // ^ Baseline North coordinate pub e: i32, - // ^ Baseline East coordinate + // ^ Baseline East coordinate pub d: i32, - // ^ Baseline Down coordinate + // ^ Baseline Down coordinate pub h_accuracy: u16, - // ^ Horizontal position accuracy estimate (not implemented). Defaults to 0. + // ^ Horizontal position accuracy estimate (not implemented). Defaults to 0. pub v_accuracy: u16, - // ^ Vertical position accuracy estimate (not implemented). Defaults to 0. + // ^ Vertical position accuracy estimate (not implemented). Defaults to 0. pub n_sats: u8, - // ^ Number of satellites used in solution + // ^ Number of satellites used in solution pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgBaselineNEDDepA { pub const TYPE: u16 = 515; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgBaselineNEDDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgBaselineNEDDepA { tow: _buf.read_u32::()?, n: _buf.read_i32::()?, e: _buf.read_i32::()?, @@ -1021,11 +1001,10 @@ impl MsgBaselineNEDDepA { v_accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Velocity in ECEF // // This message reports the velocity in Earth Centered Earth Fixed @@ -1036,25 +1015,25 @@ impl MsgBaselineNEDDepA { #[allow(non_snake_case)] pub struct MsgVelECEFDepA { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub x: i32, - // ^ Velocity ECEF X coordinate + // ^ Velocity ECEF X coordinate pub y: i32, - // ^ Velocity ECEF Y coordinate + // ^ Velocity ECEF Y coordinate pub z: i32, - // ^ Velocity ECEF Z coordinate + // ^ Velocity ECEF Z coordinate pub accuracy: u16, - // ^ Velocity accuracy estimate (not implemented). Defaults to 0. + // ^ Velocity accuracy estimate (not implemented). Defaults to 0. pub n_sats: u8, - // ^ Number of satellites used in solution + // ^ Number of satellites used in solution pub flags: u8, - // ^ Status flags (reserved) + // ^ Status flags (reserved) } impl MsgVelECEFDepA { pub const TYPE: u16 = 516; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgVelECEFDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgVelECEFDepA { tow: _buf.read_u32::()?, x: _buf.read_i32::()?, y: _buf.read_i32::()?, @@ -1062,11 +1041,10 @@ impl MsgVelECEFDepA { accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Velocity in NED // // This message reports the velocity in local North East Down (NED) @@ -1078,27 +1056,27 @@ impl MsgVelECEFDepA { #[allow(non_snake_case)] pub struct MsgVelNEDDepA { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub n: i32, - // ^ Velocity North coordinate + // ^ Velocity North coordinate pub e: i32, - // ^ Velocity East coordinate + // ^ Velocity East coordinate pub d: i32, - // ^ Velocity Down coordinate + // ^ Velocity Down coordinate pub h_accuracy: u16, - // ^ Horizontal velocity accuracy estimate (not implemented). Defaults to 0. + // ^ Horizontal velocity accuracy estimate (not implemented). Defaults to 0. pub v_accuracy: u16, - // ^ Vertical velocity accuracy estimate (not implemented). Defaults to 0. + // ^ Vertical velocity accuracy estimate (not implemented). Defaults to 0. pub n_sats: u8, - // ^ Number of satellites used in solution + // ^ Number of satellites used in solution pub flags: u8, - // ^ Status flags (reserved) + // ^ Status flags (reserved) } impl MsgVelNEDDepA { pub const TYPE: u16 = 517; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgVelNEDDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgVelNEDDepA { tow: _buf.read_u32::()?, n: _buf.read_i32::()?, e: _buf.read_i32::()?, @@ -1107,11 +1085,10 @@ impl MsgVelNEDDepA { v_accuracy: _buf.read_u16::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Heading relative to True North // // This message reports the baseline heading pointing from the base station @@ -1122,24 +1099,23 @@ impl MsgVelNEDDepA { #[allow(non_snake_case)] pub struct MsgBaselineHeadingDepA { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub heading: u32, - // ^ Heading + // ^ Heading pub n_sats: u8, - // ^ Number of satellites used in solution + // ^ Number of satellites used in solution pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgBaselineHeadingDepA { pub const TYPE: u16 = 519; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgBaselineHeadingDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgBaselineHeadingDepA { tow: _buf.read_u32::()?, heading: _buf.read_u32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - diff --git a/rust/sbp/src/messages/ndb.rs b/rust/sbp/src/messages/ndb.rs index 7e2b8d5fda..ca48e896b7 100644 --- a/rust/sbp/src/messages/ndb.rs +++ b/rust/sbp/src/messages/ndb.rs @@ -12,14 +12,12 @@ // Automatically generated from yaml/swiftnav/sbp/ndb.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Messages for logging NDB events. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; +use self::byteorder::{LittleEndian, ReadBytesExt}; use super::gnss::*; - // Navigation DataBase Event // // This message is sent out when an object is stored into NDB. If needed @@ -29,33 +27,33 @@ use super::gnss::*; #[allow(non_snake_case)] pub struct MsgNdbEvent { pub recv_time: u64, - // ^ HW time in milliseconds. + // ^ HW time in milliseconds. pub event: u8, - // ^ Event type. + // ^ Event type. pub object_type: u8, - // ^ Event object type. + // ^ Event object type. pub result: u8, - // ^ Event result. + // ^ Event result. pub data_source: u8, - // ^ Data source for STORE event, reserved for other events. + // ^ Data source for STORE event, reserved for other events. pub object_sid: GnssSignal, - // ^ GNSS signal identifier, If object_type is Ephemeris OR Almanac, sid - // indicates for which signal the object belongs to. Reserved in other - // cases. + // ^ GNSS signal identifier, If object_type is Ephemeris OR Almanac, sid + // indicates for which signal the object belongs to. Reserved in other + // cases. pub src_sid: GnssSignal, - // ^ GNSS signal identifier, If object_type is Almanac, Almanac WN, Iono OR - // L2C capabilities AND data_source is NDB_DS_RECEIVER sid indicates from - // which SV data was decoded. Reserved in other cases. + // ^ GNSS signal identifier, If object_type is Almanac, Almanac WN, Iono OR + // L2C capabilities AND data_source is NDB_DS_RECEIVER sid indicates from + // which SV data was decoded. Reserved in other cases. pub original_sender: u16, - // ^ A unique identifier of the sending hardware. For v1.0, set to the 2 - // least significant bytes of the device serial number, valid only if - // data_source is NDB_DS_SBP. Reserved in case of other data_source. + // ^ A unique identifier of the sending hardware. For v1.0, set to the 2 + // least significant bytes of the device serial number, valid only if + // data_source is NDB_DS_SBP. Reserved in case of other data_source. } impl MsgNdbEvent { pub const TYPE: u16 = 1024; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgNdbEvent{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgNdbEvent { recv_time: _buf.read_u64::()?, event: _buf.read_u8()?, object_type: _buf.read_u8()?, @@ -64,7 +62,6 @@ impl MsgNdbEvent { object_sid: GnssSignal::parse(_buf)?, src_sid: GnssSignal::parse(_buf)?, original_sender: _buf.read_u16::()?, - } ) + }) } } - diff --git a/rust/sbp/src/messages/observation.rs b/rust/sbp/src/messages/observation.rs index 64e182396d..80a9bcc6e8 100644 --- a/rust/sbp/src/messages/observation.rs +++ b/rust/sbp/src/messages/observation.rs @@ -12,14 +12,12 @@ // Automatically generated from yaml/swiftnav/sbp/observation.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Satellite observation messages from the device. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; +use self::byteorder::{LittleEndian, ReadBytesExt}; use super::gnss::*; - // Header for observation message. // // Header of a GNSS observation message. @@ -28,37 +26,39 @@ use super::gnss::*; #[allow(non_snake_case)] pub struct ObservationHeader { pub t: GPSTime, - // ^ GNSS time of this observation + // ^ GNSS time of this observation pub n_obs: u8, - // ^ Total number of observations. First nibble is the size of the sequence - // (n), second nibble is the zero-indexed counter (ith packet of n) + // ^ Total number of observations. First nibble is the size of the sequence + // (n), second nibble is the zero-indexed counter (ith packet of n) } impl ObservationHeader { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( ObservationHeader{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(ObservationHeader { t: GPSTime::parse(_buf)?, n_obs: _buf.read_u8()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( ObservationHeader::parse(buf)? ); + v.push(ObservationHeader::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( ObservationHeader::parse(buf)? ); + v.push(ObservationHeader::parse(buf)?); } Ok(v) } } - // GNSS doppler measurement. // // Doppler measurement in Hz represented as a 24-bit @@ -70,71 +70,77 @@ impl ObservationHeader { #[allow(non_snake_case)] pub struct Doppler { pub i: i16, - // ^ Doppler whole Hz + // ^ Doppler whole Hz pub f: u8, - // ^ Doppler fractional part + // ^ Doppler fractional part } impl Doppler { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( Doppler{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(Doppler { i: _buf.read_i16::()?, f: _buf.read_u8()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( Doppler::parse(buf)? ); + v.push(Doppler::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( Doppler::parse(buf)? ); + v.push(Doppler::parse(buf)?); } Ok(v) } } - // GNSS observations for a particular satellite signal. // -// Pseudorange and carrier phase observation for a satellite being -// tracked. The observations are interoperable with 3rd party -// receivers and conform with typical RTCMv3 GNSS observations. +// Pseudorange and carrier phase observation for a satellite being tracked. +// The observations are interoperable with 3rd party receivers and conform with +// typical RTCM 3.1 message GPS/GLO observations. +// +// Carrier phase observations are not guaranteed to be aligned to the RINEX 3 +// or RTCM 3.3 MSM reference signal and no 1/4 cycle adjustments are currently +// peformed. // #[derive(Debug)] #[allow(non_snake_case)] pub struct PackedObsContent { pub P: u32, - // ^ Pseudorange observation + // ^ Pseudorange observation pub L: CarrierPhase, - // ^ Carrier phase observation with typical sign convention. + // ^ Carrier phase observation with typical sign convention. pub D: Doppler, - // ^ Doppler observation with typical sign convention. + // ^ Doppler observation with typical sign convention. pub cn0: u8, - // ^ Carrier-to-Noise density. Zero implies invalid cn0. + // ^ Carrier-to-Noise density. Zero implies invalid cn0. pub lock: u8, - // ^ Lock timer. This value gives an indication of the time for which a - // signal has maintained continuous phase lock. Whenever a signal has lost - // and regained lock, this value is reset to zero. It is encoded according - // to DF402 from the RTCM 10403.2 Amendment 2 specification. Valid values - // range from 0 to 15 and the most significant nibble is reserved for - // future use. + // ^ Lock timer. This value gives an indication of the time for which a + // signal has maintained continuous phase lock. Whenever a signal has lost + // and regained lock, this value is reset to zero. It is encoded according + // to DF402 from the RTCM 10403.2 Amendment 2 specification. Valid values + // range from 0 to 15 and the most significant nibble is reserved for + // future use. pub flags: u8, - // ^ Measurement status flags. A bit field of flags providing the status of - // this observation. If this field is 0 it means only the Cn0 estimate for - // the signal is valid. + // ^ Measurement status flags. A bit field of flags providing the status of + // this observation. If this field is 0 it means only the Cn0 estimate for + // the signal is valid. pub sid: GnssSignal, - // ^ GNSS signal identifier (16 bit) + // ^ GNSS signal identifier (16 bit) } impl PackedObsContent { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( PackedObsContent{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(PackedObsContent { P: _buf.read_u32::()?, L: CarrierPhase::parse(_buf)?, D: Doppler::parse(_buf)?, @@ -142,25 +148,90 @@ impl PackedObsContent { lock: _buf.read_u8()?, flags: _buf.read_u8()?, sid: GnssSignal::parse(_buf)?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( PackedObsContent::parse(buf)? ); + v.push(PackedObsContent::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( PackedObsContent::parse(buf)? ); + v.push(PackedObsContent::parse(buf)?); } Ok(v) } } +// Network correction for a particular satellite signal. +// +// Pseudorange and carrier phase network corrections for a satellite signal. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct PackedOsrContent { + pub P: u32, + // ^ Pseudorange observation + pub L: CarrierPhase, + // ^ Carrier phase observation with typical sign convention. + pub lock: u8, + // ^ Lock timer. This value gives an indication of the time for which a + // signal has maintained continuous phase lock. Whenever a signal has lost + // and regained lock, this value is reset to zero. It is encoded according + // to DF402 from the RTCM 10403.2 Amendment 2 specification. Valid values + // range from 0 to 15 and the most significant nibble is reserved for + // future use. + pub flags: u8, + // ^ Correction flags. + pub sid: GnssSignal, + // ^ GNSS signal identifier (16 bit) + pub iono_std: u16, + // ^ Slant ionospheric correction standard deviation + pub tropo_std: u16, + // ^ Slant tropospheric correction standard deviation + pub range_std: u16, + // ^ Orbit/clock/bias correction projected on range standard deviation +} + +impl PackedOsrContent { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(PackedOsrContent { + P: _buf.read_u32::()?, + L: CarrierPhase::parse(_buf)?, + lock: _buf.read_u8()?, + flags: _buf.read_u8()?, + sid: GnssSignal::parse(_buf)?, + iono_std: _buf.read_u16::()?, + tropo_std: _buf.read_u16::()?, + range_std: _buf.read_u16::()?, + }) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push(PackedOsrContent::parse(buf)?); + } + Ok(v) + } + + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(PackedOsrContent::parse(buf)?); + } + Ok(v) + } +} // GPS satellite observations // @@ -176,22 +247,21 @@ impl PackedObsContent { #[allow(non_snake_case)] pub struct MsgObs { pub header: ObservationHeader, - // ^ Header of a GPS observation message + // ^ Header of a GPS observation message pub obs: Vec, - // ^ Pseudorange and carrier phase observation for a satellite being tracked. + // ^ Pseudorange and carrier phase observation for a satellite being tracked. } impl MsgObs { pub const TYPE: u16 = 74; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgObs{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgObs { header: ObservationHeader::parse(_buf)?, obs: PackedObsContent::parse_array(_buf)?, - } ) + }) } } - // Base station position // // The base station position message is the position reported by @@ -204,25 +274,24 @@ impl MsgObs { #[allow(non_snake_case)] pub struct MsgBasePosLLH { pub lat: f64, - // ^ Latitude + // ^ Latitude pub lon: f64, - // ^ Longitude + // ^ Longitude pub height: f64, - // ^ Height + // ^ Height } impl MsgBasePosLLH { pub const TYPE: u16 = 68; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgBasePosLLH{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgBasePosLLH { lat: _buf.read_f64::()?, lon: _buf.read_f64::()?, height: _buf.read_f64::()?, - } ) + }) } } - // Base station position in ECEF // // The base station position message is the position reported by @@ -236,119 +305,177 @@ impl MsgBasePosLLH { #[allow(non_snake_case)] pub struct MsgBasePosECEF { pub x: f64, - // ^ ECEF X coodinate + // ^ ECEF X coodinate pub y: f64, - // ^ ECEF Y coordinate + // ^ ECEF Y coordinate pub z: f64, - // ^ ECEF Z coordinate + // ^ ECEF Z coordinate } impl MsgBasePosECEF { pub const TYPE: u16 = 72; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgBasePosECEF{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgBasePosECEF { x: _buf.read_f64::()?, y: _buf.read_f64::()?, z: _buf.read_f64::()?, - } ) + }) } } - #[derive(Debug)] #[allow(non_snake_case)] pub struct EphemerisCommonContent { pub sid: GnssSignal, - // ^ GNSS signal identifier (16 bit) + // ^ GNSS signal identifier (16 bit) pub toe: GPSTimeSec, - // ^ Time of Ephemerides - pub ura: f64, - // ^ User Range Accuracy + // ^ Time of Ephemerides + pub ura: f32, + // ^ User Range Accuracy pub fit_interval: u32, - // ^ Curve fit interval + // ^ Curve fit interval pub valid: u8, - // ^ Status of ephemeris, 1 = valid, 0 = invalid + // ^ Status of ephemeris, 1 = valid, 0 = invalid pub health_bits: u8, - // ^ Satellite health status. GPS: ICD-GPS-200, chapter 20.3.3.3.1.4 SBAS: 0 - // = valid, non-zero = invalid GLO: 0 = valid, non-zero = invalid + // ^ Satellite health status. GPS: ICD-GPS-200, chapter 20.3.3.3.1.4 SBAS: 0 + // = valid, non-zero = invalid GLO: 0 = valid, non-zero = invalid } impl EphemerisCommonContent { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( EphemerisCommonContent{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(EphemerisCommonContent { sid: GnssSignal::parse(_buf)?, toe: GPSTimeSec::parse(_buf)?, - ura: _buf.read_f64::()?, + ura: _buf.read_f32::()?, fit_interval: _buf.read_u32::()?, valid: _buf.read_u8()?, health_bits: _buf.read_u8()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( EphemerisCommonContent::parse(buf)? ); + v.push(EphemerisCommonContent::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( EphemerisCommonContent::parse(buf)? ); + v.push(EphemerisCommonContent::parse(buf)?); } Ok(v) } } +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct EphemerisCommonContentDepB { + pub sid: GnssSignal, + // ^ GNSS signal identifier (16 bit) + pub toe: GPSTimeSec, + // ^ Time of Ephemerides + pub ura: f64, + // ^ User Range Accuracy + pub fit_interval: u32, + // ^ Curve fit interval + pub valid: u8, + // ^ Status of ephemeris, 1 = valid, 0 = invalid + pub health_bits: u8, + // ^ Satellite health status. GPS: ICD-GPS-200, chapter 20.3.3.3.1.4 Others: + // 0 = valid, non-zero = invalid +} + +impl EphemerisCommonContentDepB { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(EphemerisCommonContentDepB { + sid: GnssSignal::parse(_buf)?, + toe: GPSTimeSec::parse(_buf)?, + ura: _buf.read_f64::()?, + fit_interval: _buf.read_u32::()?, + valid: _buf.read_u8()?, + health_bits: _buf.read_u8()?, + }) + } + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push(EphemerisCommonContentDepB::parse(buf)?); + } + Ok(v) + } + + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(EphemerisCommonContentDepB::parse(buf)?); + } + Ok(v) + } +} #[derive(Debug)] #[allow(non_snake_case)] pub struct EphemerisCommonContentDepA { pub sid: GnssSignalDep, - // ^ GNSS signal identifier + // ^ GNSS signal identifier pub toe: GPSTimeDep, - // ^ Time of Ephemerides + // ^ Time of Ephemerides pub ura: f64, - // ^ User Range Accuracy + // ^ User Range Accuracy pub fit_interval: u32, - // ^ Curve fit interval + // ^ Curve fit interval pub valid: u8, - // ^ Status of ephemeris, 1 = valid, 0 = invalid + // ^ Status of ephemeris, 1 = valid, 0 = invalid pub health_bits: u8, - // ^ Satellite health status. GPS: ICD-GPS-200, chapter 20.3.3.3.1.4 SBAS: 0 - // = valid, non-zero = invalid GLO: 0 = valid, non-zero = invalid + // ^ Satellite health status. GPS: ICD-GPS-200, chapter 20.3.3.3.1.4 SBAS: 0 + // = valid, non-zero = invalid GLO: 0 = valid, non-zero = invalid } impl EphemerisCommonContentDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( EphemerisCommonContentDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(EphemerisCommonContentDepA { sid: GnssSignalDep::parse(_buf)?, toe: GPSTimeDep::parse(_buf)?, ura: _buf.read_f64::()?, fit_interval: _buf.read_u32::()?, valid: _buf.read_u8()?, health_bits: _buf.read_u8()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( EphemerisCommonContentDepA::parse(buf)? ); + v.push(EphemerisCommonContentDepA::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( EphemerisCommonContentDepA::parse(buf)? ); + v.push(EphemerisCommonContentDepA::parse(buf)?); } Ok(v) } } - // Satellite broadcast ephemeris for GPS // // The ephemeris message returns a set of satellite orbit @@ -361,61 +488,61 @@ impl EphemerisCommonContentDepA { #[allow(non_snake_case)] pub struct MsgEphemerisGPSDepE { pub common: EphemerisCommonContentDepA, - // ^ Values common for all ephemeris types + // ^ Values common for all ephemeris types pub tgd: f64, - // ^ Group delay differential between L1 and L2 + // ^ Group delay differential between L1 and L2 pub c_rs: f64, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + // ^ Amplitude of the sine harmonic correction term to the orbit radius pub c_rc: f64, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + // ^ Amplitude of the cosine harmonic correction term to the orbit radius pub c_uc: f64, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude pub c_us: f64, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude pub c_ic: f64, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination pub c_is: f64, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination pub dn: f64, - // ^ Mean motion difference + // ^ Mean motion difference pub m0: f64, - // ^ Mean anomaly at reference time + // ^ Mean anomaly at reference time pub ecc: f64, - // ^ Eccentricity of satellite orbit + // ^ Eccentricity of satellite orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + // ^ Square root of the semi-major axis of orbit pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + // ^ Longitude of ascending node of orbit plane at weekly epoch pub omegadot: f64, - // ^ Rate of right ascension + // ^ Rate of right ascension pub w: f64, - // ^ Argument of perigee + // ^ Argument of perigee pub inc: f64, - // ^ Inclination + // ^ Inclination pub inc_dot: f64, - // ^ Inclination first derivative + // ^ Inclination first derivative pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + // ^ Polynomial clock correction coefficient (clock bias) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) + // ^ Polynomial clock correction coefficient (clock drift) pub af2: f64, - // ^ Polynomial clock correction coefficient (rate of clock drift) + // ^ Polynomial clock correction coefficient (rate of clock drift) pub toc: GPSTimeDep, - // ^ Clock reference + // ^ Clock reference pub iode: u8, - // ^ Issue of ephemeris data + // ^ Issue of ephemeris data pub iodc: u16, - // ^ Issue of clock data + // ^ Issue of clock data } impl MsgEphemerisGPSDepE { pub const TYPE: u16 = 129; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgEphemerisGPSDepE{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisGPSDepE { common: EphemerisCommonContentDepA::parse(_buf)?, tgd: _buf.read_f64::()?, c_rs: _buf.read_f64::()?, @@ -439,79 +566,75 @@ impl MsgEphemerisGPSDepE { toc: GPSTimeDep::parse(_buf)?, iode: _buf.read_u8()?, iodc: _buf.read_u16::()?, - } ) + }) } } - -// Satellite broadcast ephemeris for GPS +// Deprecated // -// The ephemeris message returns a set of satellite orbit -// parameters that is used to calculate GPS satellite position, -// velocity, and clock offset. Please see the Navstar GPS -// Space Segment/Navigation user interfaces (ICD-GPS-200, Table -// 20-III) for more details. +// This observation message has been deprecated in favor of +// ephemeris message using floats for size reduction. // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgEphemerisGPS { - pub common: EphemerisCommonContent, - // ^ Values common for all ephemeris types +pub struct MsgEphemerisGPSDepF { + pub common: EphemerisCommonContentDepB, + // ^ Values common for all ephemeris types pub tgd: f64, - // ^ Group delay differential between L1 and L2 + // ^ Group delay differential between L1 and L2 pub c_rs: f64, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + // ^ Amplitude of the sine harmonic correction term to the orbit radius pub c_rc: f64, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + // ^ Amplitude of the cosine harmonic correction term to the orbit radius pub c_uc: f64, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude pub c_us: f64, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude pub c_ic: f64, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination pub c_is: f64, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination pub dn: f64, - // ^ Mean motion difference + // ^ Mean motion difference pub m0: f64, - // ^ Mean anomaly at reference time + // ^ Mean anomaly at reference time pub ecc: f64, - // ^ Eccentricity of satellite orbit + // ^ Eccentricity of satellite orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + // ^ Square root of the semi-major axis of orbit pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + // ^ Longitude of ascending node of orbit plane at weekly epoch pub omegadot: f64, - // ^ Rate of right ascension + // ^ Rate of right ascension pub w: f64, - // ^ Argument of perigee + // ^ Argument of perigee pub inc: f64, - // ^ Inclination + // ^ Inclination pub inc_dot: f64, - // ^ Inclination first derivative + // ^ Inclination first derivative pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + // ^ Polynomial clock correction coefficient (clock bias) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) + // ^ Polynomial clock correction coefficient (clock drift) pub af2: f64, - // ^ Polynomial clock correction coefficient (rate of clock drift) + // ^ Polynomial clock correction coefficient (rate of clock drift) pub toc: GPSTimeSec, - // ^ Clock reference + // ^ Clock reference pub iode: u8, - // ^ Issue of ephemeris data + // ^ Issue of ephemeris data pub iodc: u16, - // ^ Issue of clock data + // ^ Issue of clock data } -impl MsgEphemerisGPS { +impl MsgEphemerisGPSDepF { pub const TYPE: u16 = 134; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgEphemerisGPS{ - common: EphemerisCommonContent::parse(_buf)?, + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisGPSDepF { + common: EphemerisCommonContentDepB::parse(_buf)?, tgd: _buf.read_f64::()?, c_rs: _buf.read_f64::()?, c_rc: _buf.read_f64::()?, @@ -534,43 +657,516 @@ impl MsgEphemerisGPS { toc: GPSTimeSec::parse(_buf)?, iode: _buf.read_u8()?, iodc: _buf.read_u16::()?, - } ) + }) + } +} + +// Satellite broadcast ephemeris for GPS +// +// The ephemeris message returns a set of satellite orbit +// parameters that is used to calculate GPS satellite position, +// velocity, and clock offset. Please see the Navstar GPS +// Space Segment/Navigation user interfaces (ICD-GPS-200, Table +// 20-III) for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisGPS { + pub common: EphemerisCommonContent, + // ^ Values common for all ephemeris types + pub tgd: f32, + // ^ Group delay differential between L1 and L2 + pub c_rs: f32, + // ^ Amplitude of the sine harmonic correction term to the orbit radius + pub c_rc: f32, + // ^ Amplitude of the cosine harmonic correction term to the orbit radius + pub c_uc: f32, + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude + pub c_us: f32, + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude + pub c_ic: f32, + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination + pub c_is: f32, + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination + pub dn: f64, + // ^ Mean motion difference + pub m0: f64, + // ^ Mean anomaly at reference time + pub ecc: f64, + // ^ Eccentricity of satellite orbit + pub sqrta: f64, + // ^ Square root of the semi-major axis of orbit + pub omega0: f64, + // ^ Longitude of ascending node of orbit plane at weekly epoch + pub omegadot: f64, + // ^ Rate of right ascension + pub w: f64, + // ^ Argument of perigee + pub inc: f64, + // ^ Inclination + pub inc_dot: f64, + // ^ Inclination first derivative + pub af0: f32, + // ^ Polynomial clock correction coefficient (clock bias) + pub af1: f32, + // ^ Polynomial clock correction coefficient (clock drift) + pub af2: f32, + // ^ Polynomial clock correction coefficient (rate of clock drift) + pub toc: GPSTimeSec, + // ^ Clock reference + pub iode: u8, + // ^ Issue of ephemeris data + pub iodc: u16, + // ^ Issue of clock data +} + +impl MsgEphemerisGPS { + pub const TYPE: u16 = 138; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisGPS { + common: EphemerisCommonContent::parse(_buf)?, + tgd: _buf.read_f32::()?, + c_rs: _buf.read_f32::()?, + c_rc: _buf.read_f32::()?, + c_uc: _buf.read_f32::()?, + c_us: _buf.read_f32::()?, + c_ic: _buf.read_f32::()?, + c_is: _buf.read_f32::()?, + dn: _buf.read_f64::()?, + m0: _buf.read_f64::()?, + ecc: _buf.read_f64::()?, + sqrta: _buf.read_f64::()?, + omega0: _buf.read_f64::()?, + omegadot: _buf.read_f64::()?, + w: _buf.read_f64::()?, + inc: _buf.read_f64::()?, + inc_dot: _buf.read_f64::()?, + af0: _buf.read_f32::()?, + af1: _buf.read_f32::()?, + af2: _buf.read_f32::()?, + toc: GPSTimeSec::parse(_buf)?, + iode: _buf.read_u8()?, + iodc: _buf.read_u16::()?, + }) + } +} + +// Satellite broadcast ephemeris for QZSS +// +// The ephemeris message returns a set of satellite orbit +// parameters that is used to calculate QZSS satellite position, +// velocity, and clock offset. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisQzss { + pub common: EphemerisCommonContent, + // ^ Values common for all ephemeris types + pub tgd: f32, + // ^ Group delay differential between L1 and L2 + pub c_rs: f32, + // ^ Amplitude of the sine harmonic correction term to the orbit radius + pub c_rc: f32, + // ^ Amplitude of the cosine harmonic correction term to the orbit radius + pub c_uc: f32, + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude + pub c_us: f32, + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude + pub c_ic: f32, + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination + pub c_is: f32, + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination + pub dn: f64, + // ^ Mean motion difference + pub m0: f64, + // ^ Mean anomaly at reference time + pub ecc: f64, + // ^ Eccentricity of satellite orbit + pub sqrta: f64, + // ^ Square root of the semi-major axis of orbit + pub omega0: f64, + // ^ Longitude of ascending node of orbit plane at weekly epoch + pub omegadot: f64, + // ^ Rate of right ascension + pub w: f64, + // ^ Argument of perigee + pub inc: f64, + // ^ Inclination + pub inc_dot: f64, + // ^ Inclination first derivative + pub af0: f32, + // ^ Polynomial clock correction coefficient (clock bias) + pub af1: f32, + // ^ Polynomial clock correction coefficient (clock drift) + pub af2: f32, + // ^ Polynomial clock correction coefficient (rate of clock drift) + pub toc: GPSTimeSec, + // ^ Clock reference + pub iode: u8, + // ^ Issue of ephemeris data + pub iodc: u16, + // ^ Issue of clock data +} + +impl MsgEphemerisQzss { + pub const TYPE: u16 = 142; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisQzss { + common: EphemerisCommonContent::parse(_buf)?, + tgd: _buf.read_f32::()?, + c_rs: _buf.read_f32::()?, + c_rc: _buf.read_f32::()?, + c_uc: _buf.read_f32::()?, + c_us: _buf.read_f32::()?, + c_ic: _buf.read_f32::()?, + c_is: _buf.read_f32::()?, + dn: _buf.read_f64::()?, + m0: _buf.read_f64::()?, + ecc: _buf.read_f64::()?, + sqrta: _buf.read_f64::()?, + omega0: _buf.read_f64::()?, + omegadot: _buf.read_f64::()?, + w: _buf.read_f64::()?, + inc: _buf.read_f64::()?, + inc_dot: _buf.read_f64::()?, + af0: _buf.read_f32::()?, + af1: _buf.read_f32::()?, + af2: _buf.read_f32::()?, + toc: GPSTimeSec::parse(_buf)?, + iode: _buf.read_u8()?, + iodc: _buf.read_u16::()?, + }) + } +} + +// Satellite broadcast ephemeris for BDS +// +// The ephemeris message returns a set of satellite orbit +// parameters that is used to calculate BDS satellite position, +// velocity, and clock offset. Please see the BeiDou Navigation +// Satellite System SIS-ICD Version 2.1, Table 5-9 for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisBds { + pub common: EphemerisCommonContent, + // ^ Values common for all ephemeris types + pub tgd1: f32, + // ^ Group delay differential for B1 + pub tgd2: f32, + // ^ Group delay differential for B2 + pub c_rs: f32, + // ^ Amplitude of the sine harmonic correction term to the orbit radius + pub c_rc: f32, + // ^ Amplitude of the cosine harmonic correction term to the orbit radius + pub c_uc: f32, + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude + pub c_us: f32, + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude + pub c_ic: f32, + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination + pub c_is: f32, + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination + pub dn: f64, + // ^ Mean motion difference + pub m0: f64, + // ^ Mean anomaly at reference time + pub ecc: f64, + // ^ Eccentricity of satellite orbit + pub sqrta: f64, + // ^ Square root of the semi-major axis of orbit + pub omega0: f64, + // ^ Longitude of ascending node of orbit plane at weekly epoch + pub omegadot: f64, + // ^ Rate of right ascension + pub w: f64, + // ^ Argument of perigee + pub inc: f64, + // ^ Inclination + pub inc_dot: f64, + // ^ Inclination first derivative + pub af0: f64, + // ^ Polynomial clock correction coefficient (clock bias) + pub af1: f32, + // ^ Polynomial clock correction coefficient (clock drift) + pub af2: f32, + // ^ Polynomial clock correction coefficient (rate of clock drift) + pub toc: GPSTimeSec, + // ^ Clock reference + pub iode: u8, + // ^ Issue of ephemeris data + pub iodc: u16, + // ^ Issue of clock data +} + +impl MsgEphemerisBds { + pub const TYPE: u16 = 137; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisBds { + common: EphemerisCommonContent::parse(_buf)?, + tgd1: _buf.read_f32::()?, + tgd2: _buf.read_f32::()?, + c_rs: _buf.read_f32::()?, + c_rc: _buf.read_f32::()?, + c_uc: _buf.read_f32::()?, + c_us: _buf.read_f32::()?, + c_ic: _buf.read_f32::()?, + c_is: _buf.read_f32::()?, + dn: _buf.read_f64::()?, + m0: _buf.read_f64::()?, + ecc: _buf.read_f64::()?, + sqrta: _buf.read_f64::()?, + omega0: _buf.read_f64::()?, + omegadot: _buf.read_f64::()?, + w: _buf.read_f64::()?, + inc: _buf.read_f64::()?, + inc_dot: _buf.read_f64::()?, + af0: _buf.read_f64::()?, + af1: _buf.read_f32::()?, + af2: _buf.read_f32::()?, + toc: GPSTimeSec::parse(_buf)?, + iode: _buf.read_u8()?, + iodc: _buf.read_u16::()?, + }) + } +} + +// Deprecated +// +// This observation message has been deprecated in favor of +// an ephemeris message with explicit source of NAV data. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisGalDepA { + pub common: EphemerisCommonContent, + // ^ Values common for all ephemeris types + pub bgd_e1e5a: f32, + // ^ E1-E5a Broadcast Group Delay + pub bgd_e1e5b: f32, + // ^ E1-E5b Broadcast Group Delay + pub c_rs: f32, + // ^ Amplitude of the sine harmonic correction term to the orbit radius + pub c_rc: f32, + // ^ Amplitude of the cosine harmonic correction term to the orbit radius + pub c_uc: f32, + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude + pub c_us: f32, + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude + pub c_ic: f32, + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination + pub c_is: f32, + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination + pub dn: f64, + // ^ Mean motion difference + pub m0: f64, + // ^ Mean anomaly at reference time + pub ecc: f64, + // ^ Eccentricity of satellite orbit + pub sqrta: f64, + // ^ Square root of the semi-major axis of orbit + pub omega0: f64, + // ^ Longitude of ascending node of orbit plane at weekly epoch + pub omegadot: f64, + // ^ Rate of right ascension + pub w: f64, + // ^ Argument of perigee + pub inc: f64, + // ^ Inclination + pub inc_dot: f64, + // ^ Inclination first derivative + pub af0: f64, + // ^ Polynomial clock correction coefficient (clock bias) + pub af1: f64, + // ^ Polynomial clock correction coefficient (clock drift) + pub af2: f32, + // ^ Polynomial clock correction coefficient (rate of clock drift) + pub toc: GPSTimeSec, + // ^ Clock reference + pub iode: u16, + // ^ Issue of ephemeris data + pub iodc: u16, + // ^ Issue of clock data +} + +impl MsgEphemerisGalDepA { + pub const TYPE: u16 = 149; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisGalDepA { + common: EphemerisCommonContent::parse(_buf)?, + bgd_e1e5a: _buf.read_f32::()?, + bgd_e1e5b: _buf.read_f32::()?, + c_rs: _buf.read_f32::()?, + c_rc: _buf.read_f32::()?, + c_uc: _buf.read_f32::()?, + c_us: _buf.read_f32::()?, + c_ic: _buf.read_f32::()?, + c_is: _buf.read_f32::()?, + dn: _buf.read_f64::()?, + m0: _buf.read_f64::()?, + ecc: _buf.read_f64::()?, + sqrta: _buf.read_f64::()?, + omega0: _buf.read_f64::()?, + omegadot: _buf.read_f64::()?, + w: _buf.read_f64::()?, + inc: _buf.read_f64::()?, + inc_dot: _buf.read_f64::()?, + af0: _buf.read_f64::()?, + af1: _buf.read_f64::()?, + af2: _buf.read_f32::()?, + toc: GPSTimeSec::parse(_buf)?, + iode: _buf.read_u16::()?, + iodc: _buf.read_u16::()?, + }) } } +// Satellite broadcast ephemeris for Galileo +// +// The ephemeris message returns a set of satellite orbit +// parameters that is used to calculate Galileo satellite position, +// velocity, and clock offset. Please see the Signal In Space ICD +// OS SIS ICD, Issue 1.3, December 2016 for more details. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisGal { + pub common: EphemerisCommonContent, + // ^ Values common for all ephemeris types + pub bgd_e1e5a: f32, + // ^ E1-E5a Broadcast Group Delay + pub bgd_e1e5b: f32, + // ^ E1-E5b Broadcast Group Delay + pub c_rs: f32, + // ^ Amplitude of the sine harmonic correction term to the orbit radius + pub c_rc: f32, + // ^ Amplitude of the cosine harmonic correction term to the orbit radius + pub c_uc: f32, + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude + pub c_us: f32, + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude + pub c_ic: f32, + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination + pub c_is: f32, + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination + pub dn: f64, + // ^ Mean motion difference + pub m0: f64, + // ^ Mean anomaly at reference time + pub ecc: f64, + // ^ Eccentricity of satellite orbit + pub sqrta: f64, + // ^ Square root of the semi-major axis of orbit + pub omega0: f64, + // ^ Longitude of ascending node of orbit plane at weekly epoch + pub omegadot: f64, + // ^ Rate of right ascension + pub w: f64, + // ^ Argument of perigee + pub inc: f64, + // ^ Inclination + pub inc_dot: f64, + // ^ Inclination first derivative + pub af0: f64, + // ^ Polynomial clock correction coefficient (clock bias) + pub af1: f64, + // ^ Polynomial clock correction coefficient (clock drift) + pub af2: f32, + // ^ Polynomial clock correction coefficient (rate of clock drift) + pub toc: GPSTimeSec, + // ^ Clock reference + pub iode: u16, + // ^ Issue of ephemeris data + pub iodc: u16, + // ^ Issue of clock data + pub source: u8, + // ^ 0=I/NAV, 1=F/NAV, ... +} + +impl MsgEphemerisGal { + pub const TYPE: u16 = 141; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisGal { + common: EphemerisCommonContent::parse(_buf)?, + bgd_e1e5a: _buf.read_f32::()?, + bgd_e1e5b: _buf.read_f32::()?, + c_rs: _buf.read_f32::()?, + c_rc: _buf.read_f32::()?, + c_uc: _buf.read_f32::()?, + c_us: _buf.read_f32::()?, + c_ic: _buf.read_f32::()?, + c_is: _buf.read_f32::()?, + dn: _buf.read_f64::()?, + m0: _buf.read_f64::()?, + ecc: _buf.read_f64::()?, + sqrta: _buf.read_f64::()?, + omega0: _buf.read_f64::()?, + omegadot: _buf.read_f64::()?, + w: _buf.read_f64::()?, + inc: _buf.read_f64::()?, + inc_dot: _buf.read_f64::()?, + af0: _buf.read_f64::()?, + af1: _buf.read_f64::()?, + af2: _buf.read_f32::()?, + toc: GPSTimeSec::parse(_buf)?, + iode: _buf.read_u16::()?, + iodc: _buf.read_u16::()?, + source: _buf.read_u8()?, + }) + } +} #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisSbasDepA { pub common: EphemerisCommonContentDepA, - // ^ Values common for all ephemeris types + // ^ Values common for all ephemeris types pub pos: Vec, - // ^ Position of the GEO at time toe + // ^ Position of the GEO at time toe pub vel: Vec, - // ^ Velocity of the GEO at time toe + // ^ Velocity of the GEO at time toe pub acc: Vec, - // ^ Acceleration of the GEO at time toe + // ^ Acceleration of the GEO at time toe pub a_gf0: f64, - // ^ Time offset of the GEO clock w.r.t. SBAS Network Time + // ^ Time offset of the GEO clock w.r.t. SBAS Network Time pub a_gf1: f64, - // ^ Drift of the GEO clock w.r.t. SBAS Network Time + // ^ Drift of the GEO clock w.r.t. SBAS Network Time } impl MsgEphemerisSbasDepA { pub const TYPE: u16 = 130; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgEphemerisSbasDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisSbasDepA { common: EphemerisCommonContentDepA::parse(_buf)?, - pos: ::read_double_array_limit(_buf, 3)?, - vel: ::read_double_array_limit(_buf, 3)?, - acc: ::read_double_array_limit(_buf, 3)?, + pos: ::parser::read_double_array_limit(_buf, 3)?, + vel: ::parser::read_double_array_limit(_buf, 3)?, + acc: ::parser::read_double_array_limit(_buf, 3)?, a_gf0: _buf.read_f64::()?, a_gf1: _buf.read_f64::()?, - } ) + }) } } - // Satellite broadcast ephemeris for GLO // // The ephemeris message returns a set of satellite orbit @@ -583,65 +1179,99 @@ impl MsgEphemerisSbasDepA { #[allow(non_snake_case)] pub struct MsgEphemerisGloDepA { pub common: EphemerisCommonContentDepA, - // ^ Values common for all ephemeris types + // ^ Values common for all ephemeris types pub gamma: f64, - // ^ Relative deviation of predicted carrier frequency from nominal + // ^ Relative deviation of predicted carrier frequency from nominal pub tau: f64, - // ^ Correction to the SV time + // ^ Correction to the SV time pub pos: Vec, - // ^ Position of the SV at tb in PZ-90.02 coordinates system + // ^ Position of the SV at tb in PZ-90.02 coordinates system pub vel: Vec, - // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system + // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system pub acc: Vec, - // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys + // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys } impl MsgEphemerisGloDepA { pub const TYPE: u16 = 131; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgEphemerisGloDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisGloDepA { common: EphemerisCommonContentDepA::parse(_buf)?, gamma: _buf.read_f64::()?, tau: _buf.read_f64::()?, - pos: ::read_double_array_limit(_buf, 3)?, - vel: ::read_double_array_limit(_buf, 3)?, - acc: ::read_double_array_limit(_buf, 3)?, - } ) + pos: ::parser::read_double_array_limit(_buf, 3)?, + vel: ::parser::read_double_array_limit(_buf, 3)?, + acc: ::parser::read_double_array_limit(_buf, 3)?, + }) } } - +// Deprecated +// +// This observation message has been deprecated in favor of +// ephemeris message using floats for size reduction. +// #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgEphemerisSbas { - pub common: EphemerisCommonContent, - // ^ Values common for all ephemeris types +pub struct MsgEphemerisSbasDepB { + pub common: EphemerisCommonContentDepB, + // ^ Values common for all ephemeris types pub pos: Vec, - // ^ Position of the GEO at time toe + // ^ Position of the GEO at time toe pub vel: Vec, - // ^ Velocity of the GEO at time toe + // ^ Velocity of the GEO at time toe pub acc: Vec, - // ^ Acceleration of the GEO at time toe + // ^ Acceleration of the GEO at time toe pub a_gf0: f64, - // ^ Time offset of the GEO clock w.r.t. SBAS Network Time + // ^ Time offset of the GEO clock w.r.t. SBAS Network Time pub a_gf1: f64, - // ^ Drift of the GEO clock w.r.t. SBAS Network Time + // ^ Drift of the GEO clock w.r.t. SBAS Network Time } -impl MsgEphemerisSbas { +impl MsgEphemerisSbasDepB { pub const TYPE: u16 = 132; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgEphemerisSbas{ - common: EphemerisCommonContent::parse(_buf)?, - pos: ::read_double_array_limit(_buf, 3)?, - vel: ::read_double_array_limit(_buf, 3)?, - acc: ::read_double_array_limit(_buf, 3)?, + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisSbasDepB { + common: EphemerisCommonContentDepB::parse(_buf)?, + pos: ::parser::read_double_array_limit(_buf, 3)?, + vel: ::parser::read_double_array_limit(_buf, 3)?, + acc: ::parser::read_double_array_limit(_buf, 3)?, a_gf0: _buf.read_f64::()?, a_gf1: _buf.read_f64::()?, - } ) + }) } } +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisSbas { + pub common: EphemerisCommonContent, + // ^ Values common for all ephemeris types + pub pos: Vec, + // ^ Position of the GEO at time toe + pub vel: Vec, + // ^ Velocity of the GEO at time toe + pub acc: Vec, + // ^ Acceleration of the GEO at time toe + pub a_gf0: f32, + // ^ Time offset of the GEO clock w.r.t. SBAS Network Time + pub a_gf1: f32, + // ^ Drift of the GEO clock w.r.t. SBAS Network Time +} + +impl MsgEphemerisSbas { + pub const TYPE: u16 = 140; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisSbas { + common: EphemerisCommonContent::parse(_buf)?, + pos: ::parser::read_double_array_limit(_buf, 3)?, + vel: ::parser::read_float_array_limit(_buf, 3)?, + acc: ::parser::read_float_array_limit(_buf, 3)?, + a_gf0: _buf.read_f32::()?, + a_gf1: _buf.read_f32::()?, + }) + } +} // Satellite broadcast ephemeris for GLO // @@ -654,35 +1284,34 @@ impl MsgEphemerisSbas { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGloDepB { - pub common: EphemerisCommonContent, - // ^ Values common for all ephemeris types + pub common: EphemerisCommonContentDepB, + // ^ Values common for all ephemeris types pub gamma: f64, - // ^ Relative deviation of predicted carrier frequency from nominal + // ^ Relative deviation of predicted carrier frequency from nominal pub tau: f64, - // ^ Correction to the SV time + // ^ Correction to the SV time pub pos: Vec, - // ^ Position of the SV at tb in PZ-90.02 coordinates system + // ^ Position of the SV at tb in PZ-90.02 coordinates system pub vel: Vec, - // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system + // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system pub acc: Vec, - // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys + // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys } impl MsgEphemerisGloDepB { pub const TYPE: u16 = 133; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgEphemerisGloDepB{ - common: EphemerisCommonContent::parse(_buf)?, + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisGloDepB { + common: EphemerisCommonContentDepB::parse(_buf)?, gamma: _buf.read_f64::()?, tau: _buf.read_f64::()?, - pos: ::read_double_array_limit(_buf, 3)?, - vel: ::read_double_array_limit(_buf, 3)?, - acc: ::read_double_array_limit(_buf, 3)?, - } ) + pos: ::parser::read_double_array_limit(_buf, 3)?, + vel: ::parser::read_double_array_limit(_buf, 3)?, + acc: ::parser::read_double_array_limit(_buf, 3)?, + }) } } - // Satellite broadcast ephemeris for GLO // // The ephemeris message returns a set of satellite orbit @@ -694,40 +1323,84 @@ impl MsgEphemerisGloDepB { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGloDepC { - pub common: EphemerisCommonContent, - // ^ Values common for all ephemeris types + pub common: EphemerisCommonContentDepB, + // ^ Values common for all ephemeris types pub gamma: f64, - // ^ Relative deviation of predicted carrier frequency from nominal + // ^ Relative deviation of predicted carrier frequency from nominal pub tau: f64, - // ^ Correction to the SV time + // ^ Correction to the SV time pub d_tau: f64, - // ^ Equipment delay between L1 and L2 + // ^ Equipment delay between L1 and L2 pub pos: Vec, - // ^ Position of the SV at tb in PZ-90.02 coordinates system + // ^ Position of the SV at tb in PZ-90.02 coordinates system pub vel: Vec, - // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system + // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system pub acc: Vec, - // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys + // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys pub fcn: u8, - // ^ Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for invalid + // ^ Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for invalid } impl MsgEphemerisGloDepC { pub const TYPE: u16 = 135; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgEphemerisGloDepC{ - common: EphemerisCommonContent::parse(_buf)?, + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisGloDepC { + common: EphemerisCommonContentDepB::parse(_buf)?, gamma: _buf.read_f64::()?, tau: _buf.read_f64::()?, d_tau: _buf.read_f64::()?, - pos: ::read_double_array_limit(_buf, 3)?, - vel: ::read_double_array_limit(_buf, 3)?, - acc: ::read_double_array_limit(_buf, 3)?, + pos: ::parser::read_double_array_limit(_buf, 3)?, + vel: ::parser::read_double_array_limit(_buf, 3)?, + acc: ::parser::read_double_array_limit(_buf, 3)?, fcn: _buf.read_u8()?, - } ) + }) } } +// Deprecated +// +// This observation message has been deprecated in favor of +// ephemeris message using floats for size reduction. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgEphemerisGloDepD { + pub common: EphemerisCommonContentDepB, + // ^ Values common for all ephemeris types + pub gamma: f64, + // ^ Relative deviation of predicted carrier frequency from nominal + pub tau: f64, + // ^ Correction to the SV time + pub d_tau: f64, + // ^ Equipment delay between L1 and L2 + pub pos: Vec, + // ^ Position of the SV at tb in PZ-90.02 coordinates system + pub vel: Vec, + // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system + pub acc: Vec, + // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys + pub fcn: u8, + // ^ Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for invalid + pub iod: u8, + // ^ Issue of ephemeris data +} + +impl MsgEphemerisGloDepD { + pub const TYPE: u16 = 136; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisGloDepD { + common: EphemerisCommonContentDepB::parse(_buf)?, + gamma: _buf.read_f64::()?, + tau: _buf.read_f64::()?, + d_tau: _buf.read_f64::()?, + pos: ::parser::read_double_array_limit(_buf, 3)?, + vel: ::parser::read_double_array_limit(_buf, 3)?, + acc: ::parser::read_double_array_limit(_buf, 3)?, + fcn: _buf.read_u8()?, + iod: _buf.read_u8()?, + }) + } +} // Satellite broadcast ephemeris for GLO // @@ -741,43 +1414,42 @@ impl MsgEphemerisGloDepC { #[allow(non_snake_case)] pub struct MsgEphemerisGlo { pub common: EphemerisCommonContent, - // ^ Values common for all ephemeris types - pub gamma: f64, - // ^ Relative deviation of predicted carrier frequency from nominal - pub tau: f64, - // ^ Correction to the SV time - pub d_tau: f64, - // ^ Equipment delay between L1 and L2 + // ^ Values common for all ephemeris types + pub gamma: f32, + // ^ Relative deviation of predicted carrier frequency from nominal + pub tau: f32, + // ^ Correction to the SV time + pub d_tau: f32, + // ^ Equipment delay between L1 and L2 pub pos: Vec, - // ^ Position of the SV at tb in PZ-90.02 coordinates system + // ^ Position of the SV at tb in PZ-90.02 coordinates system pub vel: Vec, - // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system - pub acc: Vec, - // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys + // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system + pub acc: Vec, + // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys pub fcn: u8, - // ^ Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for invalid + // ^ Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for invalid pub iod: u8, - // ^ Issue of ephemeris data + // ^ Issue of ephemeris data } impl MsgEphemerisGlo { - pub const TYPE: u16 = 136; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgEphemerisGlo{ + pub const TYPE: u16 = 139; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisGlo { common: EphemerisCommonContent::parse(_buf)?, - gamma: _buf.read_f64::()?, - tau: _buf.read_f64::()?, - d_tau: _buf.read_f64::()?, - pos: ::read_double_array_limit(_buf, 3)?, - vel: ::read_double_array_limit(_buf, 3)?, - acc: ::read_double_array_limit(_buf, 3)?, + gamma: _buf.read_f32::()?, + tau: _buf.read_f32::()?, + d_tau: _buf.read_f32::()?, + pos: ::parser::read_double_array_limit(_buf, 3)?, + vel: ::parser::read_double_array_limit(_buf, 3)?, + acc: ::parser::read_float_array_limit(_buf, 3)?, fcn: _buf.read_u8()?, iod: _buf.read_u8()?, - } ) + }) } } - // Satellite broadcast ephemeris // // The ephemeris message returns a set of satellite orbit @@ -790,73 +1462,73 @@ impl MsgEphemerisGlo { #[allow(non_snake_case)] pub struct MsgEphemerisDepD { pub tgd: f64, - // ^ Group delay differential between L1 and L2 + // ^ Group delay differential between L1 and L2 pub c_rs: f64, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + // ^ Amplitude of the sine harmonic correction term to the orbit radius pub c_rc: f64, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + // ^ Amplitude of the cosine harmonic correction term to the orbit radius pub c_uc: f64, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude pub c_us: f64, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude pub c_ic: f64, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination pub c_is: f64, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination pub dn: f64, - // ^ Mean motion difference + // ^ Mean motion difference pub m0: f64, - // ^ Mean anomaly at reference time + // ^ Mean anomaly at reference time pub ecc: f64, - // ^ Eccentricity of satellite orbit + // ^ Eccentricity of satellite orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + // ^ Square root of the semi-major axis of orbit pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + // ^ Longitude of ascending node of orbit plane at weekly epoch pub omegadot: f64, - // ^ Rate of right ascension + // ^ Rate of right ascension pub w: f64, - // ^ Argument of perigee + // ^ Argument of perigee pub inc: f64, - // ^ Inclination + // ^ Inclination pub inc_dot: f64, - // ^ Inclination first derivative + // ^ Inclination first derivative pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + // ^ Polynomial clock correction coefficient (clock bias) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) + // ^ Polynomial clock correction coefficient (clock drift) pub af2: f64, - // ^ Polynomial clock correction coefficient (rate of clock drift) + // ^ Polynomial clock correction coefficient (rate of clock drift) pub toe_tow: f64, - // ^ Time of week + // ^ Time of week pub toe_wn: u16, - // ^ Week number + // ^ Week number pub toc_tow: f64, - // ^ Clock reference time of week + // ^ Clock reference time of week pub toc_wn: u16, - // ^ Clock reference week number + // ^ Clock reference week number pub valid: u8, - // ^ Is valid? + // ^ Is valid? pub healthy: u8, - // ^ Satellite is healthy? + // ^ Satellite is healthy? pub sid: GnssSignalDep, - // ^ GNSS signal identifier + // ^ GNSS signal identifier pub iode: u8, - // ^ Issue of ephemeris data + // ^ Issue of ephemeris data pub iodc: u16, - // ^ Issue of clock data + // ^ Issue of clock data pub reserved: u32, - // ^ Reserved field + // ^ Reserved field } impl MsgEphemerisDepD { pub const TYPE: u16 = 128; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgEphemerisDepD{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisDepD { tgd: _buf.read_f64::()?, c_rs: _buf.read_f64::()?, c_rc: _buf.read_f64::()?, @@ -886,11 +1558,10 @@ impl MsgEphemerisDepD { iode: _buf.read_u8()?, iodc: _buf.read_u16::()?, reserved: _buf.read_u32::()?, - } ) + }) } } - // Deprecated // // Deprecated. @@ -899,67 +1570,67 @@ impl MsgEphemerisDepD { #[allow(non_snake_case)] pub struct MsgEphemerisDepA { pub tgd: f64, - // ^ Group delay differential between L1 and L2 + // ^ Group delay differential between L1 and L2 pub c_rs: f64, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + // ^ Amplitude of the sine harmonic correction term to the orbit radius pub c_rc: f64, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + // ^ Amplitude of the cosine harmonic correction term to the orbit radius pub c_uc: f64, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude pub c_us: f64, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude pub c_ic: f64, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination pub c_is: f64, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination pub dn: f64, - // ^ Mean motion difference + // ^ Mean motion difference pub m0: f64, - // ^ Mean anomaly at reference time + // ^ Mean anomaly at reference time pub ecc: f64, - // ^ Eccentricity of satellite orbit + // ^ Eccentricity of satellite orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + // ^ Square root of the semi-major axis of orbit pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + // ^ Longitude of ascending node of orbit plane at weekly epoch pub omegadot: f64, - // ^ Rate of right ascension + // ^ Rate of right ascension pub w: f64, - // ^ Argument of perigee + // ^ Argument of perigee pub inc: f64, - // ^ Inclination + // ^ Inclination pub inc_dot: f64, - // ^ Inclination first derivative + // ^ Inclination first derivative pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + // ^ Polynomial clock correction coefficient (clock bias) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) + // ^ Polynomial clock correction coefficient (clock drift) pub af2: f64, - // ^ Polynomial clock correction coefficient (rate of clock drift) + // ^ Polynomial clock correction coefficient (rate of clock drift) pub toe_tow: f64, - // ^ Time of week + // ^ Time of week pub toe_wn: u16, - // ^ Week number + // ^ Week number pub toc_tow: f64, - // ^ Clock reference time of week + // ^ Clock reference time of week pub toc_wn: u16, - // ^ Clock reference week number + // ^ Clock reference week number pub valid: u8, - // ^ Is valid? + // ^ Is valid? pub healthy: u8, - // ^ Satellite is healthy? + // ^ Satellite is healthy? pub prn: u8, - // ^ PRN being tracked + // ^ PRN being tracked } impl MsgEphemerisDepA { pub const TYPE: u16 = 26; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgEphemerisDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisDepA { tgd: _buf.read_f64::()?, c_rs: _buf.read_f64::()?, c_rc: _buf.read_f64::()?, @@ -986,11 +1657,10 @@ impl MsgEphemerisDepA { valid: _buf.read_u8()?, healthy: _buf.read_u8()?, prn: _buf.read_u8()?, - } ) + }) } } - // Deprecated // // Deprecated. @@ -999,69 +1669,69 @@ impl MsgEphemerisDepA { #[allow(non_snake_case)] pub struct MsgEphemerisDepB { pub tgd: f64, - // ^ Group delay differential between L1 and L2 + // ^ Group delay differential between L1 and L2 pub c_rs: f64, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + // ^ Amplitude of the sine harmonic correction term to the orbit radius pub c_rc: f64, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + // ^ Amplitude of the cosine harmonic correction term to the orbit radius pub c_uc: f64, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude pub c_us: f64, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude pub c_ic: f64, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination pub c_is: f64, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination pub dn: f64, - // ^ Mean motion difference + // ^ Mean motion difference pub m0: f64, - // ^ Mean anomaly at reference time + // ^ Mean anomaly at reference time pub ecc: f64, - // ^ Eccentricity of satellite orbit + // ^ Eccentricity of satellite orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + // ^ Square root of the semi-major axis of orbit pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + // ^ Longitude of ascending node of orbit plane at weekly epoch pub omegadot: f64, - // ^ Rate of right ascension + // ^ Rate of right ascension pub w: f64, - // ^ Argument of perigee + // ^ Argument of perigee pub inc: f64, - // ^ Inclination + // ^ Inclination pub inc_dot: f64, - // ^ Inclination first derivative + // ^ Inclination first derivative pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + // ^ Polynomial clock correction coefficient (clock bias) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) + // ^ Polynomial clock correction coefficient (clock drift) pub af2: f64, - // ^ Polynomial clock correction coefficient (rate of clock drift) + // ^ Polynomial clock correction coefficient (rate of clock drift) pub toe_tow: f64, - // ^ Time of week + // ^ Time of week pub toe_wn: u16, - // ^ Week number + // ^ Week number pub toc_tow: f64, - // ^ Clock reference time of week + // ^ Clock reference time of week pub toc_wn: u16, - // ^ Clock reference week number + // ^ Clock reference week number pub valid: u8, - // ^ Is valid? + // ^ Is valid? pub healthy: u8, - // ^ Satellite is healthy? + // ^ Satellite is healthy? pub prn: u8, - // ^ PRN being tracked + // ^ PRN being tracked pub iode: u8, - // ^ Issue of ephemeris data + // ^ Issue of ephemeris data } impl MsgEphemerisDepB { pub const TYPE: u16 = 70; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgEphemerisDepB{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisDepB { tgd: _buf.read_f64::()?, c_rs: _buf.read_f64::()?, c_rc: _buf.read_f64::()?, @@ -1089,11 +1759,10 @@ impl MsgEphemerisDepB { healthy: _buf.read_u8()?, prn: _buf.read_u8()?, iode: _buf.read_u8()?, - } ) + }) } } - // Satellite broadcast ephemeris // // The ephemeris message returns a set of satellite orbit @@ -1106,73 +1775,73 @@ impl MsgEphemerisDepB { #[allow(non_snake_case)] pub struct MsgEphemerisDepC { pub tgd: f64, - // ^ Group delay differential between L1 and L2 + // ^ Group delay differential between L1 and L2 pub c_rs: f64, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + // ^ Amplitude of the sine harmonic correction term to the orbit radius pub c_rc: f64, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + // ^ Amplitude of the cosine harmonic correction term to the orbit radius pub c_uc: f64, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + // ^ Amplitude of the cosine harmonic correction term to the argument of + // latitude pub c_us: f64, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + // ^ Amplitude of the sine harmonic correction term to the argument of + // latitude pub c_ic: f64, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + // ^ Amplitude of the cosine harmonic correction term to the angle of + // inclination pub c_is: f64, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + // ^ Amplitude of the sine harmonic correction term to the angle of + // inclination pub dn: f64, - // ^ Mean motion difference + // ^ Mean motion difference pub m0: f64, - // ^ Mean anomaly at reference time + // ^ Mean anomaly at reference time pub ecc: f64, - // ^ Eccentricity of satellite orbit + // ^ Eccentricity of satellite orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + // ^ Square root of the semi-major axis of orbit pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + // ^ Longitude of ascending node of orbit plane at weekly epoch pub omegadot: f64, - // ^ Rate of right ascension + // ^ Rate of right ascension pub w: f64, - // ^ Argument of perigee + // ^ Argument of perigee pub inc: f64, - // ^ Inclination + // ^ Inclination pub inc_dot: f64, - // ^ Inclination first derivative + // ^ Inclination first derivative pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + // ^ Polynomial clock correction coefficient (clock bias) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) + // ^ Polynomial clock correction coefficient (clock drift) pub af2: f64, - // ^ Polynomial clock correction coefficient (rate of clock drift) + // ^ Polynomial clock correction coefficient (rate of clock drift) pub toe_tow: f64, - // ^ Time of week + // ^ Time of week pub toe_wn: u16, - // ^ Week number + // ^ Week number pub toc_tow: f64, - // ^ Clock reference time of week + // ^ Clock reference time of week pub toc_wn: u16, - // ^ Clock reference week number + // ^ Clock reference week number pub valid: u8, - // ^ Is valid? + // ^ Is valid? pub healthy: u8, - // ^ Satellite is healthy? + // ^ Satellite is healthy? pub sid: GnssSignalDep, - // ^ GNSS signal identifier + // ^ GNSS signal identifier pub iode: u8, - // ^ Issue of ephemeris data + // ^ Issue of ephemeris data pub iodc: u16, - // ^ Issue of clock data + // ^ Issue of clock data pub reserved: u32, - // ^ Reserved field + // ^ Reserved field } impl MsgEphemerisDepC { pub const TYPE: u16 = 71; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgEphemerisDepC{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgEphemerisDepC { tgd: _buf.read_f64::()?, c_rs: _buf.read_f64::()?, c_rc: _buf.read_f64::()?, @@ -1202,11 +1871,10 @@ impl MsgEphemerisDepC { iode: _buf.read_u8()?, iodc: _buf.read_u16::()?, reserved: _buf.read_u32::()?, - } ) + }) } } - // Header for observation message. // // Header of a GPS observation message. @@ -1215,37 +1883,41 @@ impl MsgEphemerisDepC { #[allow(non_snake_case)] pub struct ObservationHeaderDep { pub t: GPSTimeDep, - // ^ GPS time of this observation + // ^ GPS time of this observation pub n_obs: u8, - // ^ Total number of observations. First nibble is the size of the sequence - // (n), second nibble is the zero-indexed counter (ith packet of n) + // ^ Total number of observations. First nibble is the size of the sequence + // (n), second nibble is the zero-indexed counter (ith packet of n) } impl ObservationHeaderDep { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( ObservationHeaderDep{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(ObservationHeaderDep { t: GPSTimeDep::parse(_buf)?, n_obs: _buf.read_u8()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( ObservationHeaderDep::parse(buf)? ); + v.push(ObservationHeaderDep::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( ObservationHeaderDep::parse(buf)? ); + v.push(ObservationHeaderDep::parse(buf)?); } Ok(v) } } - // GPS carrier phase measurement. // // Carrier phase measurement in cycles represented as a 40-bit @@ -1258,36 +1930,38 @@ impl ObservationHeaderDep { #[allow(non_snake_case)] pub struct CarrierPhaseDepA { pub i: i32, - // ^ Carrier phase whole cycles + // ^ Carrier phase whole cycles pub f: u8, - // ^ Carrier phase fractional part + // ^ Carrier phase fractional part } impl CarrierPhaseDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( CarrierPhaseDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(CarrierPhaseDepA { i: _buf.read_i32::()?, f: _buf.read_u8()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( CarrierPhaseDepA::parse(buf)? ); + v.push(CarrierPhaseDepA::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( CarrierPhaseDepA::parse(buf)? ); + v.push(CarrierPhaseDepA::parse(buf)?); } Ok(v) } } - // Deprecated // // Deprecated. @@ -1296,47 +1970,51 @@ impl CarrierPhaseDepA { #[allow(non_snake_case)] pub struct PackedObsContentDepA { pub P: u32, - // ^ Pseudorange observation + // ^ Pseudorange observation pub L: CarrierPhaseDepA, - // ^ Carrier phase observation with opposite sign from typical convention + // ^ Carrier phase observation with opposite sign from typical convention pub cn0: u8, - // ^ Carrier-to-Noise density + // ^ Carrier-to-Noise density pub lock: u16, - // ^ Lock indicator. This value changes whenever a satellite signal has lost - // and regained lock, indicating that the carrier phase ambiguity may have - // changed. + // ^ Lock indicator. This value changes whenever a satellite signal has lost + // and regained lock, indicating that the carrier phase ambiguity may have + // changed. pub prn: u8, - // ^ PRN-1 identifier of the satellite signal + // ^ PRN-1 identifier of the satellite signal } impl PackedObsContentDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( PackedObsContentDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(PackedObsContentDepA { P: _buf.read_u32::()?, L: CarrierPhaseDepA::parse(_buf)?, cn0: _buf.read_u8()?, lock: _buf.read_u16::()?, prn: _buf.read_u8()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( PackedObsContentDepA::parse(buf)? ); + v.push(PackedObsContentDepA::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( PackedObsContentDepA::parse(buf)? ); + v.push(PackedObsContentDepA::parse(buf)?); } Ok(v) } } - // GPS observations for a particular satellite signal. // // Pseudorange and carrier phase observation for a satellite being @@ -1346,47 +2024,51 @@ impl PackedObsContentDepA { #[allow(non_snake_case)] pub struct PackedObsContentDepB { pub P: u32, - // ^ Pseudorange observation + // ^ Pseudorange observation pub L: CarrierPhaseDepA, - // ^ Carrier phase observation with opposite sign from typical convention. + // ^ Carrier phase observation with opposite sign from typical convention. pub cn0: u8, - // ^ Carrier-to-Noise density + // ^ Carrier-to-Noise density pub lock: u16, - // ^ Lock indicator. This value changes whenever a satellite signal has lost - // and regained lock, indicating that the carrier phase ambiguity may have - // changed. + // ^ Lock indicator. This value changes whenever a satellite signal has lost + // and regained lock, indicating that the carrier phase ambiguity may have + // changed. pub sid: GnssSignalDep, - // ^ GNSS signal identifier + // ^ GNSS signal identifier } impl PackedObsContentDepB { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( PackedObsContentDepB{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(PackedObsContentDepB { P: _buf.read_u32::()?, L: CarrierPhaseDepA::parse(_buf)?, cn0: _buf.read_u8()?, lock: _buf.read_u16::()?, sid: GnssSignalDep::parse(_buf)?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( PackedObsContentDepB::parse(buf)? ); + v.push(PackedObsContentDepB::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( PackedObsContentDepB::parse(buf)? ); + v.push(PackedObsContentDepB::parse(buf)?); } Ok(v) } } - // GPS observations for a particular satellite signal. // // Pseudorange and carrier phase observation for a satellite being @@ -1397,47 +2079,51 @@ impl PackedObsContentDepB { #[allow(non_snake_case)] pub struct PackedObsContentDepC { pub P: u32, - // ^ Pseudorange observation + // ^ Pseudorange observation pub L: CarrierPhase, - // ^ Carrier phase observation with typical sign convention. + // ^ Carrier phase observation with typical sign convention. pub cn0: u8, - // ^ Carrier-to-Noise density + // ^ Carrier-to-Noise density pub lock: u16, - // ^ Lock indicator. This value changes whenever a satellite signal has lost - // and regained lock, indicating that the carrier phase ambiguity may have - // changed. + // ^ Lock indicator. This value changes whenever a satellite signal has lost + // and regained lock, indicating that the carrier phase ambiguity may have + // changed. pub sid: GnssSignalDep, - // ^ GNSS signal identifier + // ^ GNSS signal identifier } impl PackedObsContentDepC { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( PackedObsContentDepC{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(PackedObsContentDepC { P: _buf.read_u32::()?, L: CarrierPhase::parse(_buf)?, cn0: _buf.read_u8()?, lock: _buf.read_u16::()?, sid: GnssSignalDep::parse(_buf)?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( PackedObsContentDepC::parse(buf)? ); + v.push(PackedObsContentDepC::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( PackedObsContentDepC::parse(buf)? ); + v.push(PackedObsContentDepC::parse(buf)?); } Ok(v) } } - // Deprecated // // Deprecated. @@ -1446,22 +2132,21 @@ impl PackedObsContentDepC { #[allow(non_snake_case)] pub struct MsgObsDepA { pub header: ObservationHeaderDep, - // ^ Header of a GPS observation message + // ^ Header of a GPS observation message pub obs: Vec, - // ^ Pseudorange and carrier phase observation for a satellite being tracked. + // ^ Pseudorange and carrier phase observation for a satellite being tracked. } impl MsgObsDepA { pub const TYPE: u16 = 69; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgObsDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgObsDepA { header: ObservationHeaderDep::parse(_buf)?, obs: PackedObsContentDepA::parse_array(_buf)?, - } ) + }) } } - // Deprecated // // This observation message has been deprecated in favor of @@ -1475,22 +2160,21 @@ impl MsgObsDepA { #[allow(non_snake_case)] pub struct MsgObsDepB { pub header: ObservationHeaderDep, - // ^ Header of a GPS observation message + // ^ Header of a GPS observation message pub obs: Vec, - // ^ Pseudorange and carrier phase observation for a satellite being tracked. + // ^ Pseudorange and carrier phase observation for a satellite being tracked. } impl MsgObsDepB { pub const TYPE: u16 = 67; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgObsDepB{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgObsDepB { header: ObservationHeaderDep::parse(_buf)?, obs: PackedObsContentDepB::parse_array(_buf)?, - } ) + }) } } - // Deprecated // // The GPS observations message reports all the raw pseudorange and @@ -1505,22 +2189,21 @@ impl MsgObsDepB { #[allow(non_snake_case)] pub struct MsgObsDepC { pub header: ObservationHeaderDep, - // ^ Header of a GPS observation message + // ^ Header of a GPS observation message pub obs: Vec, - // ^ Pseudorange and carrier phase observation for a satellite being tracked. + // ^ Pseudorange and carrier phase observation for a satellite being tracked. } impl MsgObsDepC { pub const TYPE: u16 = 73; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgObsDepC{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgObsDepC { header: ObservationHeaderDep::parse(_buf)?, obs: PackedObsContentDepC::parse_array(_buf)?, - } ) + }) } } - // Iono corrections // // The ionospheric parameters which allow the "L1 only" or "L2 only" user to @@ -1531,7 +2214,7 @@ impl MsgObsDepC { #[allow(non_snake_case)] pub struct MsgIono { pub t_nmct: GPSTimeSec, - // ^ Navigation Message Correction Table Valitidy Time + // ^ Navigation Message Correction Table Valitidy Time pub a0: f64, pub a1: f64, pub a2: f64, @@ -1544,8 +2227,8 @@ pub struct MsgIono { impl MsgIono { pub const TYPE: u16 = 144; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgIono{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgIono { t_nmct: GPSTimeSec::parse(_buf)?, a0: _buf.read_f64::()?, a1: _buf.read_f64::()?, @@ -1555,34 +2238,128 @@ impl MsgIono { b1: _buf.read_f64::()?, b2: _buf.read_f64::()?, b3: _buf.read_f64::()?, - } ) + }) } } - // L2C capability mask // // Please see ICD-GPS-200 (Chapter 20.3.3.5.1.4) for more details. // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgSvConfigurationGPS { +pub struct MsgSvConfigurationGPSDep { pub t_nmct: GPSTimeSec, - // ^ Navigation Message Correction Table Valitidy Time + // ^ Navigation Message Correction Table Valitidy Time pub l2c_mask: u32, - // ^ L2C capability mask, SV32 bit being MSB, SV1 bit being LSB + // ^ L2C capability mask, SV32 bit being MSB, SV1 bit being LSB } -impl MsgSvConfigurationGPS { +impl MsgSvConfigurationGPSDep { pub const TYPE: u16 = 145; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSvConfigurationGPS{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSvConfigurationGPSDep { t_nmct: GPSTimeSec::parse(_buf)?, l2c_mask: _buf.read_u32::()?, - } ) + }) + } +} + +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct GnssCapb { + pub gps_active: u64, + // ^ GPS SV active mask + pub gps_l2c: u64, + // ^ GPS L2C active mask + pub gps_l5: u64, + // ^ GPS L5 active mask + pub glo_active: u32, + // ^ GLO active mask + pub glo_l2of: u32, + // ^ GLO L2OF active mask + pub glo_l3: u32, + // ^ GLO L3 active mask + pub sbas_active: u64, + // ^ SBAS active mask (PRNs 120..158, AN 7/62.2.2-18/18 Table B-23, + // https://www.caat.or.th/wp-content/uploads/2018/03/SL-2018.18.E-1.pdf) + pub sbas_l5: u64, + // ^ SBAS L5 active mask (PRNs 120..158, AN 7/62.2.2-18/18 Table B-23, + // https://www.caat.or.th/wp-content/uploads/2018/03/SL-2018.18.E-1.pdf) + pub bds_active: u64, + // ^ BDS active mask + pub bds_d2nav: u64, + // ^ BDS D2NAV active mask + pub bds_b2: u64, + // ^ BDS B2 active mask + pub bds_b2a: u64, + // ^ BDS B2A active mask + pub qzss_active: u32, + // ^ QZSS active mask + pub gal_active: u64, + // ^ GAL active mask + pub gal_e5: u64, + // ^ GAL E5 active mask +} + +impl GnssCapb { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(GnssCapb { + gps_active: _buf.read_u64::()?, + gps_l2c: _buf.read_u64::()?, + gps_l5: _buf.read_u64::()?, + glo_active: _buf.read_u32::()?, + glo_l2of: _buf.read_u32::()?, + glo_l3: _buf.read_u32::()?, + sbas_active: _buf.read_u64::()?, + sbas_l5: _buf.read_u64::()?, + bds_active: _buf.read_u64::()?, + bds_d2nav: _buf.read_u64::()?, + bds_b2: _buf.read_u64::()?, + bds_b2a: _buf.read_u64::()?, + qzss_active: _buf.read_u32::()?, + gal_active: _buf.read_u64::()?, + gal_e5: _buf.read_u64::()?, + }) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push(GnssCapb::parse(buf)?); + } + Ok(v) + } + + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(GnssCapb::parse(buf)?); + } + Ok(v) } } +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgGnssCapb { + pub t_nmct: GPSTimeSec, + // ^ Navigation Message Correction Table Validity Time + pub gc: GnssCapb, + // ^ GNSS capabilities masks +} + +impl MsgGnssCapb { + pub const TYPE: u16 = 150; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgGnssCapb { + t_nmct: GPSTimeSec::parse(_buf)?, + gc: GnssCapb::parse(_buf)?, + }) + } +} // Group Delay // @@ -1592,12 +2369,12 @@ impl MsgSvConfigurationGPS { #[allow(non_snake_case)] pub struct MsgGroupDelayDepA { pub t_op: GPSTimeDep, - // ^ Data Predict Time of Week + // ^ Data Predict Time of Week pub prn: u8, - // ^ Satellite number + // ^ Satellite number pub valid: u8, - // ^ bit-field indicating validity of the values, LSB indicating tgd validity - // etc. 1 = value is valid, 0 = value is not valid. + // ^ bit-field indicating validity of the values, LSB indicating tgd validity + // etc. 1 = value is valid, 0 = value is not valid. pub tgd: i16, pub isc_l1ca: i16, pub isc_l2c: i16, @@ -1605,19 +2382,18 @@ pub struct MsgGroupDelayDepA { impl MsgGroupDelayDepA { pub const TYPE: u16 = 146; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgGroupDelayDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgGroupDelayDepA { t_op: GPSTimeDep::parse(_buf)?, prn: _buf.read_u8()?, valid: _buf.read_u8()?, tgd: _buf.read_i16::()?, isc_l1ca: _buf.read_i16::()?, isc_l2c: _buf.read_i16::()?, - } ) + }) } } - // Group Delay // // Please see ICD-GPS-200 (30.3.3.3.1.1) for more details. @@ -1626,12 +2402,12 @@ impl MsgGroupDelayDepA { #[allow(non_snake_case)] pub struct MsgGroupDelayDepB { pub t_op: GPSTimeSec, - // ^ Data Predict Time of Week + // ^ Data Predict Time of Week pub sid: GnssSignalDep, - // ^ GNSS signal identifier + // ^ GNSS signal identifier pub valid: u8, - // ^ bit-field indicating validity of the values, LSB indicating tgd validity - // etc. 1 = value is valid, 0 = value is not valid. + // ^ bit-field indicating validity of the values, LSB indicating tgd validity + // etc. 1 = value is valid, 0 = value is not valid. pub tgd: i16, pub isc_l1ca: i16, pub isc_l2c: i16, @@ -1639,19 +2415,18 @@ pub struct MsgGroupDelayDepB { impl MsgGroupDelayDepB { pub const TYPE: u16 = 147; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgGroupDelayDepB{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgGroupDelayDepB { t_op: GPSTimeSec::parse(_buf)?, sid: GnssSignalDep::parse(_buf)?, valid: _buf.read_u8()?, tgd: _buf.read_i16::()?, isc_l1ca: _buf.read_i16::()?, isc_l2c: _buf.read_i16::()?, - } ) + }) } } - // Group Delay // // Please see ICD-GPS-200 (30.3.3.3.1.1) for more details. @@ -1660,12 +2435,12 @@ impl MsgGroupDelayDepB { #[allow(non_snake_case)] pub struct MsgGroupDelay { pub t_op: GPSTimeSec, - // ^ Data Predict Time of Week + // ^ Data Predict Time of Week pub sid: GnssSignal, - // ^ GNSS signal identifier + // ^ GNSS signal identifier pub valid: u8, - // ^ bit-field indicating validity of the values, LSB indicating tgd validity - // etc. 1 = value is valid, 0 = value is not valid. + // ^ bit-field indicating validity of the values, LSB indicating tgd validity + // etc. 1 = value is valid, 0 = value is not valid. pub tgd: i16, pub isc_l1ca: i16, pub isc_l2c: i16, @@ -1673,129 +2448,136 @@ pub struct MsgGroupDelay { impl MsgGroupDelay { pub const TYPE: u16 = 148; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgGroupDelay{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgGroupDelay { t_op: GPSTimeSec::parse(_buf)?, sid: GnssSignal::parse(_buf)?, valid: _buf.read_u8()?, tgd: _buf.read_i16::()?, isc_l1ca: _buf.read_i16::()?, isc_l2c: _buf.read_i16::()?, - } ) + }) } } - #[derive(Debug)] #[allow(non_snake_case)] pub struct AlmanacCommonContent { pub sid: GnssSignal, - // ^ GNSS signal identifier + // ^ GNSS signal identifier pub toa: GPSTimeSec, - // ^ Reference time of almanac + // ^ Reference time of almanac pub ura: f64, - // ^ User Range Accuracy + // ^ User Range Accuracy pub fit_interval: u32, - // ^ Curve fit interval + // ^ Curve fit interval pub valid: u8, - // ^ Status of almanac, 1 = valid, 0 = invalid + // ^ Status of almanac, 1 = valid, 0 = invalid pub health_bits: u8, - // ^ Satellite health status for GPS: - bits 5-7: NAV data health status. - // See IS-GPS-200H Table 20-VII: NAV Data Health Indications. - bits - // 0-4: Signal health status. See IS-GPS-200H Table 20-VIII. Codes for - // Health of SV Signal Components. Satellite health status for GLO: - // See GLO ICD 5.1 table 5.1 for details - bit 0: C(n), "unhealthy" flag - // that is transmitted within non-immediate data and indicates overall - // constellation status at the moment of almanac uploading. '0' - // indicates malfunction of n-satellite. '1' indicates that n-satellite - // is operational. - bit 1: Bn(ln), '0' indicates the satellite is - // operational and suitable for navigation. + // ^ Satellite health status for GPS: - bits 5-7: NAV data health status. + // See IS-GPS-200H Table 20-VII: NAV Data Health Indications. - bits + // 0-4: Signal health status. See IS-GPS-200H Table 20-VIII. Codes for + // Health of SV Signal Components. Satellite health status for GLO: + // See GLO ICD 5.1 table 5.1 for details - bit 0: C(n), "unhealthy" flag + // that is transmitted within non-immediate data and indicates overall + // constellation status at the moment of almanac uploading. '0' + // indicates malfunction of n-satellite. '1' indicates that n-satellite + // is operational. - bit 1: Bn(ln), '0' indicates the satellite is + // operational and suitable for navigation. } impl AlmanacCommonContent { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( AlmanacCommonContent{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(AlmanacCommonContent { sid: GnssSignal::parse(_buf)?, toa: GPSTimeSec::parse(_buf)?, ura: _buf.read_f64::()?, fit_interval: _buf.read_u32::()?, valid: _buf.read_u8()?, health_bits: _buf.read_u8()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( AlmanacCommonContent::parse(buf)? ); + v.push(AlmanacCommonContent::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( AlmanacCommonContent::parse(buf)? ); + v.push(AlmanacCommonContent::parse(buf)?); } Ok(v) } } - #[derive(Debug)] #[allow(non_snake_case)] pub struct AlmanacCommonContentDep { pub sid: GnssSignalDep, - // ^ GNSS signal identifier + // ^ GNSS signal identifier pub toa: GPSTimeSec, - // ^ Reference time of almanac + // ^ Reference time of almanac pub ura: f64, - // ^ User Range Accuracy + // ^ User Range Accuracy pub fit_interval: u32, - // ^ Curve fit interval + // ^ Curve fit interval pub valid: u8, - // ^ Status of almanac, 1 = valid, 0 = invalid + // ^ Status of almanac, 1 = valid, 0 = invalid pub health_bits: u8, - // ^ Satellite health status for GPS: - bits 5-7: NAV data health status. - // See IS-GPS-200H Table 20-VII: NAV Data Health Indications. - bits - // 0-4: Signal health status. See IS-GPS-200H Table 20-VIII. Codes for - // Health of SV Signal Components. Satellite health status for GLO: - // See GLO ICD 5.1 table 5.1 for details - bit 0: C(n), "unhealthy" flag - // that is transmitted within non-immediate data and indicates overall - // constellation status at the moment of almanac uploading. '0' - // indicates malfunction of n-satellite. '1' indicates that n-satellite - // is operational. - bit 1: Bn(ln), '0' indicates the satellite is - // operational and suitable for navigation. + // ^ Satellite health status for GPS: - bits 5-7: NAV data health status. + // See IS-GPS-200H Table 20-VII: NAV Data Health Indications. - bits + // 0-4: Signal health status. See IS-GPS-200H Table 20-VIII. Codes for + // Health of SV Signal Components. Satellite health status for GLO: + // See GLO ICD 5.1 table 5.1 for details - bit 0: C(n), "unhealthy" flag + // that is transmitted within non-immediate data and indicates overall + // constellation status at the moment of almanac uploading. '0' + // indicates malfunction of n-satellite. '1' indicates that n-satellite + // is operational. - bit 1: Bn(ln), '0' indicates the satellite is + // operational and suitable for navigation. } impl AlmanacCommonContentDep { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( AlmanacCommonContentDep{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(AlmanacCommonContentDep { sid: GnssSignalDep::parse(_buf)?, toa: GPSTimeSec::parse(_buf)?, ura: _buf.read_f64::()?, fit_interval: _buf.read_u32::()?, valid: _buf.read_u8()?, health_bits: _buf.read_u8()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( AlmanacCommonContentDep::parse(buf)? ); + v.push(AlmanacCommonContentDep::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( AlmanacCommonContentDep::parse(buf)? ); + v.push(AlmanacCommonContentDep::parse(buf)?); } Ok(v) } } - // Satellite broadcast ephemeris for GPS // // The almanac message returns a set of satellite orbit parameters. Almanac @@ -1807,31 +2589,31 @@ impl AlmanacCommonContentDep { #[allow(non_snake_case)] pub struct MsgAlmanacGPSDep { pub common: AlmanacCommonContentDep, - // ^ Values common for all almanac types + // ^ Values common for all almanac types pub m0: f64, - // ^ Mean anomaly at reference time + // ^ Mean anomaly at reference time pub ecc: f64, - // ^ Eccentricity of satellite orbit + // ^ Eccentricity of satellite orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + // ^ Square root of the semi-major axis of orbit pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + // ^ Longitude of ascending node of orbit plane at weekly epoch pub omegadot: f64, - // ^ Rate of right ascension + // ^ Rate of right ascension pub w: f64, - // ^ Argument of perigee + // ^ Argument of perigee pub inc: f64, - // ^ Inclination + // ^ Inclination pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + // ^ Polynomial clock correction coefficient (clock bias) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) + // ^ Polynomial clock correction coefficient (clock drift) } impl MsgAlmanacGPSDep { pub const TYPE: u16 = 112; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgAlmanacGPSDep{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgAlmanacGPSDep { common: AlmanacCommonContentDep::parse(_buf)?, m0: _buf.read_f64::()?, ecc: _buf.read_f64::()?, @@ -1842,11 +2624,10 @@ impl MsgAlmanacGPSDep { inc: _buf.read_f64::()?, af0: _buf.read_f64::()?, af1: _buf.read_f64::()?, - } ) + }) } } - // Satellite broadcast ephemeris for GPS // // The almanac message returns a set of satellite orbit parameters. Almanac @@ -1858,31 +2639,31 @@ impl MsgAlmanacGPSDep { #[allow(non_snake_case)] pub struct MsgAlmanacGPS { pub common: AlmanacCommonContent, - // ^ Values common for all almanac types + // ^ Values common for all almanac types pub m0: f64, - // ^ Mean anomaly at reference time + // ^ Mean anomaly at reference time pub ecc: f64, - // ^ Eccentricity of satellite orbit + // ^ Eccentricity of satellite orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + // ^ Square root of the semi-major axis of orbit pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + // ^ Longitude of ascending node of orbit plane at weekly epoch pub omegadot: f64, - // ^ Rate of right ascension + // ^ Rate of right ascension pub w: f64, - // ^ Argument of perigee + // ^ Argument of perigee pub inc: f64, - // ^ Inclination + // ^ Inclination pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + // ^ Polynomial clock correction coefficient (clock bias) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) + // ^ Polynomial clock correction coefficient (clock drift) } impl MsgAlmanacGPS { pub const TYPE: u16 = 114; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgAlmanacGPS{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgAlmanacGPS { common: AlmanacCommonContent::parse(_buf)?, m0: _buf.read_f64::()?, ecc: _buf.read_f64::()?, @@ -1893,11 +2674,10 @@ impl MsgAlmanacGPS { inc: _buf.read_f64::()?, af0: _buf.read_f64::()?, af1: _buf.read_f64::()?, - } ) + }) } } - // Satellite broadcast ephemeris for GLO // // The almanac message returns a set of satellite orbit parameters. Almanac @@ -1909,28 +2689,28 @@ impl MsgAlmanacGPS { #[allow(non_snake_case)] pub struct MsgAlmanacGloDep { pub common: AlmanacCommonContentDep, - // ^ Values common for all almanac types + // ^ Values common for all almanac types pub lambda_na: f64, - // ^ Longitude of the first ascending node of the orbit in PZ-90.02 - // coordinate system + // ^ Longitude of the first ascending node of the orbit in PZ-90.02 + // coordinate system pub t_lambda_na: f64, - // ^ Time of the first ascending node passage + // ^ Time of the first ascending node passage pub i: f64, - // ^ Value of inclination at instant of t_lambda + // ^ Value of inclination at instant of t_lambda pub t: f64, - // ^ Value of Draconian period at instant of t_lambda + // ^ Value of Draconian period at instant of t_lambda pub t_dot: f64, - // ^ Rate of change of the Draconian period + // ^ Rate of change of the Draconian period pub epsilon: f64, - // ^ Eccentricity at instant of t_lambda + // ^ Eccentricity at instant of t_lambda pub omega: f64, - // ^ Argument of perigee at instant of t_lambda + // ^ Argument of perigee at instant of t_lambda } impl MsgAlmanacGloDep { pub const TYPE: u16 = 113; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgAlmanacGloDep{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgAlmanacGloDep { common: AlmanacCommonContentDep::parse(_buf)?, lambda_na: _buf.read_f64::()?, t_lambda_na: _buf.read_f64::()?, @@ -1939,11 +2719,10 @@ impl MsgAlmanacGloDep { t_dot: _buf.read_f64::()?, epsilon: _buf.read_f64::()?, omega: _buf.read_f64::()?, - } ) + }) } } - // Satellite broadcast ephemeris for GLO // // The almanac message returns a set of satellite orbit parameters. Almanac @@ -1955,28 +2734,28 @@ impl MsgAlmanacGloDep { #[allow(non_snake_case)] pub struct MsgAlmanacGlo { pub common: AlmanacCommonContent, - // ^ Values common for all almanac types + // ^ Values common for all almanac types pub lambda_na: f64, - // ^ Longitude of the first ascending node of the orbit in PZ-90.02 - // coordinate system + // ^ Longitude of the first ascending node of the orbit in PZ-90.02 + // coordinate system pub t_lambda_na: f64, - // ^ Time of the first ascending node passage + // ^ Time of the first ascending node passage pub i: f64, - // ^ Value of inclination at instant of t_lambda + // ^ Value of inclination at instant of t_lambda pub t: f64, - // ^ Value of Draconian period at instant of t_lambda + // ^ Value of Draconian period at instant of t_lambda pub t_dot: f64, - // ^ Rate of change of the Draconian period + // ^ Rate of change of the Draconian period pub epsilon: f64, - // ^ Eccentricity at instant of t_lambda + // ^ Eccentricity at instant of t_lambda pub omega: f64, - // ^ Argument of perigee at instant of t_lambda + // ^ Argument of perigee at instant of t_lambda } impl MsgAlmanacGlo { pub const TYPE: u16 = 115; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgAlmanacGlo{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgAlmanacGlo { common: AlmanacCommonContent::parse(_buf)?, lambda_na: _buf.read_f64::()?, t_lambda_na: _buf.read_f64::()?, @@ -1985,14 +2764,13 @@ impl MsgAlmanacGlo { t_dot: _buf.read_f64::()?, epsilon: _buf.read_f64::()?, omega: _buf.read_f64::()?, - } ) + }) } } - // GLONASS L1/L2 Code-Phase biases // -// The GLONASS L1/L2 Code-Phase biases allows to perform +// The GLONASS L1/L2 Code-Phase biases allows to perform // GPS+GLONASS integer ambiguity resolution for baselines // with mixed receiver types (e.g. receiver of different // manufacturers) @@ -2001,27 +2779,113 @@ impl MsgAlmanacGlo { #[allow(non_snake_case)] pub struct MsgGloBiases { pub mask: u8, - // ^ GLONASS FDMA signals mask + // ^ GLONASS FDMA signals mask pub l1ca_bias: i16, - // ^ GLONASS L1 C/A Code-Phase Bias + // ^ GLONASS L1 C/A Code-Phase Bias pub l1p_bias: i16, - // ^ GLONASS L1 P Code-Phase Bias + // ^ GLONASS L1 P Code-Phase Bias pub l2ca_bias: i16, - // ^ GLONASS L2 C/A Code-Phase Bias + // ^ GLONASS L2 C/A Code-Phase Bias pub l2p_bias: i16, - // ^ GLONASS L2 P Code-Phase Bias + // ^ GLONASS L2 P Code-Phase Bias } impl MsgGloBiases { pub const TYPE: u16 = 117; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgGloBiases{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgGloBiases { mask: _buf.read_u8()?, l1ca_bias: _buf.read_i16::()?, l1p_bias: _buf.read_i16::()?, l2ca_bias: _buf.read_i16::()?, l2p_bias: _buf.read_i16::()?, - } ) + }) + } +} + +// Satellite azimuth and elevation. +// +// Satellite azimuth and elevation. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct SvAzEl { + pub sid: GnssSignal, + // ^ GNSS signal identifier + pub az: u8, + // ^ Azimuth angle (range 0..179) + pub el: i8, + // ^ Elevation angle (range -90..90) +} + +impl SvAzEl { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(SvAzEl { + sid: GnssSignal::parse(_buf)?, + az: _buf.read_u8()?, + el: _buf.read_i8()?, + }) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push(SvAzEl::parse(buf)?); + } + Ok(v) + } + + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(SvAzEl::parse(buf)?); + } + Ok(v) + } +} + +// Satellite azimuths and elevations +// +// Azimuth and elevation angles of all the visible satellites +// that the device does have ephemeris or almanac for. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSvAzEl { + pub azel: Vec, + // ^ Azimuth and elevation per satellite +} + +impl MsgSvAzEl { + pub const TYPE: u16 = 151; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSvAzEl { + azel: SvAzEl::parse_array(_buf)?, + }) } } +// OSR corrections +// +// The OSR message contains network corrections in an observation-like format +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgOsr { + pub header: ObservationHeader, + // ^ Header of a GPS observation message + pub obs: Vec, + // ^ Network correction for a satellite signal. +} + +impl MsgOsr { + pub const TYPE: u16 = 1600; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgOsr { + header: ObservationHeader::parse(_buf)?, + obs: PackedOsrContent::parse_array(_buf)?, + }) + } +} diff --git a/rust/sbp/src/messages/orientation.rs b/rust/sbp/src/messages/orientation.rs index 9c3ac0372e..7e14220d1a 100644 --- a/rust/sbp/src/messages/orientation.rs +++ b/rust/sbp/src/messages/orientation.rs @@ -12,12 +12,10 @@ // Automatically generated from yaml/swiftnav/sbp/orientation.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Orientation Messages extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; - +use self::byteorder::{LittleEndian, ReadBytesExt}; // Heading relative to True North // @@ -30,158 +28,159 @@ use self::byteorder::{LittleEndian,ReadBytesExt}; #[allow(non_snake_case)] pub struct MsgBaselineHeading { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub heading: u32, - // ^ Heading + // ^ Heading pub n_sats: u8, - // ^ Number of satellites used in solution + // ^ Number of satellites used in solution pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgBaselineHeading { pub const TYPE: u16 = 527; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgBaselineHeading{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgBaselineHeading { tow: _buf.read_u32::()?, heading: _buf.read_u32::()?, n_sats: _buf.read_u8()?, flags: _buf.read_u8()?, - } ) + }) } } - // Quaternion 4 component vector // // This message reports the quaternion vector describing the vehicle body frame's orientation // with respect to a local-level NED frame. The components of the vector should sum to a unit -// vector assuming that the LSB of each component as a value of 2^-31. +// vector assuming that the LSB of each component as a value of 2^-31. This message will only +// be available in future INS versions of Swift Products and is not produced by Piksi Multi +// or Duro. // #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgOrientQuat { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub w: i32, - // ^ Real component + // ^ Real component pub x: i32, - // ^ 1st imaginary component + // ^ 1st imaginary component pub y: i32, - // ^ 2nd imaginary component + // ^ 2nd imaginary component pub z: i32, - // ^ 3rd imaginary component - pub acc_w: f32, - // ^ Estimated standard deviation of w - pub acc_x: f32, - // ^ Estimated standard deviation of x - pub acc_y: f32, - // ^ Estimated standard deviation of y - pub acc_z: f32, - // ^ Estimated standard deviation of z + // ^ 3rd imaginary component + pub w_accuracy: f32, + // ^ Estimated standard deviation of w + pub x_accuracy: f32, + // ^ Estimated standard deviation of x + pub y_accuracy: f32, + // ^ Estimated standard deviation of y + pub z_accuracy: f32, + // ^ Estimated standard deviation of z pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgOrientQuat { pub const TYPE: u16 = 544; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgOrientQuat{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgOrientQuat { tow: _buf.read_u32::()?, w: _buf.read_i32::()?, x: _buf.read_i32::()?, y: _buf.read_i32::()?, z: _buf.read_i32::()?, - acc_w: _buf.read_f32::()?, - acc_x: _buf.read_f32::()?, - acc_y: _buf.read_f32::()?, - acc_z: _buf.read_f32::()?, + w_accuracy: _buf.read_f32::()?, + x_accuracy: _buf.read_f32::()?, + y_accuracy: _buf.read_f32::()?, + z_accuracy: _buf.read_f32::()?, flags: _buf.read_u8()?, - } ) + }) } } - // Euler angles // // This message reports the yaw, pitch, and roll angles of the vehicle body frame. -// The rotations should applied intrinsically in the order yaw, pitch, and roll -// in order to rotate the from a frame aligned with the local-level NED frame -// to the vehicle body frame. +// The rotations should applied intrinsically in the order yaw, pitch, and roll +// in order to rotate the from a frame aligned with the local-level NED frame +// to the vehicle body frame. This message will only be available in future +// INS versions of Swift Products and is not produced by Piksi Multi or Duro. // #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgOrientEuler { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub roll: i32, - // ^ rotation about the forward axis of the vehicle + // ^ rotation about the forward axis of the vehicle pub pitch: i32, - // ^ rotation about the rightward axis of the vehicle + // ^ rotation about the rightward axis of the vehicle pub yaw: i32, - // ^ rotation about the downward axis of the vehicle - pub var_roll: f32, - // ^ Estimated standard deviation of roll - pub var_pitch: f32, - // ^ Estimated standard deviation of pitch - pub var_yaw: f32, - // ^ Estimated standard deviation of yaw + // ^ rotation about the downward axis of the vehicle + pub roll_accuracy: f32, + // ^ Estimated standard deviation of roll + pub pitch_accuracy: f32, + // ^ Estimated standard deviation of pitch + pub yaw_accuracy: f32, + // ^ Estimated standard deviation of yaw pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgOrientEuler { pub const TYPE: u16 = 545; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgOrientEuler{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgOrientEuler { tow: _buf.read_u32::()?, roll: _buf.read_i32::()?, pitch: _buf.read_i32::()?, yaw: _buf.read_i32::()?, - var_roll: _buf.read_f32::()?, - var_pitch: _buf.read_f32::()?, - var_yaw: _buf.read_f32::()?, + roll_accuracy: _buf.read_f32::()?, + pitch_accuracy: _buf.read_f32::()?, + yaw_accuracy: _buf.read_f32::()?, flags: _buf.read_u8()?, - } ) + }) } } - // Vehicle Body Frame instantaneous angular rates // -// This message reports the orientation rates in the vehicle body frame. -// The values represent the measurements a strapped down gyroscope would +// This message reports the orientation rates in the vehicle body frame. +// The values represent the measurements a strapped down gyroscope would // make and are not equivalent to the time derivative of the Euler angles. // The orientation and origin of the user frame is specified via device settings. // By convention, the vehicle x-axis is expected to be aligned with the forward // direction, while the vehicle y-axis is expected to be aligned with the right // direction, and the vehicle z-axis should be aligned with the down direction. +// This message will only be available in future INS versions of Swift Products +// and is not produced by Piksi Multi or Duro. // #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAngularRate { pub tow: u32, - // ^ GPS Time of Week + // ^ GPS Time of Week pub x: i32, - // ^ angular rate about x axis + // ^ angular rate about x axis pub y: i32, - // ^ angular rate about y axis + // ^ angular rate about y axis pub z: i32, - // ^ angular rate about z axis + // ^ angular rate about z axis pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgAngularRate { pub const TYPE: u16 = 546; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgAngularRate{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgAngularRate { tow: _buf.read_u32::()?, x: _buf.read_i32::()?, y: _buf.read_i32::()?, z: _buf.read_i32::()?, flags: _buf.read_u8()?, - } ) + }) } } - diff --git a/rust/sbp/src/messages/piksi.rs b/rust/sbp/src/messages/piksi.rs index 006ceace44..c49e9e0707 100644 --- a/rust/sbp/src/messages/piksi.rs +++ b/rust/sbp/src/messages/piksi.rs @@ -12,16 +12,14 @@ // Automatically generated from yaml/swiftnav/sbp/piksi.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // System health, configuration, and diagnostic messages specific to // the Piksi L1 receiver, including a variety of legacy messages that // may no longer be used. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; +use self::byteorder::{LittleEndian, ReadBytesExt}; use super::gnss::*; - // Legacy message to load satellite almanac (host => Piksi) // // This is a legacy message for sending and loading a satellite @@ -29,18 +27,15 @@ use super::gnss::*; // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgAlmanac { -} +pub struct MsgAlmanac {} impl MsgAlmanac { pub const TYPE: u16 = 105; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgAlmanac{ - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgAlmanac {}) } } - // Send GPS time from host (host => Piksi) // // This message sets up timing functionality using a coarse GPS @@ -48,18 +43,15 @@ impl MsgAlmanac { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgSetTime { -} +pub struct MsgSetTime {} impl MsgSetTime { pub const TYPE: u16 = 104; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSetTime{ - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSetTime {}) } } - // Reset the device (host => Piksi) // // This message from the host resets the Piksi back into the @@ -69,19 +61,18 @@ impl MsgSetTime { #[allow(non_snake_case)] pub struct MsgReset { pub flags: u32, - // ^ Reset flags + // ^ Reset flags } impl MsgReset { pub const TYPE: u16 = 182; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgReset{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgReset { flags: _buf.read_u32::()?, - } ) + }) } } - // Reset the device (host => Piksi) // // This message from the host resets the Piksi back into the @@ -89,18 +80,15 @@ impl MsgReset { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgResetDep { -} +pub struct MsgResetDep {} impl MsgResetDep { pub const TYPE: u16 = 178; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgResetDep{ - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgResetDep {}) } } - // Legacy message for CW interference channel (Piksi => host) // // This is an unused legacy message for result reporting from the @@ -109,18 +97,15 @@ impl MsgResetDep { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgCwResults { -} +pub struct MsgCwResults {} impl MsgCwResults { pub const TYPE: u16 = 192; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgCwResults{ - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgCwResults {}) } } - // Legacy message for CW interference channel (host => Piksi) // // This is an unused legacy message from the host for starting @@ -129,18 +114,15 @@ impl MsgCwResults { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgCwStart { -} +pub struct MsgCwStart {} impl MsgCwStart { pub const TYPE: u16 = 193; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgCwStart{ - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgCwStart {}) } } - // Reset IAR filters (host => Piksi) // // This message resets either the DGNSS Kalman filters or Integer @@ -150,41 +132,33 @@ impl MsgCwStart { #[allow(non_snake_case)] pub struct MsgResetFilters { pub filter: u8, - // ^ Filter flags + // ^ Filter flags } impl MsgResetFilters { pub const TYPE: u16 = 34; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgResetFilters{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgResetFilters { filter: _buf.read_u8()?, - } ) + }) } } - -// Initialize IAR from known baseline (host => device) +// Deprecated // -// This message initializes the integer ambiguity resolution (IAR) -// process on the Piksi to use an assumed baseline position between -// the base station and rover receivers. Warns via MSG_PRINT if -// there aren't a shared minimum number (4) of satellite -// observations between the two. +// Deprecated // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgInitBase { -} +pub struct MsgInitBaseDep {} -impl MsgInitBase { +impl MsgInitBaseDep { pub const TYPE: u16 = 35; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgInitBase{ - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgInitBaseDep {}) } } - // State of an RTOS thread // // The thread usage message from the device reports real-time @@ -195,26 +169,25 @@ impl MsgInitBase { #[allow(non_snake_case)] pub struct MsgThreadState { pub name: String, - // ^ Thread name (NULL terminated) + // ^ Thread name (NULL terminated) pub cpu: u16, - // ^ Percentage cpu use for this thread. Values range from 0 - 1000 and needs - // to be renormalized to 100 + // ^ Percentage cpu use for this thread. Values range from 0 - 1000 and needs + // to be renormalized to 100 pub stack_free: u32, - // ^ Free stack space for this thread + // ^ Free stack space for this thread } impl MsgThreadState { pub const TYPE: u16 = 23; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgThreadState{ - name: ::read_string_limit(_buf, 20)?, + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgThreadState { + name: ::parser::read_string_limit(_buf, 20)?, cpu: _buf.read_u16::()?, stack_free: _buf.read_u32::()?, - } ) + }) } } - // State of the UART channel // // Throughput, utilization, and error counts on the RX/TX buffers @@ -225,48 +198,50 @@ impl MsgThreadState { #[allow(non_snake_case)] pub struct UARTChannel { pub tx_throughput: f32, - // ^ UART transmit throughput + // ^ UART transmit throughput pub rx_throughput: f32, - // ^ UART receive throughput + // ^ UART receive throughput pub crc_error_count: u16, - // ^ UART CRC error count + // ^ UART CRC error count pub io_error_count: u16, - // ^ UART IO error count + // ^ UART IO error count pub tx_buffer_level: u8, - // ^ UART transmit buffer percentage utilization (ranges from 0 to 255) + // ^ UART transmit buffer percentage utilization (ranges from 0 to 255) pub rx_buffer_level: u8, - // ^ UART receive buffer percentage utilization (ranges from 0 to 255) + // ^ UART receive buffer percentage utilization (ranges from 0 to 255) } impl UARTChannel { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( UARTChannel{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(UARTChannel { tx_throughput: _buf.read_f32::()?, rx_throughput: _buf.read_f32::()?, crc_error_count: _buf.read_u16::()?, io_error_count: _buf.read_u16::()?, tx_buffer_level: _buf.read_u8()?, rx_buffer_level: _buf.read_u8()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( UARTChannel::parse(buf)? ); + v.push(UARTChannel::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( UARTChannel::parse(buf)? ); + v.push(UARTChannel::parse(buf)?); } Ok(v) } } - // base station observation message receipt period // // Statistics on the period of observations received from the base @@ -280,42 +255,44 @@ impl UARTChannel { #[allow(non_snake_case)] pub struct Period { pub avg: i32, - // ^ Average period + // ^ Average period pub pmin: i32, - // ^ Minimum period + // ^ Minimum period pub pmax: i32, - // ^ Maximum period + // ^ Maximum period pub current: i32, - // ^ Smoothed estimate of the current period + // ^ Smoothed estimate of the current period } impl Period { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( Period{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(Period { avg: _buf.read_i32::()?, pmin: _buf.read_i32::()?, pmax: _buf.read_i32::()?, current: _buf.read_i32::()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( Period::parse(buf)? ); + v.push(Period::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( Period::parse(buf)? ); + v.push(Period::parse(buf)?); } Ok(v) } } - // Receiver-to-base station latency // // Statistics on the latency of observations received from the base @@ -328,42 +305,44 @@ impl Period { #[allow(non_snake_case)] pub struct Latency { pub avg: i32, - // ^ Average latency + // ^ Average latency pub lmin: i32, - // ^ Minimum latency + // ^ Minimum latency pub lmax: i32, - // ^ Maximum latency + // ^ Maximum latency pub current: i32, - // ^ Smoothed estimate of the current latency + // ^ Smoothed estimate of the current latency } impl Latency { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( Latency{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(Latency { avg: _buf.read_i32::()?, lmin: _buf.read_i32::()?, lmax: _buf.read_i32::()?, current: _buf.read_i32::()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( Latency::parse(buf)? ); + v.push(Latency::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( Latency::parse(buf)? ); + v.push(Latency::parse(buf)?); } Ok(v) } } - // State of the UART channels // // The UART message reports data latency and throughput of the UART @@ -380,31 +359,30 @@ impl Latency { #[allow(non_snake_case)] pub struct MsgUartState { pub uart_a: UARTChannel, - // ^ State of UART A + // ^ State of UART A pub uart_b: UARTChannel, - // ^ State of UART B + // ^ State of UART B pub uart_ftdi: UARTChannel, - // ^ State of UART FTDI (USB logger) + // ^ State of UART FTDI (USB logger) pub latency: Latency, - // ^ UART communication latency + // ^ UART communication latency pub obs_period: Period, - // ^ Observation receipt period + // ^ Observation receipt period } impl MsgUartState { pub const TYPE: u16 = 29; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgUartState{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgUartState { uart_a: UARTChannel::parse(_buf)?, uart_b: UARTChannel::parse(_buf)?, uart_ftdi: UARTChannel::parse(_buf)?, latency: Latency::parse(_buf)?, obs_period: Period::parse(_buf)?, - } ) + }) } } - // Deprecated // // Deprecated @@ -413,28 +391,27 @@ impl MsgUartState { #[allow(non_snake_case)] pub struct MsgUartStateDepa { pub uart_a: UARTChannel, - // ^ State of UART A + // ^ State of UART A pub uart_b: UARTChannel, - // ^ State of UART B + // ^ State of UART B pub uart_ftdi: UARTChannel, - // ^ State of UART FTDI (USB logger) + // ^ State of UART FTDI (USB logger) pub latency: Latency, - // ^ UART communication latency + // ^ UART communication latency } impl MsgUartStateDepa { pub const TYPE: u16 = 24; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgUartStateDepa{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgUartStateDepa { uart_a: UARTChannel::parse(_buf)?, uart_b: UARTChannel::parse(_buf)?, uart_ftdi: UARTChannel::parse(_buf)?, latency: Latency::parse(_buf)?, - } ) + }) } } - // State of the Integer Ambiguity Resolution (IAR) process // // This message reports the state of the Integer Ambiguity @@ -446,19 +423,18 @@ impl MsgUartStateDepa { #[allow(non_snake_case)] pub struct MsgIarState { pub num_hyps: u32, - // ^ Number of integer ambiguity hypotheses remaining + // ^ Number of integer ambiguity hypotheses remaining } impl MsgIarState { pub const TYPE: u16 = 25; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgIarState{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgIarState { num_hyps: _buf.read_u32::()?, - } ) + }) } } - // Mask a satellite from use in Piksi subsystems // // This message allows setting a mask to prevent a particular satellite @@ -468,22 +444,21 @@ impl MsgIarState { #[allow(non_snake_case)] pub struct MsgMaskSatellite { pub mask: u8, - // ^ Mask of systems that should ignore this satellite. + // ^ Mask of systems that should ignore this satellite. pub sid: GnssSignal, - // ^ GNSS signal for which the mask is applied + // ^ GNSS signal for which the mask is applied } impl MsgMaskSatellite { pub const TYPE: u16 = 43; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgMaskSatellite{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgMaskSatellite { mask: _buf.read_u8()?, sid: GnssSignal::parse(_buf)?, - } ) + }) } } - // Deprecated // // Deprecated. @@ -492,22 +467,21 @@ impl MsgMaskSatellite { #[allow(non_snake_case)] pub struct MsgMaskSatelliteDep { pub mask: u8, - // ^ Mask of systems that should ignore this satellite. + // ^ Mask of systems that should ignore this satellite. pub sid: GnssSignalDep, - // ^ GNSS signal for which the mask is applied + // ^ GNSS signal for which the mask is applied } impl MsgMaskSatelliteDep { pub const TYPE: u16 = 27; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgMaskSatelliteDep{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgMaskSatelliteDep { mask: _buf.read_u8()?, sid: GnssSignalDep::parse(_buf)?, - } ) + }) } } - // Device temperature and voltage levels // // This message contains temperature and voltage level measurements from the @@ -518,31 +492,30 @@ impl MsgMaskSatelliteDep { #[allow(non_snake_case)] pub struct MsgDeviceMonitor { pub dev_vin: i16, - // ^ Device V_in + // ^ Device V_in pub cpu_vint: i16, - // ^ Processor V_int + // ^ Processor V_int pub cpu_vaux: i16, - // ^ Processor V_aux + // ^ Processor V_aux pub cpu_temperature: i16, - // ^ Processor temperature + // ^ Processor temperature pub fe_temperature: i16, - // ^ Frontend temperature (if available) + // ^ Frontend temperature (if available) } impl MsgDeviceMonitor { pub const TYPE: u16 = 181; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgDeviceMonitor{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgDeviceMonitor { dev_vin: _buf.read_i16::()?, cpu_vint: _buf.read_i16::()?, cpu_vaux: _buf.read_i16::()?, cpu_temperature: _buf.read_i16::()?, fe_temperature: _buf.read_i16::()?, - } ) + }) } } - // Execute a command (host => device) // // Request the recipient to execute an command. @@ -553,22 +526,21 @@ impl MsgDeviceMonitor { #[allow(non_snake_case)] pub struct MsgCommandReq { pub sequence: u32, - // ^ Sequence number + // ^ Sequence number pub command: String, - // ^ Command line to execute + // ^ Command line to execute } impl MsgCommandReq { pub const TYPE: u16 = 184; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgCommandReq{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgCommandReq { sequence: _buf.read_u32::()?, - command: ::read_string(_buf)?, - } ) + command: ::parser::read_string(_buf)?, + }) } } - // Exit code from executed command (device => host) // // The response to MSG_COMMAND_REQ with the return code of @@ -578,22 +550,21 @@ impl MsgCommandReq { #[allow(non_snake_case)] pub struct MsgCommandResp { pub sequence: u32, - // ^ Sequence number + // ^ Sequence number pub code: i32, - // ^ Exit code + // ^ Exit code } impl MsgCommandResp { pub const TYPE: u16 = 185; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgCommandResp{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgCommandResp { sequence: _buf.read_u32::()?, code: _buf.read_i32::()?, - } ) + }) } } - // Command output // // Returns the standard output and standard error of the @@ -605,22 +576,21 @@ impl MsgCommandResp { #[allow(non_snake_case)] pub struct MsgCommandOutput { pub sequence: u32, - // ^ Sequence number + // ^ Sequence number pub line: String, - // ^ Line of standard output or standard error + // ^ Line of standard output or standard error } impl MsgCommandOutput { pub const TYPE: u16 = 188; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgCommandOutput{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgCommandOutput { sequence: _buf.read_u32::()?, - line: ::read_string(_buf)?, - } ) + line: ::parser::read_string(_buf)?, + }) } } - // Request state of Piksi network interfaces // // Request state of Piksi network interfaces. @@ -628,18 +598,15 @@ impl MsgCommandOutput { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgNetworkStateReq { -} +pub struct MsgNetworkStateReq {} impl MsgNetworkStateReq { pub const TYPE: u16 = 186; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgNetworkStateReq{ - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgNetworkStateReq {}) } } - // State of network interface // // The state of a network interface on the Piksi. @@ -650,40 +617,39 @@ impl MsgNetworkStateReq { #[allow(non_snake_case)] pub struct MsgNetworkStateResp { pub ipv4_address: Vec, - // ^ IPv4 address (all zero when unavailable) + // ^ IPv4 address (all zero when unavailable) pub ipv4_mask_size: u8, - // ^ IPv4 netmask CIDR notation + // ^ IPv4 netmask CIDR notation pub ipv6_address: Vec, - // ^ IPv6 address (all zero when unavailable) + // ^ IPv6 address (all zero when unavailable) pub ipv6_mask_size: u8, - // ^ IPv6 netmask CIDR notation + // ^ IPv6 netmask CIDR notation pub rx_bytes: u32, - // ^ Number of Rx bytes + // ^ Number of Rx bytes pub tx_bytes: u32, - // ^ Number of Tx bytes + // ^ Number of Tx bytes pub interface_name: String, - // ^ Interface Name + // ^ Interface Name pub flags: u32, - // ^ Interface flags from SIOCGIFFLAGS + // ^ Interface flags from SIOCGIFFLAGS } impl MsgNetworkStateResp { pub const TYPE: u16 = 187; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgNetworkStateResp{ - ipv4_address: ::read_u8_array_limit(_buf, 4)?, + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgNetworkStateResp { + ipv4_address: ::parser::read_u8_array_limit(_buf, 4)?, ipv4_mask_size: _buf.read_u8()?, - ipv6_address: ::read_u8_array_limit(_buf, 16)?, + ipv6_address: ::parser::read_u8_array_limit(_buf, 16)?, ipv6_mask_size: _buf.read_u8()?, rx_bytes: _buf.read_u32::()?, tx_bytes: _buf.read_u32::()?, - interface_name: ::read_string_limit(_buf, 16)?, + interface_name: ::parser::read_string_limit(_buf, 16)?, flags: _buf.read_u32::()?, - } ) + }) } } - // Bandwidth usage measurement for a single interface. // // The bandwidth usage for each interface can be reported @@ -691,71 +657,100 @@ impl MsgNetworkStateResp { // specify the type of traffic that is being tracked. As // either the interval of collection or the collection time // may vary, both a timestamp and period field is provided, -// though may not necessarily be populated with a value. +// though may not necessarily be populated with a value. // #[derive(Debug)] #[allow(non_snake_case)] pub struct NetworkUsage { pub duration: u64, - // ^ Duration over which the measurement was collected + // ^ Duration over which the measurement was collected pub total_bytes: u64, - // ^ Number of bytes handled in total within period + // ^ Number of bytes handled in total within period pub rx_bytes: u32, - // ^ Number of bytes transmitted within period + // ^ Number of bytes transmitted within period pub tx_bytes: u32, - // ^ Number of bytes received within period + // ^ Number of bytes received within period pub interface_name: String, - // ^ Interface Name + // ^ Interface Name } impl NetworkUsage { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( NetworkUsage{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(NetworkUsage { duration: _buf.read_u64::()?, total_bytes: _buf.read_u64::()?, rx_bytes: _buf.read_u32::()?, tx_bytes: _buf.read_u32::()?, - interface_name: ::read_string_limit(_buf, 16)?, - } ) + interface_name: ::parser::read_string_limit(_buf, 16)?, + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( NetworkUsage::parse(buf)? ); + v.push(NetworkUsage::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( NetworkUsage::parse(buf)? ); + v.push(NetworkUsage::parse(buf)?); } Ok(v) } } - // Bandwidth usage reporting message // -// The bandwidth usage, a list of usage by interface. +// The bandwidth usage, a list of usage by interface. // #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgNetworkBandwidthUsage { pub interfaces: Vec, - // ^ Usage measurement array + // ^ Usage measurement array } impl MsgNetworkBandwidthUsage { pub const TYPE: u16 = 189; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgNetworkBandwidthUsage{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgNetworkBandwidthUsage { interfaces: NetworkUsage::parse_array(_buf)?, - } ) + }) } } +// Cell modem information update message +// +// If a cell modem is present on a piksi device, this message +// will be send periodically to update the host on the status +// of the modem and its various parameters. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgCellModemStatus { + pub signal_strength: i8, + // ^ Received cell signal strength in dBm, zero translates to unknown + pub signal_error_rate: f32, + // ^ BER as reported by the modem, zero translates to unknown + pub reserved: Vec, + // ^ Unspecified data TBD for this schema +} + +impl MsgCellModemStatus { + pub const TYPE: u16 = 190; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgCellModemStatus { + signal_strength: _buf.read_i8()?, + signal_error_rate: _buf.read_f32::()?, + reserved: ::parser::read_u8_array(_buf)?, + }) + } +} // Deprecated // @@ -765,37 +760,36 @@ impl MsgNetworkBandwidthUsage { #[allow(non_snake_case)] pub struct MsgSpecanDep { pub channel_tag: u16, - // ^ Channel ID + // ^ Channel ID pub t: GPSTimeDep, - // ^ Receiver time of this observation + // ^ Receiver time of this observation pub freq_ref: f32, - // ^ Reference frequency of this packet + // ^ Reference frequency of this packet pub freq_step: f32, - // ^ Frequency step of points in this packet + // ^ Frequency step of points in this packet pub amplitude_ref: f32, - // ^ Reference amplitude of this packet + // ^ Reference amplitude of this packet pub amplitude_unit: f32, - // ^ Amplitude unit value of points in this packet + // ^ Amplitude unit value of points in this packet pub amplitude_value: Vec, - // ^ Amplitude values (in the above units) of points in this packet + // ^ Amplitude values (in the above units) of points in this packet } impl MsgSpecanDep { pub const TYPE: u16 = 80; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSpecanDep{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSpecanDep { channel_tag: _buf.read_u16::()?, t: GPSTimeDep::parse(_buf)?, freq_ref: _buf.read_f32::()?, freq_step: _buf.read_f32::()?, amplitude_ref: _buf.read_f32::()?, amplitude_unit: _buf.read_f32::()?, - amplitude_value: ::read_u8_array(_buf)?, - } ) + amplitude_value: ::parser::read_u8_array(_buf)?, + }) } } - // Spectrum analyzer // // Spectrum analyzer packet. @@ -804,33 +798,60 @@ impl MsgSpecanDep { #[allow(non_snake_case)] pub struct MsgSpecan { pub channel_tag: u16, - // ^ Channel ID + // ^ Channel ID pub t: GPSTime, - // ^ Receiver time of this observation + // ^ Receiver time of this observation pub freq_ref: f32, - // ^ Reference frequency of this packet + // ^ Reference frequency of this packet pub freq_step: f32, - // ^ Frequency step of points in this packet + // ^ Frequency step of points in this packet pub amplitude_ref: f32, - // ^ Reference amplitude of this packet + // ^ Reference amplitude of this packet pub amplitude_unit: f32, - // ^ Amplitude unit value of points in this packet + // ^ Amplitude unit value of points in this packet pub amplitude_value: Vec, - // ^ Amplitude values (in the above units) of points in this packet + // ^ Amplitude values (in the above units) of points in this packet } impl MsgSpecan { pub const TYPE: u16 = 81; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSpecan{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSpecan { channel_tag: _buf.read_u16::()?, t: GPSTime::parse(_buf)?, freq_ref: _buf.read_f32::()?, freq_step: _buf.read_f32::()?, amplitude_ref: _buf.read_f32::()?, amplitude_unit: _buf.read_f32::()?, - amplitude_value: ::read_u8_array(_buf)?, - } ) + amplitude_value: ::parser::read_u8_array(_buf)?, + }) } } +// RF AGC status +// +// This message describes the gain of each channel in the receiver frontend. Each +// gain is encoded as a non-dimensional percentage relative to the maximum range +// possible for the gain stage of the frontend. By convention, each gain array +// has 8 entries and the index of the array corresponding to the index of the rf channel +// in the frontend. A gain of 127 percent encodes that rf channel is not present in the hardware. +// A negative value implies an error for the particular gain stage as reported by the frontend. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgFrontEndGain { + pub rf_gain: Vec, + // ^ RF gain for each frontend channel + pub if_gain: Vec, + // ^ Intermediate frequency gain for each frontend channel +} + +impl MsgFrontEndGain { + pub const TYPE: u16 = 191; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgFrontEndGain { + rf_gain: ::parser::read_s8_array_limit(_buf, 8)?, + if_gain: ::parser::read_s8_array_limit(_buf, 8)?, + }) + } +} diff --git a/rust/sbp/src/messages/sbas.rs b/rust/sbp/src/messages/sbas.rs index 37bfdc9d11..aaad8df3de 100644 --- a/rust/sbp/src/messages/sbas.rs +++ b/rust/sbp/src/messages/sbas.rs @@ -12,14 +12,12 @@ // Automatically generated from yaml/swiftnav/sbp/sbas.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // SBAS data extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; +use self::byteorder::{LittleEndian, ReadBytesExt}; use super::gnss::*; - // Raw SBAS data // // This message is sent once per second per SBAS satellite. ME checks the @@ -29,24 +27,23 @@ use super::gnss::*; #[allow(non_snake_case)] pub struct MsgSbasRaw { pub sid: GnssSignal, - // ^ GNSS signal identifier. + // ^ GNSS signal identifier. pub tow: u32, - // ^ GPS time-of-week at the start of the data block. + // ^ GPS time-of-week at the start of the data block. pub message_type: u8, - // ^ SBAS message type (0-63) + // ^ SBAS message type (0-63) pub data: Vec, - // ^ Raw SBAS data field of 212 bits (last byte padded with zeros). + // ^ Raw SBAS data field of 212 bits (last byte padded with zeros). } impl MsgSbasRaw { pub const TYPE: u16 = 30583; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSbasRaw{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSbasRaw { sid: GnssSignal::parse(_buf)?, tow: _buf.read_u32::()?, message_type: _buf.read_u8()?, - data: ::read_u8_array_limit(_buf, 27)?, - } ) + data: ::parser::read_u8_array_limit(_buf, 27)?, + }) } } - diff --git a/rust/sbp/src/messages/settings.rs b/rust/sbp/src/messages/settings.rs index 7211b03641..4303c8df64 100644 --- a/rust/sbp/src/messages/settings.rs +++ b/rust/sbp/src/messages/settings.rs @@ -12,37 +12,35 @@ // Automatically generated from yaml/swiftnav/sbp/settings.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - -// +// // Messages for reading, writing, and discovering device settings. Settings // with a "string" field have multiple values in this field delimited with a // null character (the c style null terminator). For instance, when querying // the 'firmware_version' setting in the 'system_info' section, the following // array of characters needs to be sent for the string field in -// MSG_SETTINGS_READ: "system_info\0firmware_version\0", where the delimiting +// MSG_SETTINGS_READ: "system_info\0firmware_version\0", where the delimiting // null characters are specified with the escape sequence '\0' and all -// quotation marks should be omitted. -// -// +// quotation marks should be omitted. +// +// // In the message descriptions below, the generic strings SECTION_SETTING and // SETTING are used to refer to the two strings that comprise the identifier // of an individual setting.In firmware_version example above, SECTION_SETTING -// is the 'system_info', and the SETTING portion is 'firmware_version'. -// +// is the 'system_info', and the SETTING portion is 'firmware_version'. +// // See the "Software Settings Manual" on support.swiftnav.com for detailed // documentation about all settings and sections available for each Swift // firmware version. Settings manuals are available for each firmware version // at the following link: [Piksi Multi Specifications](https://support.swiftnav.com/customer/en/portal/articles/2628580-piksi-multi-specifications#settings). -// The latest settings document is also available at the following link: +// The latest settings document is also available at the following link: // [Latest settings document](http://swiftnav.com/latest/piksi-multi-settings) . -// See lastly [settings.py](https://github.com/swift-nav/piksi_tools/blob/master/piksi_tools/settings.py) , +// See lastly [settings.py](https://github.com/swift-nav/piksi_tools/blob/master/piksi_tools/settings.py) , // the open source python command line utility for reading, writing, and // saving settings in the piksi_tools repository on github as a helpful // reference and example. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; - +use self::byteorder::{LittleEndian, ReadBytesExt}; // Save settings to flash (host => device) // @@ -51,23 +49,20 @@ use self::byteorder::{LittleEndian,ReadBytesExt}; // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgSettingsSave { -} +pub struct MsgSettingsSave {} impl MsgSettingsSave { pub const TYPE: u16 = 161; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSettingsSave{ - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSettingsSave {}) } } - // Write device configuration settings (host => device) // // The setting message writes the device configuration for a particular // setting via A NULL-terminated and NULL-delimited string with contents -// "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes +// "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes // the NULL character and where quotation marks are omitted. A device will // only process to this message when it is received from sender ID 0x42. // An example string that could be sent to a device is @@ -77,20 +72,19 @@ impl MsgSettingsSave { #[allow(non_snake_case)] pub struct MsgSettingsWrite { pub setting: String, - // ^ A NULL-terminated and NULL-delimited string with contents - // "SECTION_SETTING\0SETTING\0VALUE\0" + // ^ A NULL-terminated and NULL-delimited string with contents + // "SECTION_SETTING\0SETTING\0VALUE\0" } impl MsgSettingsWrite { pub const TYPE: u16 = 160; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSettingsWrite{ - setting: ::read_string(_buf)?, - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSettingsWrite { + setting: ::parser::read_string(_buf)?, + }) } } - // Acknowledgement with status of MSG_SETTINGS_WRITE // // Return the status of a write request with the new value of the @@ -105,23 +99,22 @@ impl MsgSettingsWrite { #[allow(non_snake_case)] pub struct MsgSettingsWriteResp { pub status: u8, - // ^ Write status + // ^ Write status pub setting: String, - // ^ A NULL-terminated and delimited string with contents - // "SECTION_SETTING\0SETTING\0VALUE\0" + // ^ A NULL-terminated and delimited string with contents + // "SECTION_SETTING\0SETTING\0VALUE\0" } impl MsgSettingsWriteResp { pub const TYPE: u16 = 175; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSettingsWriteResp{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSettingsWriteResp { status: _buf.read_u8()?, - setting: ::read_string(_buf)?, - } ) + setting: ::parser::read_string(_buf)?, + }) } } - // Read device configuration settings (host => device) // // The setting message that reads the device configuration. The string @@ -137,20 +130,19 @@ impl MsgSettingsWriteResp { #[allow(non_snake_case)] pub struct MsgSettingsReadReq { pub setting: String, - // ^ A NULL-terminated and NULL-delimited string with contents - // "SECTION_SETTING\0SETTING\0" + // ^ A NULL-terminated and NULL-delimited string with contents + // "SECTION_SETTING\0SETTING\0" } impl MsgSettingsReadReq { pub const TYPE: u16 = 164; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSettingsReadReq{ - setting: ::read_string(_buf)?, - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSettingsReadReq { + setting: ::parser::read_string(_buf)?, + }) } } - // Read device configuration settings (host <= device) // // The setting message wich which the device responds after a @@ -165,48 +157,46 @@ impl MsgSettingsReadReq { #[allow(non_snake_case)] pub struct MsgSettingsReadResp { pub setting: String, - // ^ A NULL-terminated and NULL-delimited string with contents - // "SECTION_SETTING\0SETTING\0VALUE\0" + // ^ A NULL-terminated and NULL-delimited string with contents + // "SECTION_SETTING\0SETTING\0VALUE\0" } impl MsgSettingsReadResp { pub const TYPE: u16 = 165; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSettingsReadResp{ - setting: ::read_string(_buf)?, - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSettingsReadResp { + setting: ::parser::read_string(_buf)?, + }) } } - // Read setting by direct index (host => device) // // The settings message for iterating through the settings -// values. A device will respond to this message with a +// values. A device will respond to this message with a // "MSG_SETTINGS_READ_BY_INDEX_RESP". // #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsReadByIndexReq { pub index: u16, - // ^ An index into the device settings, with values ranging from 0 to - // length(settings) + // ^ An index into the device settings, with values ranging from 0 to + // length(settings) } impl MsgSettingsReadByIndexReq { pub const TYPE: u16 = 162; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSettingsReadByIndexReq{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSettingsReadByIndexReq { index: _buf.read_u16::()?, - } ) + }) } } - // Read setting by direct index (host <= device) // // The settings message that reports the value of a setting at an index. -// +// // In the string field, it reports NULL-terminated and delimited string // with contents "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0". where // the '\0' escape sequence denotes the NULL character and where quotation @@ -220,42 +210,38 @@ impl MsgSettingsReadByIndexReq { #[allow(non_snake_case)] pub struct MsgSettingsReadByIndexResp { pub index: u16, - // ^ An index into the device settings, with values ranging from 0 to - // length(settings) + // ^ An index into the device settings, with values ranging from 0 to + // length(settings) pub setting: String, - // ^ A NULL-terminated and delimited string with contents - // "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0" + // ^ A NULL-terminated and delimited string with contents + // "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0" } impl MsgSettingsReadByIndexResp { pub const TYPE: u16 = 167; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSettingsReadByIndexResp{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSettingsReadByIndexResp { index: _buf.read_u16::()?, - setting: ::read_string(_buf)?, - } ) + setting: ::parser::read_string(_buf)?, + }) } } - // Finished reading settings (host <= device) // // The settings message for indicating end of the settings values. // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgSettingsReadByIndexDone { -} +pub struct MsgSettingsReadByIndexDone {} impl MsgSettingsReadByIndexDone { pub const TYPE: u16 = 166; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSettingsReadByIndexDone{ - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSettingsReadByIndexDone {}) } } - // Register setting and default value (device => host) // // This message registers the presence and default value of a setting @@ -266,16 +252,43 @@ impl MsgSettingsReadByIndexDone { #[allow(non_snake_case)] pub struct MsgSettingsRegister { pub setting: String, - // ^ A NULL-terminated and delimited string with contents - // "SECTION_SETTING\0SETTING\0VALUE". + // ^ A NULL-terminated and delimited string with contents + // "SECTION_SETTING\0SETTING\0VALUE". } impl MsgSettingsRegister { pub const TYPE: u16 = 174; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSettingsRegister{ - setting: ::read_string(_buf)?, - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSettingsRegister { + setting: ::parser::read_string(_buf)?, + }) } } +// Register setting and default value (device <= host) +// +// This message responds to setting registration with the effective value. +// The effective value shall differ from the given default value if setting +// was already registered or is available in the permanent setting storage +// and had a different value. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSettingsRegisterResp { + pub status: u8, + // ^ Register status + pub setting: String, + // ^ A NULL-terminated and delimited string with contents + // "SECTION_SETTING\0SETTING\0VALUE". The meaning of value is defined + // according to the status field. +} + +impl MsgSettingsRegisterResp { + pub const TYPE: u16 = 431; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSettingsRegisterResp { + status: _buf.read_u8()?, + setting: ::parser::read_string(_buf)?, + }) + } +} diff --git a/rust/sbp/src/messages/ssr.rs b/rust/sbp/src/messages/ssr.rs index 24d7508f16..fed2991140 100644 --- a/rust/sbp/src/messages/ssr.rs +++ b/rust/sbp/src/messages/ssr.rs @@ -12,14 +12,12 @@ // Automatically generated from yaml/swiftnav/sbp/ssr.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Precise State Space Representation (SSR) corrections format extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; +use self::byteorder::{LittleEndian, ReadBytesExt}; use super::gnss::*; - // SSR code biases corrections for a particular satellite. // // Code biases are to be added to pseudorange. @@ -29,36 +27,38 @@ use super::gnss::*; #[allow(non_snake_case)] pub struct CodeBiasesContent { pub code: u8, - // ^ Signal constellation, band and code + // ^ Signal constellation, band and code pub value: i16, - // ^ Code bias value + // ^ Code bias value } impl CodeBiasesContent { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( CodeBiasesContent{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(CodeBiasesContent { code: _buf.read_u8()?, value: _buf.read_i16::()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( CodeBiasesContent::parse(buf)? ); + v.push(CodeBiasesContent::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( CodeBiasesContent::parse(buf)? ); + v.push(CodeBiasesContent::parse(buf)?); } Ok(v) } } - // SSR phase biases corrections for a particular satellite. // // Phase biases are to be added to carrier phase measurements. @@ -68,50 +68,383 @@ impl CodeBiasesContent { #[allow(non_snake_case)] pub struct PhaseBiasesContent { pub code: u8, - // ^ Signal constellation, band and code + // ^ Signal constellation, band and code pub integer_indicator: u8, - // ^ Indicator for integer property + // ^ Indicator for integer property pub widelane_integer_indicator: u8, - // ^ Indicator for two groups of Wide-Lane(s) integer property + // ^ Indicator for two groups of Wide-Lane(s) integer property pub discontinuity_counter: u8, - // ^ Signal phase discontinuity counter. Increased for every discontinuity - // in phase. + // ^ Signal phase discontinuity counter. Increased for every discontinuity in + // phase. pub bias: i32, - // ^ Phase bias for specified signal + // ^ Phase bias for specified signal } impl PhaseBiasesContent { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( PhaseBiasesContent{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(PhaseBiasesContent { code: _buf.read_u8()?, integer_indicator: _buf.read_u8()?, widelane_integer_indicator: _buf.read_u8()?, discontinuity_counter: _buf.read_u8()?, bias: _buf.read_i32::()?, - } ) + }) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push(PhaseBiasesContent::parse(buf)?); + } + Ok(v) + } + + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(PhaseBiasesContent::parse(buf)?); + } + Ok(v) + } +} + +// Header for MSG_SSR_STEC_CORRECTION message +// +// A full set of STEC information will likely span multiple SBP +// messages, since SBP message a limited to 255 bytes. The header +// is used to tie multiple SBP messages into a sequence. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct STECHeader { + pub time: GPSTime, + // ^ GNSS time of the STEC data + pub num_msgs: u8, + // ^ Number of messages in the dataset + pub seq_num: u8, + // ^ Position of this message in the dataset + pub ssr_update_interval: u16, + // ^ update interval in seconds + pub iod_ssr: u8, + // ^ range 0 - 15 +} + +impl STECHeader { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(STECHeader { + time: GPSTime::parse(_buf)?, + num_msgs: _buf.read_u8()?, + seq_num: _buf.read_u8()?, + ssr_update_interval: _buf.read_u16::()?, + iod_ssr: _buf.read_u8()?, + }) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push(STECHeader::parse(buf)?); + } + Ok(v) + } + + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(STECHeader::parse(buf)?); + } + Ok(v) + } +} + +// Header for MSG_SSR_GRIDDED_CORRECTION +// +// The 3GPP message contains nested variable length arrays +// which are not suppported in SBP, so each grid point will +// be identified by the index. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct GriddedCorrectionHeader { + pub time: GPSTime, + // ^ GNSS time of the STEC data + pub num_msgs: u16, + // ^ Number of messages in the dataset + pub seq_num: u16, + // ^ Position of this message in the dataset + pub ssr_update_interval: u16, + // ^ update interval in seconds + pub iod_ssr: u8, + // ^ range 0 - 15 + pub tropo_quality: u8, + // ^ troposphere quality indicator +} + +impl GriddedCorrectionHeader { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(GriddedCorrectionHeader { + time: GPSTime::parse(_buf)?, + num_msgs: _buf.read_u16::()?, + seq_num: _buf.read_u16::()?, + ssr_update_interval: _buf.read_u16::()?, + iod_ssr: _buf.read_u8()?, + tropo_quality: _buf.read_u8()?, + }) + } + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push(GriddedCorrectionHeader::parse(buf)?); + } + Ok(v) + } + + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(GriddedCorrectionHeader::parse(buf)?); + } + Ok(v) + } +} + +// None +// +// STEC for the given satellite. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct STECSatElement { + pub sv_id: SvId, + // ^ Unique space vehicle identifier + pub stec_quality_indicator: u8, + // ^ quality of STEC data + pub stec_coeff: Vec, + // ^ coefficents of the STEC polynomial +} + +impl STECSatElement { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(STECSatElement { + sv_id: SvId::parse(_buf)?, + stec_quality_indicator: _buf.read_u8()?, + stec_coeff: ::parser::read_s16_array_limit(_buf, 4)?, + }) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push(STECSatElement::parse(buf)?); + } + Ok(v) + } + + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(STECSatElement::parse(buf)?); + } + Ok(v) + } +} + +// troposphere delay correction +// +// Contains wet vertical and hydrostatic vertical delay +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct TroposphericDelayCorrection { + pub hydro: i16, + // ^ hydrostatic vertical delay + pub wet: i8, + // ^ wet vertical delay +} + +impl TroposphericDelayCorrection { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(TroposphericDelayCorrection { + hydro: _buf.read_i16::()?, + wet: _buf.read_i8()?, + }) + } + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push(TroposphericDelayCorrection::parse(buf)?); + } + Ok(v) + } + + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(TroposphericDelayCorrection::parse(buf)?); + } + Ok(v) + } +} + +// None +// +// STEC residual +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct STECResidual { + pub sv_id: SvId, + // ^ space vehicle identifier + pub residual: i16, + // ^ STEC residual +} + +impl STECResidual { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(STECResidual { + sv_id: SvId::parse(_buf)?, + residual: _buf.read_i16::()?, + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( PhaseBiasesContent::parse(buf)? ); + v.push(STECResidual::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( PhaseBiasesContent::parse(buf)? ); + v.push(STECResidual::parse(buf)?); } Ok(v) } } +// Grid datum for troposphere and STEC residuals +// +// Contains one tropo datum, plus STEC residuals for each space +// vehicle +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct GridElement { + pub index: u16, + // ^ index of the grid point + pub tropo_delay_correction: TroposphericDelayCorrection, + // ^ Wet and Hydrostatic Vertical Delay + pub STEC_residuals: Vec, + // ^ STEC Residual for the given space vehicle +} + +impl GridElement { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(GridElement { + index: _buf.read_u16::()?, + tropo_delay_correction: TroposphericDelayCorrection::parse(_buf)?, + STEC_residuals: STECResidual::parse_array(_buf)?, + }) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push(GridElement::parse(buf)?); + } + Ok(v) + } + + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(GridElement::parse(buf)?); + } + Ok(v) + } +} + +// Defines the grid for STEC and tropo grid messages +// +// Defines the grid for STEC and tropo grid messages. +// Also includes an RLE encoded validity list. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct GridDefinitionHeader { + pub region_size_inverse: u8, + // ^ inverse of region size + pub area_width: u16, + // ^ area width; see spec for details + pub lat_nw_corner_enc: u16, + // ^ encoded latitude of the northwest corner of the grid + pub lon_nw_corner_enc: u16, + // ^ encoded longitude of the northwest corner of the grid + pub num_msgs: u8, + // ^ Number of messages in the dataset + pub seq_num: u8, + // ^ Postion of this message in the dataset +} + +impl GridDefinitionHeader { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(GridDefinitionHeader { + region_size_inverse: _buf.read_u8()?, + area_width: _buf.read_u16::()?, + lat_nw_corner_enc: _buf.read_u16::()?, + lon_nw_corner_enc: _buf.read_u16::()?, + num_msgs: _buf.read_u8()?, + seq_num: _buf.read_u8()?, + }) + } + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push(GridDefinitionHeader::parse(buf)?); + } + Ok(v) + } + + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(GridDefinitionHeader::parse(buf)?); + } + Ok(v) + } +} // Precise orbit and clock correction // -// The precise orbit and clock correction message is -// to be applied as a delta correction to broadcast +// The precise orbit and clock correction message is +// to be applied as a delta correction to broadcast // ephemeris and is typically an equivalent to the 1060 // and 1066 RTCM message types // @@ -119,40 +452,103 @@ impl PhaseBiasesContent { #[allow(non_snake_case)] pub struct MsgSsrOrbitClock { pub time: GPSTimeSec, - // ^ GNSS reference time of the correction + // ^ GNSS reference time of the correction pub sid: GnssSignal, - // ^ GNSS signal identifier (16 bit) + // ^ GNSS signal identifier (16 bit) pub update_interval: u8, - // ^ Update interval between consecutive corrections + // ^ Update interval between consecutive corrections pub iod_ssr: u8, - // ^ IOD of the SSR correction. A change of Issue Of Data SSR is used to - // indicate a change in the SSR generating configuration - pub iod: u8, - // ^ Issue of broadcast ephemeris data + // ^ IOD of the SSR correction. A change of Issue Of Data SSR is used to + // indicate a change in the SSR generating configuration + pub iod: u32, + // ^ Issue of broadcast ephemeris data or IODCRC (Beidou) pub radial: i32, - // ^ Orbit radial delta correction + // ^ Orbit radial delta correction pub along: i32, - // ^ Orbit along delta correction + // ^ Orbit along delta correction pub cross: i32, - // ^ Orbit along delta correction + // ^ Orbit along delta correction pub dot_radial: i32, - // ^ Velocity of orbit radial delta correction + // ^ Velocity of orbit radial delta correction pub dot_along: i32, - // ^ Velocity of orbit along delta correction + // ^ Velocity of orbit along delta correction pub dot_cross: i32, - // ^ Velocity of orbit cross delta correction + // ^ Velocity of orbit cross delta correction pub c0: i32, - // ^ C0 polynomial coefficient for correction of broadcast satellite clock + // ^ C0 polynomial coefficient for correction of broadcast satellite clock pub c1: i32, - // ^ C1 polynomial coefficient for correction of broadcast satellite clock + // ^ C1 polynomial coefficient for correction of broadcast satellite clock pub c2: i32, - // ^ C2 polynomial coefficient for correction of broadcast satellite clock + // ^ C2 polynomial coefficient for correction of broadcast satellite clock } impl MsgSsrOrbitClock { + pub const TYPE: u16 = 1501; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSsrOrbitClock { + time: GPSTimeSec::parse(_buf)?, + sid: GnssSignal::parse(_buf)?, + update_interval: _buf.read_u8()?, + iod_ssr: _buf.read_u8()?, + iod: _buf.read_u32::()?, + radial: _buf.read_i32::()?, + along: _buf.read_i32::()?, + cross: _buf.read_i32::()?, + dot_radial: _buf.read_i32::()?, + dot_along: _buf.read_i32::()?, + dot_cross: _buf.read_i32::()?, + c0: _buf.read_i32::()?, + c1: _buf.read_i32::()?, + c2: _buf.read_i32::()?, + }) + } +} + +// Precise orbit and clock correction +// +// The precise orbit and clock correction message is +// to be applied as a delta correction to broadcast +// ephemeris and is typically an equivalent to the 1060 +// and 1066 RTCM message types +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSsrOrbitClockDepA { + pub time: GPSTimeSec, + // ^ GNSS reference time of the correction + pub sid: GnssSignal, + // ^ GNSS signal identifier (16 bit) + pub update_interval: u8, + // ^ Update interval between consecutive corrections + pub iod_ssr: u8, + // ^ IOD of the SSR correction. A change of Issue Of Data SSR is used to + // indicate a change in the SSR generating configuration + pub iod: u8, + // ^ Issue of broadcast ephemeris data + pub radial: i32, + // ^ Orbit radial delta correction + pub along: i32, + // ^ Orbit along delta correction + pub cross: i32, + // ^ Orbit along delta correction + pub dot_radial: i32, + // ^ Velocity of orbit radial delta correction + pub dot_along: i32, + // ^ Velocity of orbit along delta correction + pub dot_cross: i32, + // ^ Velocity of orbit cross delta correction + pub c0: i32, + // ^ C0 polynomial coefficient for correction of broadcast satellite clock + pub c1: i32, + // ^ C1 polynomial coefficient for correction of broadcast satellite clock + pub c2: i32, + // ^ C2 polynomial coefficient for correction of broadcast satellite clock +} + +impl MsgSsrOrbitClockDepA { pub const TYPE: u16 = 1500; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSsrOrbitClock{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSsrOrbitClockDepA { time: GPSTimeSec::parse(_buf)?, sid: GnssSignal::parse(_buf)?, update_interval: _buf.read_u8()?, @@ -167,85 +563,83 @@ impl MsgSsrOrbitClock { c0: _buf.read_i32::()?, c1: _buf.read_i32::()?, c2: _buf.read_i32::()?, - } ) + }) } } - // Precise code biases correction // // The precise code biases message is to be added // to the pseudorange of the corresponding signal -// to get corrected pseudorange. It is typically +// to get corrected pseudorange. It is typically // an equivalent to the 1059 and 1065 RTCM message types // #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSsrCodeBiases { pub time: GPSTimeSec, - // ^ GNSS reference time of the correction + // ^ GNSS reference time of the correction pub sid: GnssSignal, - // ^ GNSS signal identifier (16 bit) + // ^ GNSS signal identifier (16 bit) pub update_interval: u8, - // ^ Update interval between consecutive corrections + // ^ Update interval between consecutive corrections pub iod_ssr: u8, - // ^ IOD of the SSR correction. A change of Issue Of Data SSR is used to - // indicate a change in the SSR generating configuration + // ^ IOD of the SSR correction. A change of Issue Of Data SSR is used to + // indicate a change in the SSR generating configuration pub biases: Vec, - // ^ Code biases for the different satellite signals + // ^ Code biases for the different satellite signals } impl MsgSsrCodeBiases { pub const TYPE: u16 = 1505; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSsrCodeBiases{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSsrCodeBiases { time: GPSTimeSec::parse(_buf)?, sid: GnssSignal::parse(_buf)?, update_interval: _buf.read_u8()?, iod_ssr: _buf.read_u8()?, biases: CodeBiasesContent::parse_array(_buf)?, - } ) + }) } } - // Precise phase biases correction // // The precise phase biases message contains the biases // to be added to the carrier phase of the corresponding -// signal to get corrected carrier phase measurement, as -// well as the satellite yaw angle to be applied to compute -// the phase wind-up correction. +// signal to get corrected carrier phase measurement, as +// well as the satellite yaw angle to be applied to compute +// the phase wind-up correction. // It is typically an equivalent to the 1265 RTCM message types // #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSsrPhaseBiases { pub time: GPSTimeSec, - // ^ GNSS reference time of the correction + // ^ GNSS reference time of the correction pub sid: GnssSignal, - // ^ GNSS signal identifier (16 bit) + // ^ GNSS signal identifier (16 bit) pub update_interval: u8, - // ^ Update interval between consecutive corrections + // ^ Update interval between consecutive corrections pub iod_ssr: u8, - // ^ IOD of the SSR correction. A change of Issue Of Data SSR is used to - // indicate a change in the SSR generating configuration + // ^ IOD of the SSR correction. A change of Issue Of Data SSR is used to + // indicate a change in the SSR generating configuration pub dispersive_bias: u8, - // ^ Indicator for the dispersive phase biases property. + // ^ Indicator for the dispersive phase biases property. pub mw_consistency: u8, - // ^ Consistency indicator for Melbourne-Wubbena linear combinations + // ^ Consistency indicator for Melbourne-Wubbena linear combinations pub yaw: u16, - // ^ Satellite yaw angle + // ^ Satellite yaw angle pub yaw_rate: i8, - // ^ Satellite yaw angle rate + // ^ Satellite yaw angle rate pub biases: Vec, - // ^ Phase biases corrections for a satellite being tracked. + // ^ Phase biases corrections for a satellite being tracked. } impl MsgSsrPhaseBiases { pub const TYPE: u16 = 1510; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgSsrPhaseBiases{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSsrPhaseBiases { time: GPSTimeSec::parse(_buf)?, sid: GnssSignal::parse(_buf)?, update_interval: _buf.read_u8()?, @@ -255,7 +649,81 @@ impl MsgSsrPhaseBiases { yaw: _buf.read_u16::()?, yaw_rate: _buf.read_i8()?, biases: PhaseBiasesContent::parse_array(_buf)?, - } ) + }) } } +// Slant Total Electron Content +// +// The STEC per space vehicle, given as polynomial approximation for +// a given grid. This should be combined with SSR-GriddedCorrection +// message to get the state space representation of the atmospheric +// delay. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSsrStecCorrection { + pub header: STECHeader, + // ^ Header of a STEC message + pub stec_sat_list: Vec, + // ^ Array of STEC information for each space vehicle +} + +impl MsgSsrStecCorrection { + pub const TYPE: u16 = 1515; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSsrStecCorrection { + header: STECHeader::parse(_buf)?, + stec_sat_list: STECSatElement::parse_array(_buf)?, + }) + } +} + +// Gridded troposphere and STEC residuals +// +// STEC residuals are per space vehicle, tropo is not. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSsrGriddedCorrection { + pub header: GriddedCorrectionHeader, + // ^ Header of a Gridded Correction message + pub element: GridElement, + // ^ Tropo and STEC residuals for the given grid point +} + +impl MsgSsrGriddedCorrection { + pub const TYPE: u16 = 1520; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSsrGriddedCorrection { + header: GriddedCorrectionHeader::parse(_buf)?, + element: GridElement::parse(_buf)?, + }) + } +} + +// None +// +// Definition of the grid for STEC and tropo messages +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgSsrGridDefinition { + pub header: GridDefinitionHeader, + // ^ Header of a Gridded Correction message + pub rle_list: Vec, + // ^ Run Length Encode list of quadrants that contain valid data. The spec + // describes the encoding scheme in detail, but essentially the index of + // the quadrants that contain transitions between valid and invalid (and + // vice versa) are encoded as u8 integers. +} + +impl MsgSsrGridDefinition { + pub const TYPE: u16 = 1525; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgSsrGridDefinition { + header: GridDefinitionHeader::parse(_buf)?, + rle_list: ::parser::read_u8_array(_buf)?, + }) + } +} diff --git a/rust/sbp/src/messages/system.rs b/rust/sbp/src/messages/system.rs index 55eab44c7b..e667307aa5 100644 --- a/rust/sbp/src/messages/system.rs +++ b/rust/sbp/src/messages/system.rs @@ -12,12 +12,10 @@ // Automatically generated from yaml/swiftnav/sbp/system.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Standardized system messages from Swift Navigation devices. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; - +use self::byteorder::{LittleEndian, ReadBytesExt}; // System start-up message // @@ -30,25 +28,24 @@ use self::byteorder::{LittleEndian,ReadBytesExt}; #[allow(non_snake_case)] pub struct MsgStartup { pub cause: u8, - // ^ Cause of startup + // ^ Cause of startup pub startup_type: u8, - // ^ Startup type + // ^ Startup type pub reserved: u16, - // ^ Reserved + // ^ Reserved } impl MsgStartup { pub const TYPE: u16 = 65280; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgStartup{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgStartup { cause: _buf.read_u8()?, startup_type: _buf.read_u8()?, reserved: _buf.read_u16::()?, - } ) + }) } } - // Status of received corrections // // This message provides information about the receipt of Differential @@ -59,28 +56,27 @@ impl MsgStartup { #[allow(non_snake_case)] pub struct MsgDgnssStatus { pub flags: u8, - // ^ Status flags + // ^ Status flags pub latency: u16, - // ^ Latency of observation receipt + // ^ Latency of observation receipt pub num_signals: u8, - // ^ Number of signals from base station + // ^ Number of signals from base station pub source: String, - // ^ Corrections source string + // ^ Corrections source string } impl MsgDgnssStatus { pub const TYPE: u16 = 65282; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgDgnssStatus{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgDgnssStatus { flags: _buf.read_u8()?, latency: _buf.read_u16::()?, num_signals: _buf.read_u8()?, - source: ::read_string(_buf)?, - } ) + source: ::parser::read_string(_buf)?, + }) } } - // System heartbeat message // // The heartbeat message is sent periodically to inform the host @@ -89,7 +85,7 @@ impl MsgDgnssStatus { // flags that indicate to the host the status of the system and // whether it is operating correctly. Currently, the expected // heartbeat interval is 1 sec. -// +// // The system error flag is used to indicate that an error has // occurred in the system. To determine the source of the error, // the remaining error flags should be inspected. @@ -98,37 +94,87 @@ impl MsgDgnssStatus { #[allow(non_snake_case)] pub struct MsgHeartbeat { pub flags: u32, - // ^ Status flags + // ^ Status flags } impl MsgHeartbeat { pub const TYPE: u16 = 65535; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgHeartbeat{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgHeartbeat { flags: _buf.read_u32::()?, - } ) + }) } } - // Inertial Navigation System status message // // The INS status message describes the state of the operation -// and initialization of the inertial navigation system. +// and initialization of the inertial navigation system. // #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgInsStatus { pub flags: u32, - // ^ Status flags + // ^ Status flags } impl MsgInsStatus { pub const TYPE: u16 = 65283; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgInsStatus{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgInsStatus { flags: _buf.read_u32::()?, - } ) + }) } } +// Experimental telemetry message +// +// The CSAC telemetry message has an implementation defined telemetry string +// from a device. It is not produced or available on general Swift Products. +// It is intended to be a low rate message for status purposes. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgCsacTelemetry { + pub id: u8, + // ^ Index representing the type of telemetry in use. It is implemention + // defined. + pub telemetry: String, + // ^ Comma separated list of values as defined by the index +} + +impl MsgCsacTelemetry { + pub const TYPE: u16 = 65284; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgCsacTelemetry { + id: _buf.read_u8()?, + telemetry: ::parser::read_string(_buf)?, + }) + } +} + +// Experimental telemetry message labels +// +// The CSAC telemetry message provides labels for each member of the string +// produced by MSG_CSAC_TELEMETRY. It should be provided by a device at a lower +// rate than the MSG_CSAC_TELEMETRY. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgCsacTelemetryLabels { + pub id: u8, + // ^ Index representing the type of telemetry in use. It is implemention + // defined. + pub telemetry_labels: String, + // ^ Comma separated list of telemetry field values +} + +impl MsgCsacTelemetryLabels { + pub const TYPE: u16 = 65285; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgCsacTelemetryLabels { + id: _buf.read_u8()?, + telemetry_labels: ::parser::read_string(_buf)?, + }) + } +} diff --git a/rust/sbp/src/messages/tracking.rs b/rust/sbp/src/messages/tracking.rs index dadc09b580..865c8cc859 100644 --- a/rust/sbp/src/messages/tracking.rs +++ b/rust/sbp/src/messages/tracking.rs @@ -12,14 +12,12 @@ // Automatically generated from yaml/swiftnav/sbp/tracking.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Satellite code and carrier-phase tracking messages from the device. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; +use self::byteorder::{LittleEndian, ReadBytesExt}; use super::gnss::*; - // Detailed signal tracking channel states. DEPRECATED. // // The tracking message returns a set tracking channel parameters for a @@ -29,59 +27,59 @@ use super::gnss::*; #[allow(non_snake_case)] pub struct MsgTrackingStateDetailedDepA { pub recv_time: u64, - // ^ Receiver clock time. + // ^ Receiver clock time. pub tot: GPSTime, - // ^ Time of transmission of signal from satellite. TOW only valid when TOW - // status is decoded or propagated. WN only valid when week number valid - // flag is set. + // ^ Time of transmission of signal from satellite. TOW only valid when TOW + // status is decoded or propagated. WN only valid when week number valid + // flag is set. pub P: u32, - // ^ Pseudorange observation. Valid only when pseudorange valid flag is set. + // ^ Pseudorange observation. Valid only when pseudorange valid flag is set. pub P_std: u16, - // ^ Pseudorange observation standard deviation. Valid only when pseudorange - // valid flag is set. + // ^ Pseudorange observation standard deviation. Valid only when pseudorange + // valid flag is set. pub L: CarrierPhase, - // ^ Carrier phase observation with typical sign convention. Valid only when - // PLL pessimistic lock is achieved. + // ^ Carrier phase observation with typical sign convention. Valid only when + // PLL pessimistic lock is achieved. pub cn0: u8, - // ^ Carrier-to-Noise density + // ^ Carrier-to-Noise density pub lock: u16, - // ^ Lock time. It is encoded according to DF402 from the RTCM 10403.2 - // Amendment 2 specification. Valid values range from 0 to 15. + // ^ Lock time. It is encoded according to DF402 from the RTCM 10403.2 + // Amendment 2 specification. Valid values range from 0 to 15. pub sid: GnssSignal, - // ^ GNSS signal identifier. + // ^ GNSS signal identifier. pub doppler: i32, - // ^ Carrier Doppler frequency. + // ^ Carrier Doppler frequency. pub doppler_std: u16, - // ^ Carrier Doppler frequency standard deviation. + // ^ Carrier Doppler frequency standard deviation. pub uptime: u32, - // ^ Number of seconds of continuous tracking. Specifies how much time signal - // is in continuous track. + // ^ Number of seconds of continuous tracking. Specifies how much time signal + // is in continuous track. pub clock_offset: i16, - // ^ TCXO clock offset. Valid only when valid clock valid flag is set. + // ^ TCXO clock offset. Valid only when valid clock valid flag is set. pub clock_drift: i16, - // ^ TCXO clock drift. Valid only when valid clock valid flag is set. + // ^ TCXO clock drift. Valid only when valid clock valid flag is set. pub corr_spacing: u16, - // ^ Early-Prompt (EP) and Prompt-Late (PL) correlators spacing. + // ^ Early-Prompt (EP) and Prompt-Late (PL) correlators spacing. pub acceleration: i8, - // ^ Acceleration. Valid only when acceleration valid flag is set. + // ^ Acceleration. Valid only when acceleration valid flag is set. pub sync_flags: u8, - // ^ Synchronization status flags. + // ^ Synchronization status flags. pub tow_flags: u8, - // ^ TOW status flags. + // ^ TOW status flags. pub track_flags: u8, - // ^ Tracking loop status flags. + // ^ Tracking loop status flags. pub nav_flags: u8, - // ^ Navigation data status flags. + // ^ Navigation data status flags. pub pset_flags: u8, - // ^ Parameters sets flags. + // ^ Parameters sets flags. pub misc_flags: u8, - // ^ Miscellaneous flags. + // ^ Miscellaneous flags. } impl MsgTrackingStateDetailedDepA { pub const TYPE: u16 = 33; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgTrackingStateDetailedDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgTrackingStateDetailedDepA { recv_time: _buf.read_u64::()?, tot: GPSTime::parse(_buf)?, P: _buf.read_u32::()?, @@ -103,11 +101,10 @@ impl MsgTrackingStateDetailedDepA { nav_flags: _buf.read_u8()?, pset_flags: _buf.read_u8()?, misc_flags: _buf.read_u8()?, - } ) + }) } } - // Deprecated // // Deprecated. @@ -116,59 +113,59 @@ impl MsgTrackingStateDetailedDepA { #[allow(non_snake_case)] pub struct MsgTrackingStateDetailedDep { pub recv_time: u64, - // ^ Receiver clock time. + // ^ Receiver clock time. pub tot: GPSTimeDep, - // ^ Time of transmission of signal from satellite. TOW only valid when TOW - // status is decoded or propagated. WN only valid when week number valid - // flag is set. + // ^ Time of transmission of signal from satellite. TOW only valid when TOW + // status is decoded or propagated. WN only valid when week number valid + // flag is set. pub P: u32, - // ^ Pseudorange observation. Valid only when pseudorange valid flag is set. + // ^ Pseudorange observation. Valid only when pseudorange valid flag is set. pub P_std: u16, - // ^ Pseudorange observation standard deviation. Valid only when pseudorange - // valid flag is set. + // ^ Pseudorange observation standard deviation. Valid only when pseudorange + // valid flag is set. pub L: CarrierPhase, - // ^ Carrier phase observation with typical sign convention. Valid only when - // PLL pessimistic lock is achieved. + // ^ Carrier phase observation with typical sign convention. Valid only when + // PLL pessimistic lock is achieved. pub cn0: u8, - // ^ Carrier-to-Noise density + // ^ Carrier-to-Noise density pub lock: u16, - // ^ Lock time. It is encoded according to DF402 from the RTCM 10403.2 - // Amendment 2 specification. Valid values range from 0 to 15. + // ^ Lock time. It is encoded according to DF402 from the RTCM 10403.2 + // Amendment 2 specification. Valid values range from 0 to 15. pub sid: GnssSignalDep, - // ^ GNSS signal identifier. + // ^ GNSS signal identifier. pub doppler: i32, - // ^ Carrier Doppler frequency. + // ^ Carrier Doppler frequency. pub doppler_std: u16, - // ^ Carrier Doppler frequency standard deviation. + // ^ Carrier Doppler frequency standard deviation. pub uptime: u32, - // ^ Number of seconds of continuous tracking. Specifies how much time signal - // is in continuous track. + // ^ Number of seconds of continuous tracking. Specifies how much time signal + // is in continuous track. pub clock_offset: i16, - // ^ TCXO clock offset. Valid only when valid clock valid flag is set. + // ^ TCXO clock offset. Valid only when valid clock valid flag is set. pub clock_drift: i16, - // ^ TCXO clock drift. Valid only when valid clock valid flag is set. + // ^ TCXO clock drift. Valid only when valid clock valid flag is set. pub corr_spacing: u16, - // ^ Early-Prompt (EP) and Prompt-Late (PL) correlators spacing. + // ^ Early-Prompt (EP) and Prompt-Late (PL) correlators spacing. pub acceleration: i8, - // ^ Acceleration. Valid only when acceleration valid flag is set. + // ^ Acceleration. Valid only when acceleration valid flag is set. pub sync_flags: u8, - // ^ Synchronization status flags. + // ^ Synchronization status flags. pub tow_flags: u8, - // ^ TOW status flags. + // ^ TOW status flags. pub track_flags: u8, - // ^ Tracking loop status flags. + // ^ Tracking loop status flags. pub nav_flags: u8, - // ^ Navigation data status flags. + // ^ Navigation data status flags. pub pset_flags: u8, - // ^ Parameters sets flags. + // ^ Parameters sets flags. pub misc_flags: u8, - // ^ Miscellaneous flags. + // ^ Miscellaneous flags. } impl MsgTrackingStateDetailedDep { pub const TYPE: u16 = 17; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgTrackingStateDetailedDep{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgTrackingStateDetailedDep { recv_time: _buf.read_u64::()?, tot: GPSTimeDep::parse(_buf)?, P: _buf.read_u32::()?, @@ -190,11 +187,10 @@ impl MsgTrackingStateDetailedDep { nav_flags: _buf.read_u8()?, pset_flags: _buf.read_u8()?, misc_flags: _buf.read_u8()?, - } ) + }) } } - // Signal tracking channel state // // Tracking channel state for a specific satellite signal and @@ -204,39 +200,43 @@ impl MsgTrackingStateDetailedDep { #[allow(non_snake_case)] pub struct TrackingChannelState { pub sid: GnssSignal, - // ^ GNSS signal being tracked + // ^ GNSS signal being tracked pub fcn: u8, - // ^ Frequency channel number (GLONASS only) + // ^ Frequency channel number (GLONASS only) pub cn0: u8, - // ^ Carrier-to-Noise density. Zero implies invalid cn0. + // ^ Carrier-to-Noise density. Zero implies invalid cn0. } impl TrackingChannelState { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( TrackingChannelState{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(TrackingChannelState { sid: GnssSignal::parse(_buf)?, fcn: _buf.read_u8()?, cn0: _buf.read_u8()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( TrackingChannelState::parse(buf)? ); + v.push(TrackingChannelState::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( TrackingChannelState::parse(buf)? ); + v.push(TrackingChannelState::parse(buf)?); } Ok(v) } } - // Signal tracking channel states // // The tracking message returns a variable-length array of tracking @@ -247,18 +247,84 @@ impl TrackingChannelState { #[allow(non_snake_case)] pub struct MsgTrackingState { pub states: Vec, - // ^ Signal tracking channel state + // ^ Signal tracking channel state } impl MsgTrackingState { pub const TYPE: u16 = 65; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgTrackingState{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgTrackingState { states: TrackingChannelState::parse_array(_buf)?, - } ) + }) } } +// Measurement Engine signal tracking channel state +// +// Measurement Engine tracking channel state for a specific satellite signal +// and measured signal power. +// The mesid field for Glonass can either +// carry the FCN as 100 + FCN where FCN is in [-7, +6] or +// the Slot ID (from 1 to 28) +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MeasurementState { + pub mesid: GnssSignal, + // ^ Measurement Engine GNSS signal being tracked (carries either Glonass FCN + // or SLOT) + pub cn0: u8, + // ^ Carrier-to-Noise density. Zero implies invalid cn0. +} + +impl MeasurementState { + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MeasurementState { + mesid: GnssSignal::parse(_buf)?, + cn0: _buf.read_u8()?, + }) + } + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push(MeasurementState::parse(buf)?); + } + Ok(v) + } + + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(MeasurementState::parse(buf)?); + } + Ok(v) + } +} + +// Measurement Engine signal tracking channel states +// +// The tracking message returns a variable-length array of tracking +// channel states. It reports status and carrier-to-noise density +// measurements for all tracked satellites. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgMeasurementState { + pub states: Vec, + // ^ ME signal tracking channel state +} + +impl MsgMeasurementState { + pub const TYPE: u16 = 97; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgMeasurementState { + states: MeasurementState::parse_array(_buf)?, + }) + } +} // Complex correlation structure // @@ -267,37 +333,41 @@ impl MsgTrackingState { #[derive(Debug)] #[allow(non_snake_case)] pub struct TrackingChannelCorrelation { - pub I: i32, - // ^ In-phase correlation - pub Q: i32, - // ^ Quadrature correlation + pub I: i16, + // ^ In-phase correlation + pub Q: i16, + // ^ Quadrature correlation } impl TrackingChannelCorrelation { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( TrackingChannelCorrelation{ - I: _buf.read_i32::()?, - Q: _buf.read_i32::()?, - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(TrackingChannelCorrelation { + I: _buf.read_i16::()?, + Q: _buf.read_i16::()?, + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( TrackingChannelCorrelation::parse(buf)? ); + v.push(TrackingChannelCorrelation::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( TrackingChannelCorrelation::parse(buf)? ); + v.push(TrackingChannelCorrelation::parse(buf)?); } Ok(v) } } - // Tracking channel correlations // // When enabled, a tracking channel can output the correlations at each @@ -307,24 +377,94 @@ impl TrackingChannelCorrelation { #[allow(non_snake_case)] pub struct MsgTrackingIq { pub channel: u8, - // ^ Tracking channel of origin + // ^ Tracking channel of origin pub sid: GnssSignal, - // ^ GNSS signal identifier + // ^ GNSS signal identifier pub corrs: Vec, - // ^ Early, Prompt and Late correlations + // ^ Early, Prompt and Late correlations } impl MsgTrackingIq { - pub const TYPE: u16 = 44; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgTrackingIq{ + pub const TYPE: u16 = 45; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgTrackingIq { channel: _buf.read_u8()?, sid: GnssSignal::parse(_buf)?, corrs: TrackingChannelCorrelation::parse_array_limit(_buf, 3)?, - } ) + }) } } +// Complex correlation structure +// +// Structure containing in-phase and quadrature correlation components. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct TrackingChannelCorrelationDep { + pub I: i32, + // ^ In-phase correlation + pub Q: i32, + // ^ Quadrature correlation +} + +impl TrackingChannelCorrelationDep { + pub fn parse( + _buf: &mut &[u8], + ) -> Result { + Ok(TrackingChannelCorrelationDep { + I: _buf.read_i32::()?, + Q: _buf.read_i32::()?, + }) + } + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + while buf.len() > 0 { + v.push(TrackingChannelCorrelationDep::parse(buf)?); + } + Ok(v) + } + + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(TrackingChannelCorrelationDep::parse(buf)?); + } + Ok(v) + } +} + +// Tracking channel correlations +// +// When enabled, a tracking channel can output the correlations at each +// update interval. +// +#[derive(Debug)] +#[allow(non_snake_case)] +pub struct MsgTrackingIqDepB { + pub channel: u8, + // ^ Tracking channel of origin + pub sid: GnssSignal, + // ^ GNSS signal identifier + pub corrs: Vec, + // ^ Early, Prompt and Late correlations +} + +impl MsgTrackingIqDepB { + pub const TYPE: u16 = 44; + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgTrackingIqDepB { + channel: _buf.read_u8()?, + sid: GnssSignal::parse(_buf)?, + corrs: TrackingChannelCorrelationDep::parse_array_limit(_buf, 3)?, + }) + } +} // Deprecated // @@ -332,27 +472,26 @@ impl MsgTrackingIq { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgTrackingIqDep { +pub struct MsgTrackingIqDepA { pub channel: u8, - // ^ Tracking channel of origin + // ^ Tracking channel of origin pub sid: GnssSignalDep, - // ^ GNSS signal identifier - pub corrs: Vec, - // ^ Early, Prompt and Late correlations + // ^ GNSS signal identifier + pub corrs: Vec, + // ^ Early, Prompt and Late correlations } -impl MsgTrackingIqDep { +impl MsgTrackingIqDepA { pub const TYPE: u16 = 28; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgTrackingIqDep{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgTrackingIqDepA { channel: _buf.read_u8()?, sid: GnssSignalDep::parse(_buf)?, - corrs: TrackingChannelCorrelation::parse_array_limit(_buf, 3)?, - } ) + corrs: TrackingChannelCorrelationDep::parse_array_limit(_buf, 3)?, + }) } } - // Deprecated // // Deprecated. @@ -361,39 +500,43 @@ impl MsgTrackingIqDep { #[allow(non_snake_case)] pub struct TrackingChannelStateDepA { pub state: u8, - // ^ Status of tracking channel + // ^ Status of tracking channel pub prn: u8, - // ^ PRN-1 being tracked + // ^ PRN-1 being tracked pub cn0: f32, - // ^ Carrier-to-noise density + // ^ Carrier-to-noise density } impl TrackingChannelStateDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( TrackingChannelStateDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(TrackingChannelStateDepA { state: _buf.read_u8()?, prn: _buf.read_u8()?, cn0: _buf.read_f32::()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( TrackingChannelStateDepA::parse(buf)? ); + v.push(TrackingChannelStateDepA::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( TrackingChannelStateDepA::parse(buf)? ); + v.push(TrackingChannelStateDepA::parse(buf)?); } Ok(v) } } - // Deprecated // // Deprecated. @@ -402,19 +545,18 @@ impl TrackingChannelStateDepA { #[allow(non_snake_case)] pub struct MsgTrackingStateDepA { pub states: Vec, - // ^ Satellite tracking channel state + // ^ Satellite tracking channel state } impl MsgTrackingStateDepA { pub const TYPE: u16 = 22; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgTrackingStateDepA{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgTrackingStateDepA { states: TrackingChannelStateDepA::parse_array(_buf)?, - } ) + }) } } - // Deprecated. // // Deprecated. @@ -423,39 +565,43 @@ impl MsgTrackingStateDepA { #[allow(non_snake_case)] pub struct TrackingChannelStateDepB { pub state: u8, - // ^ Status of tracking channel + // ^ Status of tracking channel pub sid: GnssSignalDep, - // ^ GNSS signal being tracked + // ^ GNSS signal being tracked pub cn0: f32, - // ^ Carrier-to-noise density + // ^ Carrier-to-noise density } impl TrackingChannelStateDepB { - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( TrackingChannelStateDepB{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(TrackingChannelStateDepB { state: _buf.read_u8()?, sid: GnssSignalDep::parse(_buf)?, cn0: _buf.read_f32::()?, - } ) + }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array( + buf: &mut &[u8], + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { - v.push( TrackingChannelStateDepB::parse(buf)? ); + v.push(TrackingChannelStateDepB::parse(buf)?); } Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit( + buf: &mut &[u8], + n: usize, + ) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { - v.push( TrackingChannelStateDepB::parse(buf)? ); + v.push(TrackingChannelStateDepB::parse(buf)?); } Ok(v) } } - // Deprecated. // // Deprecated. @@ -464,15 +610,14 @@ impl TrackingChannelStateDepB { #[allow(non_snake_case)] pub struct MsgTrackingStateDepB { pub states: Vec, - // ^ Signal tracking channel state + // ^ Signal tracking channel state } impl MsgTrackingStateDepB { pub const TYPE: u16 = 19; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgTrackingStateDepB{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgTrackingStateDepB { states: TrackingChannelStateDepB::parse_array(_buf)?, - } ) + }) } } - diff --git a/rust/sbp/src/messages/user.rs b/rust/sbp/src/messages/user.rs index 0001318d4b..58559560d0 100644 --- a/rust/sbp/src/messages/user.rs +++ b/rust/sbp/src/messages/user.rs @@ -12,12 +12,10 @@ // Automatically generated from yaml/swiftnav/sbp/user.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Messages reserved for use by the user. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; - +use self::byteorder::{LittleEndian, ReadBytesExt}; // User data // @@ -28,15 +26,14 @@ use self::byteorder::{LittleEndian,ReadBytesExt}; #[allow(non_snake_case)] pub struct MsgUserData { pub contents: Vec, - // ^ User data payload + // ^ User data payload } impl MsgUserData { pub const TYPE: u16 = 2048; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgUserData{ - contents: ::read_u8_array(_buf)?, - } ) + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgUserData { + contents: ::parser::read_u8_array(_buf)?, + }) } } - diff --git a/rust/sbp/src/messages/vehicle.rs b/rust/sbp/src/messages/vehicle.rs index 0950dd7d21..4cc4cf2b84 100644 --- a/rust/sbp/src/messages/vehicle.rs +++ b/rust/sbp/src/messages/vehicle.rs @@ -12,42 +12,39 @@ // Automatically generated from yaml/swiftnav/sbp/vehicle.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ - // Messages from a vehicle. extern crate byteorder; #[allow(unused_imports)] -use self::byteorder::{LittleEndian,ReadBytesExt}; - +use self::byteorder::{LittleEndian, ReadBytesExt}; // Vehicle forward (x-axis) velocity // // Message representing the x component of vehicle velocity in the user frame at the odometry -// reference point(s) specified by the user. The offset for the odometry reference point and +// reference point(s) specified by the user. The offset for the odometry reference point and // the definition and origin of the user frame are defined through the device settings interface. -// There are 4 possible user-defined sources of this message which are labeled arbitrarily +// There are 4 possible user-defined sources of this message which are labeled arbitrarily // source 0 through 3. // #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgOdometry { pub tow: u32, - // ^ Time field representing either milliseconds in the GPS Week or local CPU - // time from the producing system in milliseconds. See the tow_source flag - // for the exact source of this timestamp. + // ^ Time field representing either milliseconds in the GPS Week or local CPU + // time from the producing system in milliseconds. See the tow_source flag + // for the exact source of this timestamp. pub velocity: i32, - // ^ The signed forward component of vehicle velocity. + // ^ The signed forward component of vehicle velocity. pub flags: u8, - // ^ Status flags + // ^ Status flags } impl MsgOdometry { pub const TYPE: u16 = 2307; - pub fn parse(_buf: &mut &[u8]) -> Result { - Ok( MsgOdometry{ + pub fn parse(_buf: &mut &[u8]) -> Result { + Ok(MsgOdometry { tow: _buf.read_u32::()?, velocity: _buf.read_i32::()?, flags: _buf.read_u8()?, - } ) + }) } } - From 239ffce4b88801ff66f708d314d6c59a4f5b6c2b Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Mon, 17 Jun 2019 08:45:30 -0700 Subject: [PATCH 11/25] Reimplemented the de-framing function using nom. Added a new "parser" type that is capable to reading from a stream and buffering the data across multiple calls to parse. --- .gitignore | 4 + Makefile | 1 + .../resources/sbp_messages_template.rs | 6 +- generator/sbpg/targets/rust.py | 8 +- rust/example/src/main.rs | 2 +- rust/sbp/Cargo.toml | 1 + rust/sbp/src/client/framer.rs | 36 ---- rust/sbp/src/client/mod.rs | 2 - rust/sbp/src/lib.rs | 137 +++++++++----- rust/sbp/src/parser/mod.rs | 178 ++++++++++++++++++ 10 files changed, 285 insertions(+), 90 deletions(-) delete mode 100644 rust/sbp/src/client/framer.rs delete mode 100644 rust/sbp/src/client/mod.rs create mode 100644 rust/sbp/src/parser/mod.rs diff --git a/.gitignore b/.gitignore index 25821343c8..56d8e18ef5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ .DS_Store *.*~ limbo/ +.idea/ # Byte-compiled / optimized / DLL files __pycache__/ @@ -71,4 +72,7 @@ sbp_out.* .stack-work/ .build/ +# rust +Cargo.lock + python/sbp/_version.py diff --git a/Makefile b/Makefile index 7a738cd7c9..0b8b455be9 100644 --- a/Makefile +++ b/Makefile @@ -201,6 +201,7 @@ gen-rust: -o $(SWIFTNAV_ROOT)/rust/ \ -r $(SBP_MAJOR_VERSION).$(SBP_MINOR_VERSION).$(SBP_PATCH_VERSION) \ --rust + cd $(SWIFTNAV_ROOT)/rust/sbp && cargo fmt $(call announce-begin,"Finished generating Rust bindings") gen-protobuf: diff --git a/generator/sbpg/targets/resources/sbp_messages_template.rs b/generator/sbpg/targets/resources/sbp_messages_template.rs index 4e7fd923eb..93d705e2f7 100644 --- a/generator/sbpg/targets/resources/sbp_messages_template.rs +++ b/generator/sbpg/targets/resources/sbp_messages_template.rs @@ -44,7 +44,7 @@ impl (((m.identifier|camel_case))) { ((*- if m.sbp_id *)) pub const TYPE: u16 = (((m.sbp_id))); ((*- endif *)) - pub fn parse(_buf: &mut &[u8]) -> Result<(((m.identifier|camel_case))), ::Error> { + pub fn parse(_buf: &mut &[u8]) -> Result<(((m.identifier|camel_case))), ::parser::MessageError> { Ok( (((m.identifier|camel_case))){ ((*- for f in m.fields *)) (((f.identifier))): (((f|parse_type)))?, @@ -52,7 +52,7 @@ impl (((m.identifier|camel_case))) { } ) } ((*- if not m.sbp_id *)) - pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); while buf.len() > 0 { v.push( (((m.identifier|camel_case)))::parse(buf)? ); @@ -60,7 +60,7 @@ impl (((m.identifier|camel_case))) { Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::parser::MessageError> { let mut v = Vec::new(); for _ in 0..n { v.push( (((m.identifier|camel_case)))::parse(buf)? ); diff --git a/generator/sbpg/targets/rust.py b/generator/sbpg/targets/rust.py index 3676d51929..05a3d6a28f 100644 --- a/generator/sbpg/targets/rust.py +++ b/generator/sbpg/targets/rust.py @@ -70,9 +70,9 @@ def parse_type(field): """ if field.type_id == 'string': if field.options.has_key('size'): - return "::read_string_limit(_buf, %s)" % field.options['size'].value + return "::parser::read_string_limit(_buf, %s)" % field.options['size'].value else: - return "::read_string(_buf)" + return "::parser::read_string(_buf)" elif field.type_id == 'u8': return '_buf.read_u8()' elif field.type_id == 's8': @@ -85,9 +85,9 @@ def parse_type(field): t = field.options['fill'].value if t in TYPE_MAP.keys(): if field.options.has_key('size'): - return '::read_%s_array_limit(_buf, %d)' % (t, field.options['size'].value) + return '::parser::read_%s_array_limit(_buf, %d)' % (t, field.options['size'].value) else: - return '::read_%s_array(_buf)' % t + return '::parser::read_%s_array(_buf)' % t else: if field.options.has_key('size'): return '%s::parse_array_limit(_buf, %d)' % (t, field.options['size'].value) diff --git a/rust/example/src/main.rs b/rust/example/src/main.rs index fe5b4fcb1f..1c5489e5b5 100644 --- a/rust/example/src/main.rs +++ b/rust/example/src/main.rs @@ -20,7 +20,7 @@ fn main() { .expect("open failed"); loop { - match sbp::client::framer::receive(&mut port) { + match sbp::client::parser::parse(&mut port) { Ok(SBP::MsgLog(x)) => println!("{}", x.text), Ok(SBP::MsgPosLLH(x)) => diff --git a/rust/sbp/Cargo.toml b/rust/sbp/Cargo.toml index d77cef4f77..aee596eeca 100644 --- a/rust/sbp/Cargo.toml +++ b/rust/sbp/Cargo.toml @@ -6,3 +6,4 @@ authors = ["Gareth McMullin "] [dependencies] byteorder = "1.2.1" crc16 = "*" +nom = "5.0.0-beta2" diff --git a/rust/sbp/src/client/framer.rs b/rust/sbp/src/client/framer.rs deleted file mode 100644 index 3c0436f731..0000000000 --- a/rust/sbp/src/client/framer.rs +++ /dev/null @@ -1,36 +0,0 @@ -extern crate byteorder; -extern crate crc16; - -use self::byteorder::{LittleEndian,ReadBytesExt}; -use std::io::Read; -use ::messages::SBP; - -const SBP_PREAMBLE: u8 = 0x55; - -pub fn receive(a: &mut Read) -> Result { - let mut preamble = [0]; - a.read_exact(&mut preamble)?; - if preamble[0] != SBP_PREAMBLE { - return Err(::Error::InvalidPreamble); - } - let mut crc_state = crc16::State::::new(); - let mut header = [0; 5]; - a.read_exact(&mut header)?; - crc_state.update(&header); - let mut header = &header[..]; - let msg_id = header.read_u16::()?; - let _sender = header.read_u16::()?; - let len = header.read_u8()? as usize; - - let mut payload = [0; 256]; - let mut payload = &mut payload[..len]; - a.read_exact(&mut payload)?; - crc_state.update(&payload); - - let crc = a.read_u16::()?; - if crc != crc_state.get() { - return Err(::Error::CRCMismatch); - } - - SBP::parse(msg_id, &mut &payload[..]) -} diff --git a/rust/sbp/src/client/mod.rs b/rust/sbp/src/client/mod.rs deleted file mode 100644 index def257e314..0000000000 --- a/rust/sbp/src/client/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod framer; - diff --git a/rust/sbp/src/lib.rs b/rust/sbp/src/lib.rs index 0cbe3cea90..70906c04d9 100644 --- a/rust/sbp/src/lib.rs +++ b/rust/sbp/src/lib.rs @@ -1,58 +1,107 @@ -pub mod client; pub mod messages; - -extern crate byteorder; -use self::byteorder::{LittleEndian,ReadBytesExt}; -use std::io::{self, Read}; +pub mod parser; #[derive(Debug)] pub enum Error { - InvalidPreamble, - CRCMismatch, ParseError, - IoError(io::Error) -} - -impl From for Error { - fn from(error: io::Error) -> Self { - Error::IoError(error) - } -} - -fn read_string(buf: &mut Read) -> Result { - let mut s = String::new(); - buf.read_to_string(&mut s)?; - Ok(s) -} - -fn read_string_limit(buf: &mut Read, n: u64) -> Result { - read_string(&mut buf.take(n)) -} - -fn read_u8_array(buf: &mut &[u8]) -> Result, Error> { - Ok(buf.to_vec()) + NotEnoughData, + UnrecoverableFailure, + IoError(std::io::Error), } -fn read_u8_array_limit(buf: &mut &[u8], n:usize) -> Result, Error> { - let mut v = Vec::new(); - for _ in 0..n { - v.push(buf.read_u8()?); +#[cfg(test)] +mod tests { + #[test] + fn baseline_ecef() { + let baseline_ecef_payload = [ + 0x28u8, 0xf4, 0x7a, 0x13, 0x96, 0x62, 0xee, 0xff, 0xbe, 0x40, 0x14, 0x00, 0xf6, 0xa3, + 0x09, 0x00, 0x00, 0x00, 0x0e, 0x00, + ]; + let baseline_ecef_expectation = ::messages::navigation::MsgBaselineECEF { + accuracy: 0, + flags: 0, + n_sats: 14, + tow: 326825000, + x: -1154410, + y: 1327294, + z: 631798, + }; + let sbp_result = ::messages::SBP::parse(0x20b, &mut &baseline_ecef_payload[..]); + assert!(sbp_result.is_ok()); + if let ::messages::SBP::MsgBaselineECEF(msg) = sbp_result.unwrap() { + assert_eq!(msg.accuracy, baseline_ecef_expectation.accuracy); + assert_eq!(msg.flags, baseline_ecef_expectation.flags); + assert_eq!(msg.n_sats, baseline_ecef_expectation.n_sats); + assert_eq!(msg.tow, baseline_ecef_expectation.tow); + assert_eq!(msg.x, baseline_ecef_expectation.x); + assert_eq!(msg.y, baseline_ecef_expectation.y); + assert_eq!(msg.z, baseline_ecef_expectation.z); + } else { + assert!(false); + } } - Ok(v) -} -fn read_double_array_limit(buf: &mut &[u8], n:usize) -> Result, Error> { - let mut v = Vec::new(); - for _ in 0..n { - v.push(buf.read_f64::()?); + #[test] + fn frame() { + let packet = [ + 0x55u8, 0x0b, 0x02, 0xd3, 0x88, 0x14, 0x28, 0xf4, 0x7a, 0x13, 0x96, 0x62, 0xee, 0xff, + 0xbe, 0x40, 0x14, 0x00, 0xf6, 0xa3, 0x09, 0x00, 0x00, 0x00, 0x0e, 0x00, 0xdb, 0xbf, + ]; + let baseline_ecef_expectation = ::messages::navigation::MsgBaselineECEF { + accuracy: 0, + flags: 0, + n_sats: 14, + tow: 326825000, + x: -1154410, + y: 1327294, + z: 631798, + }; + let (sbp_result, _remaining_data) = ::parser::frame(&packet[..]); + assert!(sbp_result.is_ok()); + if let ::messages::SBP::MsgBaselineECEF(msg) = sbp_result.unwrap() { + assert_eq!(msg.accuracy, baseline_ecef_expectation.accuracy); + assert_eq!(msg.flags, baseline_ecef_expectation.flags); + assert_eq!(msg.n_sats, baseline_ecef_expectation.n_sats); + assert_eq!(msg.tow, baseline_ecef_expectation.tow); + assert_eq!(msg.x, baseline_ecef_expectation.x); + assert_eq!(msg.y, baseline_ecef_expectation.y); + assert_eq!(msg.z, baseline_ecef_expectation.z); + } else { + assert!(false); + } } - Ok(v) -} -#[cfg(test)] -mod tests { #[test] - fn it_works() { - assert_eq!(2 + 2, 4); + fn parser() { + let packet = vec![ + 0x00, 0x11, 0x22, 0x55u8, 0x0b, 0x02, 0xd3, 0x88, 0x14, 0x28, 0xf4, 0x7a, 0x13, 0x96, + 0x62, 0xee, 0xff, 0xbe, 0x40, 0x14, 0x00, 0xf6, 0xa3, 0x09, 0x00, 0x00, 0x00, 0x0e, + 0x00, 0xdb, 0xbf, 0xde, 0xad, 0xbe, 0xef, + ]; + let mut reader = std::io::Cursor::new(packet); + let baseline_ecef_expectation = ::messages::navigation::MsgBaselineECEF { + accuracy: 0, + flags: 0, + n_sats: 14, + tow: 326825000, + x: -1154410, + y: 1327294, + z: 631798, + }; + let mut parser = ::parser::Parser::new(); + // Iterate through the data until we hit something that is parsable + let sbp_result = parser.parse(&mut reader); + assert!(sbp_result.is_ok()); + if let ::messages::SBP::MsgBaselineECEF(msg) = sbp_result.unwrap() { + assert_eq!(msg.accuracy, baseline_ecef_expectation.accuracy); + assert_eq!(msg.flags, baseline_ecef_expectation.flags); + assert_eq!(msg.n_sats, baseline_ecef_expectation.n_sats); + assert_eq!(msg.tow, baseline_ecef_expectation.tow); + assert_eq!(msg.x, baseline_ecef_expectation.x); + assert_eq!(msg.y, baseline_ecef_expectation.y); + assert_eq!(msg.z, baseline_ecef_expectation.z); + } else { + assert!(false); + } } } diff --git a/rust/sbp/src/parser/mod.rs b/rust/sbp/src/parser/mod.rs new file mode 100644 index 0000000000..b03347c89b --- /dev/null +++ b/rust/sbp/src/parser/mod.rs @@ -0,0 +1,178 @@ +extern crate byteorder; +extern crate nom; +use self::byteorder::{LittleEndian, ReadBytesExt}; +use self::nom::bytes::complete::is_a; +use self::nom::multi::length_data; +use self::nom::number::complete::{le_u16, le_u8}; +use self::nom::sequence::tuple; +use messages::SBP; +use std::io::{self, Read}; + +pub fn frame(input: &[u8]) -> (Result, usize) { + let original_size = input.len(); + let preamble = is_a("\x55"); + let payload = length_data(le_u8); + + let result = tuple((preamble, le_u16, le_u16, payload, le_u16))(input); + + match result { + Ok((o, (_preamble, msg_type, _sender_id, payload, _crc))) => { + // TODO: Add CRC checking + let bytes_read = original_size - o.len(); + (SBP::parse(msg_type, &mut &payload[..]), bytes_read) + } + // Act like we didn't read anything + Err(self::nom::Err::Incomplete(_)) => (Err(::Error::NotEnoughData), 0), + // Act like we only read a single byte + Err(self::nom::Err::Error((_, _))) => (Err(::Error::ParseError), 1), + // Act like we didn't read anything + Err(self::nom::Err::Failure((_, _))) => (Err(::Error::UnrecoverableFailure), 0), + } +} + +pub struct Parser { + buffer: Vec, +} + +impl Parser { + const BUF_SIZE: usize = 1024usize; + + pub fn new() -> Parser { + Parser { buffer: vec![0; 0] } + } + + pub fn parse(&mut self, input: &mut R) -> Result { + if self.buffer.len() == 0 { + self.read_more(input)?; + } + + let result = loop { + match self.parse_remaining() { + Ok(msg) => break Ok(msg), + Err(::Error::NotEnoughData) => { + if let Err(e) = self.read_more(input) { + break Err(::Error::IoError(e)); + } + } + Err(e) => break Err(e), + }; + }; + + result + } + + fn read_more(&mut self, input: &mut R) -> Result<(), std::io::Error> { + let mut local_buffer = vec![0; Parser::BUF_SIZE]; + match input.read(local_buffer.as_mut()) { + Ok(read_count) => { + self.buffer.extend_from_slice(&local_buffer[..read_count]); + Ok(()) + } + Err(e) => Err(e), + } + } + + fn parse_remaining(&mut self) -> Result { + loop { + let result = frame(&self.buffer); + + match result { + (Ok(msg), bytes_read) => { + let tmp = self.buffer.split_off(bytes_read); + self.buffer = tmp; + break Ok(msg); + } + (Err(::Error::ParseError), bytes_read) => { + let tmp = self.buffer.split_off(bytes_read); + self.buffer = tmp; + } + (Err(e), _bytes_read) => break Err(e), + } + } + } +} + +pub enum MessageError { + ParseError, + IoError(io::Error), +} + +impl From for MessageError { + fn from(error: io::Error) -> Self { + MessageError::IoError(error) + } +} + +impl From for ::Error { + fn from(_: MessageError) -> Self { + ::Error::ParseError + } +} + +impl From for ::Error { + fn from(error: io::Error) -> Self { + ::Error::IoError(error) + } +} + +pub fn read_string(buf: &mut Read) -> Result { + let mut s = String::new(); + buf.read_to_string(&mut s)?; + Ok(s) +} + +pub fn read_string_limit(buf: &mut Read, n: u64) -> Result { + read_string(&mut buf.take(n)) +} + +pub fn read_u8_array(buf: &mut &[u8]) -> Result, MessageError> { + Ok(buf.to_vec()) +} + +pub fn read_u8_array_limit(buf: &mut &[u8], n: usize) -> Result, MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(buf.read_u8()?); + } + Ok(v) +} + +pub fn read_s8_array_limit(buf: &mut &[u8], n: usize) -> Result, MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(buf.read_i8()?); + } + Ok(v) +} + +pub fn read_s16_array_limit(buf: &mut &[u8], n: usize) -> Result, MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(buf.read_i16::()?); + } + Ok(v) +} + +pub fn read_u16_array_limit(buf: &mut &[u8], n: usize) -> Result, MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(buf.read_u16::()?); + } + Ok(v) +} + +pub fn read_float_array_limit(buf: &mut &[u8], n: usize) -> Result, MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(buf.read_f32::()?); + } + Ok(v) +} + +pub fn read_double_array_limit(buf: &mut &[u8], n: usize) -> Result, MessageError> { + let mut v = Vec::new(); + for _ in 0..n { + v.push(buf.read_f64::()?); + } + Ok(v) +} From f698cd81d51d1e2943ec703f2350dcfe08706b42 Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Wed, 17 Jul 2019 16:23:50 -0700 Subject: [PATCH 12/25] Simplified the parser code --- rust/sbp/src/parser/mod.rs | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/rust/sbp/src/parser/mod.rs b/rust/sbp/src/parser/mod.rs index b03347c89b..00092a4f06 100644 --- a/rust/sbp/src/parser/mod.rs +++ b/rust/sbp/src/parser/mod.rs @@ -16,10 +16,21 @@ pub fn frame(input: &[u8]) -> (Result, usize) { let result = tuple((preamble, le_u16, le_u16, payload, le_u16))(input); match result { - Ok((o, (_preamble, msg_type, _sender_id, payload, _crc))) => { - // TODO: Add CRC checking - let bytes_read = original_size - o.len(); - (SBP::parse(msg_type, &mut &payload[..]), bytes_read) + Ok((o, (_preamble, msg_type, sender_id, payload, _crc))) => { + let mut crc = crc16::State::::new(); + crc.update(&msg_type.to_le_bytes()); + crc.update(&sender_id.to_le_bytes()); + crc.update(&[payload.len() as u8]); + crc.update(payload); + if crc.get() == _crc { + let bytes_read = original_size - o.len(); + ( + SBP::parse(msg_type, sender_id, &mut &payload[..]), + bytes_read, + ) + } else { + (Err(::Error::ParseError), 1) + } } // Act like we didn't read anything Err(self::nom::Err::Incomplete(_)) => (Err(::Error::NotEnoughData), 0), @@ -61,15 +72,11 @@ impl Parser { result } - fn read_more(&mut self, input: &mut R) -> Result<(), std::io::Error> { + fn read_more(&mut self, input: &mut R) -> Result { let mut local_buffer = vec![0; Parser::BUF_SIZE]; - match input.read(local_buffer.as_mut()) { - Ok(read_count) => { - self.buffer.extend_from_slice(&local_buffer[..read_count]); - Ok(()) - } - Err(e) => Err(e), - } + let read_bytes = input.read(local_buffer.as_mut())?; + self.buffer.extend_from_slice(&local_buffer[..read_bytes]); + Ok(read_bytes) } fn parse_remaining(&mut self) -> Result { @@ -78,13 +85,11 @@ impl Parser { match result { (Ok(msg), bytes_read) => { - let tmp = self.buffer.split_off(bytes_read); - self.buffer = tmp; + self.buffer = self.buffer[bytes_read..].to_vec(); break Ok(msg); } (Err(::Error::ParseError), bytes_read) => { - let tmp = self.buffer.split_off(bytes_read); - self.buffer = tmp; + self.buffer = self.buffer[bytes_read..].to_vec(); } (Err(e), _bytes_read) => break Err(e), } From b11fd88f293cfec35f006cf85a5a8e95abe34acd Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Wed, 17 Jul 2019 16:25:37 -0700 Subject: [PATCH 13/25] Added sender ID to the messages, and added a basic SBPMessage trait --- .../targets/resources/sbp_messages_mod.rs | 21 ++++++++++++---- .../resources/sbp_messages_template.rs | 24 ++++++++++++++++--- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/generator/sbpg/targets/resources/sbp_messages_mod.rs b/generator/sbpg/targets/resources/sbp_messages_mod.rs index bb1154978e..b0da99a4c9 100644 --- a/generator/sbpg/targets/resources/sbp_messages_mod.rs +++ b/generator/sbpg/targets/resources/sbp_messages_mod.rs @@ -20,21 +20,32 @@ use self::(((p.identifier|mod_name)))::(((m.identifier|camel_case))); ((*- endfor *)) ((*- endfor *)) +trait SBPMessage { + const MSG_ID: u16; + + fn get_sender_id(&self) -> Option; + fn set_sender_id(&mut self, new_id: u16); +} + #[derive(Debug)] pub enum SBP { - Unknown { id: u16 }, + Unknown { msg_id: u16, sender_id: u16, payload: Vec }, ((*- for m in msgs *)) (((m.identifier|camel_case)))( (((m.identifier|camel_case))) ), ((*- endfor *)) } impl SBP { - pub fn parse(id: u16, payload: &mut &[u8]) -> Result { - let x: Result = match id { + pub fn parse(msg_id: u16, sender_id: u16, payload: &mut &[u8]) -> Result { + let x: Result = match msg_id { ((*- for m in msgs *)) - (((m.sbp_id))) => Ok(SBP::(((m.identifier|camel_case)))( (((m.identifier|camel_case)))::parse(payload)? )), + (((m.sbp_id))) => { + let mut msg = (((m.identifier|camel_case)))::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::(((m.identifier|camel_case)))(msg)) + }, ((*- endfor *)) - _ => Ok(SBP::Unknown {id}) + _ => Ok(SBP::Unknown { msg_id: msg_id, sender_id: sender_id, payload: payload.to_vec() }) }; match x { Ok(x) => Ok(x), diff --git a/generator/sbpg/targets/resources/sbp_messages_template.rs b/generator/sbpg/targets/resources/sbp_messages_template.rs index 93d705e2f7..2634ccf421 100644 --- a/generator/sbpg/targets/resources/sbp_messages_template.rs +++ b/generator/sbpg/targets/resources/sbp_messages_template.rs @@ -32,6 +32,9 @@ use super::(((i)))::*; #[derive(Debug)] #[allow(non_snake_case)] pub struct (((m.identifier|camel_case))) { + ((*- if m.sbp_id *)) + pub sender_id: Option, + ((*- endif *)) ((*- for f in m.fields *)) pub (((f.identifier))): (((f|type_map))), ((*- if f.desc *)) @@ -41,16 +44,17 @@ pub struct (((m.identifier|camel_case))) { } impl (((m.identifier|camel_case))) { - ((*- if m.sbp_id *)) - pub const TYPE: u16 = (((m.sbp_id))); - ((*- endif *)) pub fn parse(_buf: &mut &[u8]) -> Result<(((m.identifier|camel_case))), ::parser::MessageError> { Ok( (((m.identifier|camel_case))){ + ((*- if m.sbp_id *)) + sender_id: None, + ((*- endif *)) ((*- for f in m.fields *)) (((f.identifier))): (((f|parse_type)))?, ((*- endfor *)) } ) } + ((*- if not m.sbp_id *)) pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { let mut v = Vec::new(); @@ -70,4 +74,18 @@ impl (((m.identifier|camel_case))) { ((*- endif *)) } +((*- if m.sbp_id *)) +impl super::SBPMessage for (((m.identifier|camel_case))) { + const MSG_ID: u16 = (((m.sbp_id))); + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} +((*- endif *)) + ((* endfor *)) From 81f629aaf8263c510d81ed093e82abf5a528d6a7 Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Wed, 17 Jul 2019 16:25:53 -0700 Subject: [PATCH 14/25] Regnerated messages --- rust/sbp/src/messages/acquisition.rs | 84 +- rust/sbp/src/messages/bootload.rs | 92 +- rust/sbp/src/messages/ext_events.rs | 14 +- rust/sbp/src/messages/file_io.rs | 126 ++- rust/sbp/src/messages/flash.rs | 144 ++- rust/sbp/src/messages/imu.rs | 28 +- rust/sbp/src/messages/linux.rs | 112 ++- rust/sbp/src/messages/logging.rs | 42 +- rust/sbp/src/messages/mag.rs | 14 +- rust/sbp/src/messages/mod.rs | 1385 +++++++++++++++++++------- rust/sbp/src/messages/navigation.rs | 336 ++++++- rust/sbp/src/messages/ndb.rs | 14 +- rust/sbp/src/messages/observation.rs | 532 +++++++++- rust/sbp/src/messages/orientation.rs | 56 +- rust/sbp/src/messages/piksi.rs | 378 ++++++- rust/sbp/src/messages/sbas.rs | 14 +- rust/sbp/src/messages/settings.rs | 148 ++- rust/sbp/src/messages/ssr.rs | 98 +- rust/sbp/src/messages/system.rs | 84 +- rust/sbp/src/messages/tracking.rs | 126 ++- rust/sbp/src/messages/user.rs | 14 +- rust/sbp/src/messages/vehicle.rs | 14 +- 22 files changed, 3271 insertions(+), 584 deletions(-) diff --git a/rust/sbp/src/messages/acquisition.rs b/rust/sbp/src/messages/acquisition.rs index 07c2ae41c8..1c84f47fa2 100644 --- a/rust/sbp/src/messages/acquisition.rs +++ b/rust/sbp/src/messages/acquisition.rs @@ -29,6 +29,7 @@ use super::gnss::*; #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAcqResult { + pub sender_id: Option, pub cn0: f32, // ^ CN/0 of best point pub cp: f32, @@ -40,9 +41,9 @@ pub struct MsgAcqResult { } impl MsgAcqResult { - pub const TYPE: u16 = 47; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAcqResult { + sender_id: None, cn0: _buf.read_f32::()?, cp: _buf.read_f32::()?, cf: _buf.read_f32::()?, @@ -50,6 +51,17 @@ impl MsgAcqResult { }) } } +impl super::SBPMessage for MsgAcqResult { + const MSG_ID: u16 = 47; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -58,6 +70,7 @@ impl MsgAcqResult { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAcqResultDepC { + pub sender_id: Option, pub cn0: f32, // ^ CN/0 of best point pub cp: f32, @@ -69,9 +82,9 @@ pub struct MsgAcqResultDepC { } impl MsgAcqResultDepC { - pub const TYPE: u16 = 31; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAcqResultDepC { + sender_id: None, cn0: _buf.read_f32::()?, cp: _buf.read_f32::()?, cf: _buf.read_f32::()?, @@ -79,6 +92,17 @@ impl MsgAcqResultDepC { }) } } +impl super::SBPMessage for MsgAcqResultDepC { + const MSG_ID: u16 = 31; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -87,6 +111,7 @@ impl MsgAcqResultDepC { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAcqResultDepB { + pub sender_id: Option, pub snr: f32, // ^ SNR of best point. Currently in arbitrary SNR points, but will be in // units of dB Hz in a later revision of this message. @@ -99,9 +124,9 @@ pub struct MsgAcqResultDepB { } impl MsgAcqResultDepB { - pub const TYPE: u16 = 20; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAcqResultDepB { + sender_id: None, snr: _buf.read_f32::()?, cp: _buf.read_f32::()?, cf: _buf.read_f32::()?, @@ -109,6 +134,17 @@ impl MsgAcqResultDepB { }) } } +impl super::SBPMessage for MsgAcqResultDepB { + const MSG_ID: u16 = 20; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -117,6 +153,7 @@ impl MsgAcqResultDepB { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAcqResultDepA { + pub sender_id: Option, pub snr: f32, // ^ SNR of best point. Currently dimensonless, but will have units of dB Hz // in the revision of this message. @@ -130,9 +167,9 @@ pub struct MsgAcqResultDepA { } impl MsgAcqResultDepA { - pub const TYPE: u16 = 21; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAcqResultDepA { + sender_id: None, snr: _buf.read_f32::()?, cp: _buf.read_f32::()?, cf: _buf.read_f32::()?, @@ -140,6 +177,17 @@ impl MsgAcqResultDepA { }) } } +impl super::SBPMessage for MsgAcqResultDepA { + const MSG_ID: u16 = 21; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Acq perfomance measurement and debug // @@ -291,18 +339,30 @@ impl AcqSvProfileDep { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAcqSvProfile { + pub sender_id: Option, pub acq_sv_profile: Vec, // ^ SV profiles during acquisition time } impl MsgAcqSvProfile { - pub const TYPE: u16 = 46; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAcqSvProfile { + sender_id: None, acq_sv_profile: AcqSvProfile::parse_array(_buf)?, }) } } +impl super::SBPMessage for MsgAcqSvProfile { + const MSG_ID: u16 = 46; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated. // @@ -311,15 +371,27 @@ impl MsgAcqSvProfile { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAcqSvProfileDep { + pub sender_id: Option, pub acq_sv_profile: Vec, // ^ SV profiles during acquisition time } impl MsgAcqSvProfileDep { - pub const TYPE: u16 = 30; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAcqSvProfileDep { + sender_id: None, acq_sv_profile: AcqSvProfileDep::parse_array(_buf)?, }) } } +impl super::SBPMessage for MsgAcqSvProfileDep { + const MSG_ID: u16 = 30; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/bootload.rs b/rust/sbp/src/messages/bootload.rs index 47c21f579c..0f5fb8aa63 100644 --- a/rust/sbp/src/messages/bootload.rs +++ b/rust/sbp/src/messages/bootload.rs @@ -29,12 +29,24 @@ use self::byteorder::{LittleEndian, ReadBytesExt}; // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgBootloaderHandshakeReq {} +pub struct MsgBootloaderHandshakeReq { + pub sender_id: Option, +} impl MsgBootloaderHandshakeReq { - pub const TYPE: u16 = 179; pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgBootloaderHandshakeReq {}) + Ok(MsgBootloaderHandshakeReq { sender_id: None }) + } +} +impl super::SBPMessage for MsgBootloaderHandshakeReq { + const MSG_ID: u16 = 179; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); } } @@ -49,6 +61,7 @@ impl MsgBootloaderHandshakeReq { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBootloaderHandshakeResp { + pub sender_id: Option, pub flags: u32, // ^ Bootloader flags pub version: String, @@ -56,14 +69,25 @@ pub struct MsgBootloaderHandshakeResp { } impl MsgBootloaderHandshakeResp { - pub const TYPE: u16 = 180; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBootloaderHandshakeResp { + sender_id: None, flags: _buf.read_u32::()?, version: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgBootloaderHandshakeResp { + const MSG_ID: u16 = 180; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Bootloader jump to application (host => device) // @@ -72,18 +96,30 @@ impl MsgBootloaderHandshakeResp { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBootloaderJumpToApp { + pub sender_id: Option, pub jump: u8, // ^ Ignored by the device } impl MsgBootloaderJumpToApp { - pub const TYPE: u16 = 177; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBootloaderJumpToApp { + sender_id: None, jump: _buf.read_u8()?, }) } } +impl super::SBPMessage for MsgBootloaderJumpToApp { + const MSG_ID: u16 = 177; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Read FPGA device ID over UART request (host => device) // @@ -96,12 +132,24 @@ impl MsgBootloaderJumpToApp { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgNapDeviceDnaReq {} +pub struct MsgNapDeviceDnaReq { + pub sender_id: Option, +} impl MsgNapDeviceDnaReq { - pub const TYPE: u16 = 222; pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgNapDeviceDnaReq {}) + Ok(MsgNapDeviceDnaReq { sender_id: None }) + } +} +impl super::SBPMessage for MsgNapDeviceDnaReq { + const MSG_ID: u16 = 222; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); } } @@ -117,18 +165,30 @@ impl MsgNapDeviceDnaReq { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgNapDeviceDnaResp { + pub sender_id: Option, pub dna: Vec, // ^ 57-bit SwiftNAP FPGA Device ID. Remaining bits are padded on the right. } impl MsgNapDeviceDnaResp { - pub const TYPE: u16 = 221; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgNapDeviceDnaResp { + sender_id: None, dna: ::parser::read_u8_array_limit(_buf, 8)?, }) } } +impl super::SBPMessage for MsgNapDeviceDnaResp { + const MSG_ID: u16 = 221; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -137,15 +197,27 @@ impl MsgNapDeviceDnaResp { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBootloaderHandshakeDepA { + pub sender_id: Option, pub handshake: Vec, // ^ Version number string (not NULL terminated) } impl MsgBootloaderHandshakeDepA { - pub const TYPE: u16 = 176; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBootloaderHandshakeDepA { + sender_id: None, handshake: ::parser::read_u8_array(_buf)?, }) } } +impl super::SBPMessage for MsgBootloaderHandshakeDepA { + const MSG_ID: u16 = 176; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/ext_events.rs b/rust/sbp/src/messages/ext_events.rs index ac65ea8d9d..bb5a002ec0 100644 --- a/rust/sbp/src/messages/ext_events.rs +++ b/rust/sbp/src/messages/ext_events.rs @@ -26,6 +26,7 @@ use self::byteorder::{LittleEndian, ReadBytesExt}; #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgExtEvent { + pub sender_id: Option, pub wn: u16, // ^ GPS week number pub tow: u32, @@ -40,9 +41,9 @@ pub struct MsgExtEvent { } impl MsgExtEvent { - pub const TYPE: u16 = 257; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgExtEvent { + sender_id: None, wn: _buf.read_u16::()?, tow: _buf.read_u32::()?, ns_residual: _buf.read_i32::()?, @@ -51,3 +52,14 @@ impl MsgExtEvent { }) } } +impl super::SBPMessage for MsgExtEvent { + const MSG_ID: u16 = 257; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/file_io.rs b/rust/sbp/src/messages/file_io.rs index 6937815731..d064c4cde7 100644 --- a/rust/sbp/src/messages/file_io.rs +++ b/rust/sbp/src/messages/file_io.rs @@ -38,6 +38,7 @@ use self::byteorder::{LittleEndian, ReadBytesExt}; #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioReadReq { + pub sender_id: Option, pub sequence: u32, // ^ Read sequence number pub offset: u32, @@ -49,9 +50,9 @@ pub struct MsgFileioReadReq { } impl MsgFileioReadReq { - pub const TYPE: u16 = 168; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioReadReq { + sender_id: None, sequence: _buf.read_u32::()?, offset: _buf.read_u32::()?, chunk_size: _buf.read_u8()?, @@ -59,6 +60,17 @@ impl MsgFileioReadReq { }) } } +impl super::SBPMessage for MsgFileioReadReq { + const MSG_ID: u16 = 168; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // File read from the file system (host <= device) // @@ -71,6 +83,7 @@ impl MsgFileioReadReq { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioReadResp { + pub sender_id: Option, pub sequence: u32, // ^ Read sequence number pub contents: Vec, @@ -78,14 +91,25 @@ pub struct MsgFileioReadResp { } impl MsgFileioReadResp { - pub const TYPE: u16 = 163; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioReadResp { + sender_id: None, sequence: _buf.read_u32::()?, contents: ::parser::read_u8_array(_buf)?, }) } } +impl super::SBPMessage for MsgFileioReadResp { + const MSG_ID: u16 = 163; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // List files in a directory (host => device) // @@ -103,6 +127,7 @@ impl MsgFileioReadResp { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioReadDirReq { + pub sender_id: Option, pub sequence: u32, // ^ Read sequence number pub offset: u32, @@ -112,15 +137,26 @@ pub struct MsgFileioReadDirReq { } impl MsgFileioReadDirReq { - pub const TYPE: u16 = 169; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioReadDirReq { + sender_id: None, sequence: _buf.read_u32::()?, offset: _buf.read_u32::()?, dirname: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgFileioReadDirReq { + const MSG_ID: u16 = 169; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Files listed in a directory (host <= device) // @@ -134,6 +170,7 @@ impl MsgFileioReadDirReq { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioReadDirResp { + pub sender_id: Option, pub sequence: u32, // ^ Read sequence number pub contents: Vec, @@ -141,14 +178,25 @@ pub struct MsgFileioReadDirResp { } impl MsgFileioReadDirResp { - pub const TYPE: u16 = 170; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioReadDirResp { + sender_id: None, sequence: _buf.read_u32::()?, contents: ::parser::read_u8_array(_buf)?, }) } } +impl super::SBPMessage for MsgFileioReadDirResp { + const MSG_ID: u16 = 170; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Delete a file from the file system (host => device) // @@ -160,18 +208,30 @@ impl MsgFileioReadDirResp { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioRemove { + pub sender_id: Option, pub filename: String, // ^ Name of the file to delete } impl MsgFileioRemove { - pub const TYPE: u16 = 172; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioRemove { + sender_id: None, filename: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgFileioRemove { + const MSG_ID: u16 = 172; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Write to file (host => device) // @@ -187,6 +247,7 @@ impl MsgFileioRemove { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioWriteReq { + pub sender_id: Option, pub sequence: u32, // ^ Write sequence number pub offset: u32, @@ -198,9 +259,9 @@ pub struct MsgFileioWriteReq { } impl MsgFileioWriteReq { - pub const TYPE: u16 = 173; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioWriteReq { + sender_id: None, sequence: _buf.read_u32::()?, offset: _buf.read_u32::()?, filename: ::parser::read_string(_buf)?, @@ -208,6 +269,17 @@ impl MsgFileioWriteReq { }) } } +impl super::SBPMessage for MsgFileioWriteReq { + const MSG_ID: u16 = 173; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // File written to (host <= device) // @@ -220,18 +292,30 @@ impl MsgFileioWriteReq { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioWriteResp { + pub sender_id: Option, pub sequence: u32, // ^ Write sequence number } impl MsgFileioWriteResp { - pub const TYPE: u16 = 171; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioWriteResp { + sender_id: None, sequence: _buf.read_u32::()?, }) } } +impl super::SBPMessage for MsgFileioWriteResp { + const MSG_ID: u16 = 171; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Request advice on the optimal configuration for FileIO. // @@ -243,18 +327,30 @@ impl MsgFileioWriteResp { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioConfigReq { + pub sender_id: Option, pub sequence: u32, // ^ Advice sequence number } impl MsgFileioConfigReq { - pub const TYPE: u16 = 4097; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioConfigReq { + sender_id: None, sequence: _buf.read_u32::()?, }) } } +impl super::SBPMessage for MsgFileioConfigReq { + const MSG_ID: u16 = 4097; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Response with advice on the optimal configuration for FileIO. @@ -267,6 +363,7 @@ impl MsgFileioConfigReq { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioConfigResp { + pub sender_id: Option, pub sequence: u32, // ^ Advice sequence number pub window_size: u32, @@ -278,9 +375,9 @@ pub struct MsgFileioConfigResp { } impl MsgFileioConfigResp { - pub const TYPE: u16 = 4098; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioConfigResp { + sender_id: None, sequence: _buf.read_u32::()?, window_size: _buf.read_u32::()?, batch_size: _buf.read_u32::()?, @@ -288,3 +385,14 @@ impl MsgFileioConfigResp { }) } } +impl super::SBPMessage for MsgFileioConfigResp { + const MSG_ID: u16 = 4098; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/flash.rs b/rust/sbp/src/messages/flash.rs index dd62bcd374..167116e806 100644 --- a/rust/sbp/src/messages/flash.rs +++ b/rust/sbp/src/messages/flash.rs @@ -33,6 +33,7 @@ use self::byteorder::{LittleEndian, ReadBytesExt}; #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFlashProgram { + pub sender_id: Option, pub target: u8, // ^ Target flags pub addr_start: Vec, @@ -44,9 +45,9 @@ pub struct MsgFlashProgram { } impl MsgFlashProgram { - pub const TYPE: u16 = 230; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFlashProgram { + sender_id: None, target: _buf.read_u8()?, addr_start: ::parser::read_u8_array_limit(_buf, 3)?, addr_len: _buf.read_u8()?, @@ -54,6 +55,17 @@ impl MsgFlashProgram { }) } } +impl super::SBPMessage for MsgFlashProgram { + const MSG_ID: u16 = 230; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Flash response message (host <= device). // @@ -65,18 +77,30 @@ impl MsgFlashProgram { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFlashDone { + pub sender_id: Option, pub response: u8, // ^ Response flags } impl MsgFlashDone { - pub const TYPE: u16 = 224; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFlashDone { + sender_id: None, response: _buf.read_u8()?, }) } } +impl super::SBPMessage for MsgFlashDone { + const MSG_ID: u16 = 224; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Read STM or M25 flash address request (host => device). // @@ -91,6 +115,7 @@ impl MsgFlashDone { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFlashReadReq { + pub sender_id: Option, pub target: u8, // ^ Target flags pub addr_start: Vec, @@ -100,15 +125,26 @@ pub struct MsgFlashReadReq { } impl MsgFlashReadReq { - pub const TYPE: u16 = 231; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFlashReadReq { + sender_id: None, target: _buf.read_u8()?, addr_start: ::parser::read_u8_array_limit(_buf, 3)?, addr_len: _buf.read_u8()?, }) } } +impl super::SBPMessage for MsgFlashReadReq { + const MSG_ID: u16 = 231; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Read STM or M25 flash address response (host <= device). // @@ -123,6 +159,7 @@ impl MsgFlashReadReq { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFlashReadResp { + pub sender_id: Option, pub target: u8, // ^ Target flags pub addr_start: Vec, @@ -132,15 +169,26 @@ pub struct MsgFlashReadResp { } impl MsgFlashReadResp { - pub const TYPE: u16 = 225; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFlashReadResp { + sender_id: None, target: _buf.read_u8()?, addr_start: ::parser::read_u8_array_limit(_buf, 3)?, addr_len: _buf.read_u8()?, }) } } +impl super::SBPMessage for MsgFlashReadResp { + const MSG_ID: u16 = 225; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Erase sector of device flash memory (host => device). // @@ -153,6 +201,7 @@ impl MsgFlashReadResp { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFlashErase { + pub sender_id: Option, pub target: u8, // ^ Target flags pub sector_num: u32, @@ -160,14 +209,25 @@ pub struct MsgFlashErase { } impl MsgFlashErase { - pub const TYPE: u16 = 226; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFlashErase { + sender_id: None, target: _buf.read_u8()?, sector_num: _buf.read_u32::()?, }) } } +impl super::SBPMessage for MsgFlashErase { + const MSG_ID: u16 = 226; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Lock sector of STM flash memory (host => device) // @@ -177,18 +237,30 @@ impl MsgFlashErase { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgStmFlashLockSector { + pub sender_id: Option, pub sector: u32, // ^ Flash sector number to lock } impl MsgStmFlashLockSector { - pub const TYPE: u16 = 227; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgStmFlashLockSector { + sender_id: None, sector: _buf.read_u32::()?, }) } } +impl super::SBPMessage for MsgStmFlashLockSector { + const MSG_ID: u16 = 227; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Unlock sector of STM flash memory (host => device) // @@ -198,18 +270,30 @@ impl MsgStmFlashLockSector { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgStmFlashUnlockSector { + pub sender_id: Option, pub sector: u32, // ^ Flash sector number to unlock } impl MsgStmFlashUnlockSector { - pub const TYPE: u16 = 228; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgStmFlashUnlockSector { + sender_id: None, sector: _buf.read_u32::()?, }) } } +impl super::SBPMessage for MsgStmFlashUnlockSector { + const MSG_ID: u16 = 228; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Read device's hardcoded unique ID request (host => device) @@ -221,12 +305,24 @@ impl MsgStmFlashUnlockSector { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgStmUniqueIdReq {} +pub struct MsgStmUniqueIdReq { + pub sender_id: Option, +} impl MsgStmUniqueIdReq { - pub const TYPE: u16 = 232; pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgStmUniqueIdReq {}) + Ok(MsgStmUniqueIdReq { sender_id: None }) + } +} +impl super::SBPMessage for MsgStmUniqueIdReq { + const MSG_ID: u16 = 232; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); } } @@ -241,18 +337,30 @@ impl MsgStmUniqueIdReq { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgStmUniqueIdResp { + pub sender_id: Option, pub stm_id: Vec, // ^ Device unique ID } impl MsgStmUniqueIdResp { - pub const TYPE: u16 = 229; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgStmUniqueIdResp { + sender_id: None, stm_id: ::parser::read_u8_array_limit(_buf, 12)?, }) } } +impl super::SBPMessage for MsgStmUniqueIdResp { + const MSG_ID: u16 = 229; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Write M25 flash status register (host => device) // @@ -262,15 +370,27 @@ impl MsgStmUniqueIdResp { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgM25FlashWriteStatus { + pub sender_id: Option, pub status: Vec, // ^ Byte to write to the M25 flash status register } impl MsgM25FlashWriteStatus { - pub const TYPE: u16 = 243; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgM25FlashWriteStatus { + sender_id: None, status: ::parser::read_u8_array_limit(_buf, 1)?, }) } } +impl super::SBPMessage for MsgM25FlashWriteStatus { + const MSG_ID: u16 = 243; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/imu.rs b/rust/sbp/src/messages/imu.rs index 78be1a17ac..60d39e1d43 100644 --- a/rust/sbp/src/messages/imu.rs +++ b/rust/sbp/src/messages/imu.rs @@ -27,6 +27,7 @@ use self::byteorder::{LittleEndian, ReadBytesExt}; #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgImuRaw { + pub sender_id: Option, pub tow: u32, // ^ Milliseconds since start of GPS week. If the high bit is set, the time // is unknown or invalid. @@ -47,9 +48,9 @@ pub struct MsgImuRaw { } impl MsgImuRaw { - pub const TYPE: u16 = 2304; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgImuRaw { + sender_id: None, tow: _buf.read_u32::()?, tow_f: _buf.read_u8()?, acc_x: _buf.read_i16::()?, @@ -61,6 +62,17 @@ impl MsgImuRaw { }) } } +impl super::SBPMessage for MsgImuRaw { + const MSG_ID: u16 = 2304; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Auxiliary IMU data // @@ -71,6 +83,7 @@ impl MsgImuRaw { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgImuAux { + pub sender_id: Option, pub imu_type: u8, // ^ IMU type pub temp: i16, @@ -80,12 +93,23 @@ pub struct MsgImuAux { } impl MsgImuAux { - pub const TYPE: u16 = 2305; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgImuAux { + sender_id: None, imu_type: _buf.read_u8()?, temp: _buf.read_i16::()?, imu_conf: _buf.read_u8()?, }) } } +impl super::SBPMessage for MsgImuAux { + const MSG_ID: u16 = 2305; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/linux.rs b/rust/sbp/src/messages/linux.rs index 605b34d7ec..e719513b03 100644 --- a/rust/sbp/src/messages/linux.rs +++ b/rust/sbp/src/messages/linux.rs @@ -25,6 +25,7 @@ use self::byteorder::{LittleEndian, ReadBytesExt}; #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLinuxCpuState { + pub sender_id: Option, pub index: u8, // ^ sequence of this status message, values from 0-9 pub pid: u16, @@ -38,9 +39,9 @@ pub struct MsgLinuxCpuState { } impl MsgLinuxCpuState { - pub const TYPE: u16 = 32512; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLinuxCpuState { + sender_id: None, index: _buf.read_u8()?, pid: _buf.read_u16::()?, pcpu: _buf.read_u8()?, @@ -49,6 +50,17 @@ impl MsgLinuxCpuState { }) } } +impl super::SBPMessage for MsgLinuxCpuState { + const MSG_ID: u16 = 32512; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // List CPU state on the system // @@ -58,6 +70,7 @@ impl MsgLinuxCpuState { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLinuxMemState { + pub sender_id: Option, pub index: u8, // ^ sequence of this status message, values from 0-9 pub pid: u16, @@ -71,9 +84,9 @@ pub struct MsgLinuxMemState { } impl MsgLinuxMemState { - pub const TYPE: u16 = 32513; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLinuxMemState { + sender_id: None, index: _buf.read_u8()?, pid: _buf.read_u16::()?, pmem: _buf.read_u8()?, @@ -82,6 +95,17 @@ impl MsgLinuxMemState { }) } } +impl super::SBPMessage for MsgLinuxMemState { + const MSG_ID: u16 = 32513; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // CPU, Memory and Process Starts/Stops // @@ -90,6 +114,7 @@ impl MsgLinuxMemState { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLinuxSysState { + pub sender_id: Option, pub mem_total: u16, // ^ total system memory pub pcpu: u8, @@ -105,9 +130,9 @@ pub struct MsgLinuxSysState { } impl MsgLinuxSysState { - pub const TYPE: u16 = 32514; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLinuxSysState { + sender_id: None, mem_total: _buf.read_u16::()?, pcpu: _buf.read_u8()?, pmem: _buf.read_u8()?, @@ -117,6 +142,17 @@ impl MsgLinuxSysState { }) } } +impl super::SBPMessage for MsgLinuxSysState { + const MSG_ID: u16 = 32514; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // A list of processes with high socket counts // @@ -125,6 +161,7 @@ impl MsgLinuxSysState { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLinuxProcessSocketCounts { + pub sender_id: Option, pub index: u8, // ^ sequence of this status message, values from 0-9 pub pid: u16, @@ -144,9 +181,9 @@ pub struct MsgLinuxProcessSocketCounts { } impl MsgLinuxProcessSocketCounts { - pub const TYPE: u16 = 32515; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLinuxProcessSocketCounts { + sender_id: None, index: _buf.read_u8()?, pid: _buf.read_u16::()?, socket_count: _buf.read_u16::()?, @@ -156,6 +193,17 @@ impl MsgLinuxProcessSocketCounts { }) } } +impl super::SBPMessage for MsgLinuxProcessSocketCounts { + const MSG_ID: u16 = 32515; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // A list of processes with deep socket queues // @@ -164,6 +212,7 @@ impl MsgLinuxProcessSocketCounts { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLinuxProcessSocketQueues { + pub sender_id: Option, pub index: u8, // ^ sequence of this status message, values from 0-9 pub pid: u16, @@ -188,9 +237,9 @@ pub struct MsgLinuxProcessSocketQueues { } impl MsgLinuxProcessSocketQueues { - pub const TYPE: u16 = 32516; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLinuxProcessSocketQueues { + sender_id: None, index: _buf.read_u8()?, pid: _buf.read_u16::()?, recv_queued: _buf.read_u16::()?, @@ -202,6 +251,17 @@ impl MsgLinuxProcessSocketQueues { }) } } +impl super::SBPMessage for MsgLinuxProcessSocketQueues { + const MSG_ID: u16 = 32516; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Summary of socket usage across the system // @@ -210,6 +270,7 @@ impl MsgLinuxProcessSocketQueues { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLinuxSocketUsage { + pub sender_id: Option, pub avg_queue_depth: u32, // ^ average socket queue depths across all sockets on the system pub max_queue_depth: u32, @@ -225,9 +286,9 @@ pub struct MsgLinuxSocketUsage { } impl MsgLinuxSocketUsage { - pub const TYPE: u16 = 32517; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLinuxSocketUsage { + sender_id: None, avg_queue_depth: _buf.read_u32::()?, max_queue_depth: _buf.read_u32::()?, socket_state_counts: ::parser::read_u16_array_limit(_buf, 16)?, @@ -235,6 +296,17 @@ impl MsgLinuxSocketUsage { }) } } +impl super::SBPMessage for MsgLinuxSocketUsage { + const MSG_ID: u16 = 32517; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Summary of processes with large amounts of open file descriptors // @@ -243,6 +315,7 @@ impl MsgLinuxSocketUsage { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLinuxProcessFdCount { + pub sender_id: Option, pub index: u8, // ^ sequence of this status message, values from 0-9 pub pid: u16, @@ -254,9 +327,9 @@ pub struct MsgLinuxProcessFdCount { } impl MsgLinuxProcessFdCount { - pub const TYPE: u16 = 32518; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLinuxProcessFdCount { + sender_id: None, index: _buf.read_u8()?, pid: _buf.read_u16::()?, fd_count: _buf.read_u16::()?, @@ -264,6 +337,17 @@ impl MsgLinuxProcessFdCount { }) } } +impl super::SBPMessage for MsgLinuxProcessFdCount { + const MSG_ID: u16 = 32518; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Summary of open file descriptors on the system // @@ -272,6 +356,7 @@ impl MsgLinuxProcessFdCount { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLinuxProcessFdSummary { + pub sender_id: Option, pub sys_fd_count: u32, // ^ count of total FDs open on the system pub most_opened: String, @@ -283,11 +368,22 @@ pub struct MsgLinuxProcessFdSummary { } impl MsgLinuxProcessFdSummary { - pub const TYPE: u16 = 32519; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLinuxProcessFdSummary { + sender_id: None, sys_fd_count: _buf.read_u32::()?, most_opened: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgLinuxProcessFdSummary { + const MSG_ID: u16 = 32519; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/logging.rs b/rust/sbp/src/messages/logging.rs index 34dd32f057..fd940ef89b 100644 --- a/rust/sbp/src/messages/logging.rs +++ b/rust/sbp/src/messages/logging.rs @@ -26,6 +26,7 @@ use self::byteorder::{LittleEndian, ReadBytesExt}; #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLog { + pub sender_id: Option, pub level: u8, // ^ Logging level pub text: String, @@ -33,14 +34,25 @@ pub struct MsgLog { } impl MsgLog { - pub const TYPE: u16 = 1025; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLog { + sender_id: None, level: _buf.read_u8()?, text: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgLog { + const MSG_ID: u16 = 1025; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Wrapper for FWD a separate stream of information over SBP // @@ -55,6 +67,7 @@ impl MsgLog { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFwd { + pub sender_id: Option, pub source: u8, // ^ source identifier pub protocol: u8, @@ -64,15 +77,26 @@ pub struct MsgFwd { } impl MsgFwd { - pub const TYPE: u16 = 1026; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFwd { + sender_id: None, source: _buf.read_u8()?, protocol: _buf.read_u8()?, fwd_payload: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgFwd { + const MSG_ID: u16 = 1026; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -81,15 +105,27 @@ impl MsgFwd { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgPrintDep { + pub sender_id: Option, pub text: String, // ^ Human-readable string } impl MsgPrintDep { - pub const TYPE: u16 = 16; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgPrintDep { + sender_id: None, text: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgPrintDep { + const MSG_ID: u16 = 16; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/mag.rs b/rust/sbp/src/messages/mag.rs index 74965bfdef..106132eff7 100644 --- a/rust/sbp/src/messages/mag.rs +++ b/rust/sbp/src/messages/mag.rs @@ -24,6 +24,7 @@ use self::byteorder::{LittleEndian, ReadBytesExt}; #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgMagRaw { + pub sender_id: Option, pub tow: u32, // ^ Milliseconds since start of GPS week. If the high bit is set, the time // is unknown or invalid. @@ -38,9 +39,9 @@ pub struct MsgMagRaw { } impl MsgMagRaw { - pub const TYPE: u16 = 2306; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgMagRaw { + sender_id: None, tow: _buf.read_u32::()?, tow_f: _buf.read_u8()?, mag_x: _buf.read_i16::()?, @@ -49,3 +50,14 @@ impl MsgMagRaw { }) } } +impl super::SBPMessage for MsgMagRaw { + const MSG_ID: u16 = 2306; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/mod.rs b/rust/sbp/src/messages/mod.rs index 11fbca7e5b..da2267af7d 100644 --- a/rust/sbp/src/messages/mod.rs +++ b/rust/sbp/src/messages/mod.rs @@ -203,110 +203,20 @@ use self::tracking::MsgTrackingStateDetailedDepA; use self::user::MsgUserData; use self::vehicle::MsgOdometry; +trait SBPMessage { + const MSG_ID: u16; + + fn get_sender_id(&self) -> Option; + fn set_sender_id(&mut self, new_id: u16); +} + #[derive(Debug)] pub enum SBP { - Unknown { id: u16 }, - MsgSsrOrbitClock(MsgSsrOrbitClock), - MsgSsrOrbitClockDepA(MsgSsrOrbitClockDepA), - MsgSsrCodeBiases(MsgSsrCodeBiases), - MsgSsrPhaseBiases(MsgSsrPhaseBiases), - MsgSsrStecCorrection(MsgSsrStecCorrection), - MsgSsrGriddedCorrection(MsgSsrGriddedCorrection), - MsgSsrGridDefinition(MsgSsrGridDefinition), - MsgNdbEvent(MsgNdbEvent), - MsgImuRaw(MsgImuRaw), - MsgImuAux(MsgImuAux), - MsgUserData(MsgUserData), - MsgOdometry(MsgOdometry), - MsgSbasRaw(MsgSbasRaw), - MsgAcqResult(MsgAcqResult), - MsgAcqResultDepC(MsgAcqResultDepC), - MsgAcqResultDepB(MsgAcqResultDepB), - MsgAcqResultDepA(MsgAcqResultDepA), - MsgAcqSvProfile(MsgAcqSvProfile), - MsgAcqSvProfileDep(MsgAcqSvProfileDep), - MsgSettingsSave(MsgSettingsSave), - MsgSettingsWrite(MsgSettingsWrite), - MsgSettingsWriteResp(MsgSettingsWriteResp), - MsgSettingsReadReq(MsgSettingsReadReq), - MsgSettingsReadResp(MsgSettingsReadResp), - MsgSettingsReadByIndexReq(MsgSettingsReadByIndexReq), - MsgSettingsReadByIndexResp(MsgSettingsReadByIndexResp), - MsgSettingsReadByIndexDone(MsgSettingsReadByIndexDone), - MsgSettingsRegister(MsgSettingsRegister), - MsgSettingsRegisterResp(MsgSettingsRegisterResp), - MsgFileioReadReq(MsgFileioReadReq), - MsgFileioReadResp(MsgFileioReadResp), - MsgFileioReadDirReq(MsgFileioReadDirReq), - MsgFileioReadDirResp(MsgFileioReadDirResp), - MsgFileioRemove(MsgFileioRemove), - MsgFileioWriteReq(MsgFileioWriteReq), - MsgFileioWriteResp(MsgFileioWriteResp), - MsgFileioConfigReq(MsgFileioConfigReq), - MsgFileioConfigResp(MsgFileioConfigResp), - MsgStartup(MsgStartup), - MsgDgnssStatus(MsgDgnssStatus), - MsgHeartbeat(MsgHeartbeat), - MsgInsStatus(MsgInsStatus), - MsgCsacTelemetry(MsgCsacTelemetry), - MsgCsacTelemetryLabels(MsgCsacTelemetryLabels), - MsgLinuxCpuState(MsgLinuxCpuState), - MsgLinuxMemState(MsgLinuxMemState), - MsgLinuxSysState(MsgLinuxSysState), - MsgLinuxProcessSocketCounts(MsgLinuxProcessSocketCounts), - MsgLinuxProcessSocketQueues(MsgLinuxProcessSocketQueues), - MsgLinuxSocketUsage(MsgLinuxSocketUsage), - MsgLinuxProcessFdCount(MsgLinuxProcessFdCount), - MsgLinuxProcessFdSummary(MsgLinuxProcessFdSummary), - MsgExtEvent(MsgExtEvent), - MsgObs(MsgObs), - MsgBasePosLLH(MsgBasePosLLH), - MsgBasePosECEF(MsgBasePosECEF), - MsgEphemerisGPSDepE(MsgEphemerisGPSDepE), - MsgEphemerisGPSDepF(MsgEphemerisGPSDepF), - MsgEphemerisGPS(MsgEphemerisGPS), - MsgEphemerisQzss(MsgEphemerisQzss), - MsgEphemerisBds(MsgEphemerisBds), - MsgEphemerisGalDepA(MsgEphemerisGalDepA), - MsgEphemerisGal(MsgEphemerisGal), - MsgEphemerisSbasDepA(MsgEphemerisSbasDepA), - MsgEphemerisGloDepA(MsgEphemerisGloDepA), - MsgEphemerisSbasDepB(MsgEphemerisSbasDepB), - MsgEphemerisSbas(MsgEphemerisSbas), - MsgEphemerisGloDepB(MsgEphemerisGloDepB), - MsgEphemerisGloDepC(MsgEphemerisGloDepC), - MsgEphemerisGloDepD(MsgEphemerisGloDepD), - MsgEphemerisGlo(MsgEphemerisGlo), - MsgEphemerisDepD(MsgEphemerisDepD), - MsgEphemerisDepA(MsgEphemerisDepA), - MsgEphemerisDepB(MsgEphemerisDepB), - MsgEphemerisDepC(MsgEphemerisDepC), - MsgObsDepA(MsgObsDepA), - MsgObsDepB(MsgObsDepB), - MsgObsDepC(MsgObsDepC), - MsgIono(MsgIono), - MsgSvConfigurationGPSDep(MsgSvConfigurationGPSDep), - MsgGnssCapb(MsgGnssCapb), - MsgGroupDelayDepA(MsgGroupDelayDepA), - MsgGroupDelayDepB(MsgGroupDelayDepB), - MsgGroupDelay(MsgGroupDelay), - MsgAlmanacGPSDep(MsgAlmanacGPSDep), - MsgAlmanacGPS(MsgAlmanacGPS), - MsgAlmanacGloDep(MsgAlmanacGloDep), - MsgAlmanacGlo(MsgAlmanacGlo), - MsgGloBiases(MsgGloBiases), - MsgSvAzEl(MsgSvAzEl), - MsgOsr(MsgOsr), - MsgFlashProgram(MsgFlashProgram), - MsgFlashDone(MsgFlashDone), - MsgFlashReadReq(MsgFlashReadReq), - MsgFlashReadResp(MsgFlashReadResp), - MsgFlashErase(MsgFlashErase), - MsgStmFlashLockSector(MsgStmFlashLockSector), - MsgStmFlashUnlockSector(MsgStmFlashUnlockSector), - MsgStmUniqueIdReq(MsgStmUniqueIdReq), - MsgStmUniqueIdResp(MsgStmUniqueIdResp), - MsgM25FlashWriteStatus(MsgM25FlashWriteStatus), + Unknown { + msg_id: u16, + sender_id: u16, + payload: Vec, + }, MsgGPSTime(MsgGPSTime), MsgUtcTime(MsgUtcTime), MsgDops(MsgDops), @@ -331,10 +241,6 @@ pub enum SBP { MsgVelECEFDepA(MsgVelECEFDepA), MsgVelNEDDepA(MsgVelNEDDepA), MsgBaselineHeadingDepA(MsgBaselineHeadingDepA), - MsgBaselineHeading(MsgBaselineHeading), - MsgOrientQuat(MsgOrientQuat), - MsgOrientEuler(MsgOrientEuler), - MsgAngularRate(MsgAngularRate), MsgTrackingStateDetailedDepA(MsgTrackingStateDetailedDepA), MsgTrackingStateDetailedDep(MsgTrackingStateDetailedDep), MsgTrackingState(MsgTrackingState), @@ -344,15 +250,29 @@ pub enum SBP { MsgTrackingIqDepA(MsgTrackingIqDepA), MsgTrackingStateDepA(MsgTrackingStateDepA), MsgTrackingStateDepB(MsgTrackingStateDepB), - MsgLog(MsgLog), - MsgFwd(MsgFwd), - MsgPrintDep(MsgPrintDep), - MsgBootloaderHandshakeReq(MsgBootloaderHandshakeReq), - MsgBootloaderHandshakeResp(MsgBootloaderHandshakeResp), - MsgBootloaderJumpToApp(MsgBootloaderJumpToApp), - MsgNapDeviceDnaReq(MsgNapDeviceDnaReq), - MsgNapDeviceDnaResp(MsgNapDeviceDnaResp), - MsgBootloaderHandshakeDepA(MsgBootloaderHandshakeDepA), + MsgSsrOrbitClock(MsgSsrOrbitClock), + MsgSsrOrbitClockDepA(MsgSsrOrbitClockDepA), + MsgSsrCodeBiases(MsgSsrCodeBiases), + MsgSsrPhaseBiases(MsgSsrPhaseBiases), + MsgSsrStecCorrection(MsgSsrStecCorrection), + MsgSsrGriddedCorrection(MsgSsrGriddedCorrection), + MsgSsrGridDefinition(MsgSsrGridDefinition), + MsgBaselineHeading(MsgBaselineHeading), + MsgOrientQuat(MsgOrientQuat), + MsgOrientEuler(MsgOrientEuler), + MsgAngularRate(MsgAngularRate), + MsgStartup(MsgStartup), + MsgDgnssStatus(MsgDgnssStatus), + MsgHeartbeat(MsgHeartbeat), + MsgInsStatus(MsgInsStatus), + MsgCsacTelemetry(MsgCsacTelemetry), + MsgCsacTelemetryLabels(MsgCsacTelemetryLabels), + MsgAcqResult(MsgAcqResult), + MsgAcqResultDepC(MsgAcqResultDepC), + MsgAcqResultDepB(MsgAcqResultDepB), + MsgAcqResultDepA(MsgAcqResultDepA), + MsgAcqSvProfile(MsgAcqSvProfile), + MsgAcqSvProfileDep(MsgAcqSvProfileDep), MsgAlmanac(MsgAlmanac), MsgSetTime(MsgSetTime), MsgReset(MsgReset), @@ -378,282 +298,973 @@ pub enum SBP { MsgSpecanDep(MsgSpecanDep), MsgSpecan(MsgSpecan), MsgFrontEndGain(MsgFrontEndGain), + MsgImuRaw(MsgImuRaw), + MsgImuAux(MsgImuAux), + MsgBootloaderHandshakeReq(MsgBootloaderHandshakeReq), + MsgBootloaderHandshakeResp(MsgBootloaderHandshakeResp), + MsgBootloaderJumpToApp(MsgBootloaderJumpToApp), + MsgNapDeviceDnaReq(MsgNapDeviceDnaReq), + MsgNapDeviceDnaResp(MsgNapDeviceDnaResp), + MsgBootloaderHandshakeDepA(MsgBootloaderHandshakeDepA), + MsgFlashProgram(MsgFlashProgram), + MsgFlashDone(MsgFlashDone), + MsgFlashReadReq(MsgFlashReadReq), + MsgFlashReadResp(MsgFlashReadResp), + MsgFlashErase(MsgFlashErase), + MsgStmFlashLockSector(MsgStmFlashLockSector), + MsgStmFlashUnlockSector(MsgStmFlashUnlockSector), + MsgStmUniqueIdReq(MsgStmUniqueIdReq), + MsgStmUniqueIdResp(MsgStmUniqueIdResp), + MsgM25FlashWriteStatus(MsgM25FlashWriteStatus), + MsgLog(MsgLog), + MsgFwd(MsgFwd), + MsgPrintDep(MsgPrintDep), + MsgExtEvent(MsgExtEvent), + MsgSbasRaw(MsgSbasRaw), + MsgUserData(MsgUserData), MsgMagRaw(MsgMagRaw), + MsgNdbEvent(MsgNdbEvent), + MsgLinuxCpuState(MsgLinuxCpuState), + MsgLinuxMemState(MsgLinuxMemState), + MsgLinuxSysState(MsgLinuxSysState), + MsgLinuxProcessSocketCounts(MsgLinuxProcessSocketCounts), + MsgLinuxProcessSocketQueues(MsgLinuxProcessSocketQueues), + MsgLinuxSocketUsage(MsgLinuxSocketUsage), + MsgLinuxProcessFdCount(MsgLinuxProcessFdCount), + MsgLinuxProcessFdSummary(MsgLinuxProcessFdSummary), + MsgObs(MsgObs), + MsgBasePosLLH(MsgBasePosLLH), + MsgBasePosECEF(MsgBasePosECEF), + MsgEphemerisGPSDepE(MsgEphemerisGPSDepE), + MsgEphemerisGPSDepF(MsgEphemerisGPSDepF), + MsgEphemerisGPS(MsgEphemerisGPS), + MsgEphemerisQzss(MsgEphemerisQzss), + MsgEphemerisBds(MsgEphemerisBds), + MsgEphemerisGalDepA(MsgEphemerisGalDepA), + MsgEphemerisGal(MsgEphemerisGal), + MsgEphemerisSbasDepA(MsgEphemerisSbasDepA), + MsgEphemerisGloDepA(MsgEphemerisGloDepA), + MsgEphemerisSbasDepB(MsgEphemerisSbasDepB), + MsgEphemerisSbas(MsgEphemerisSbas), + MsgEphemerisGloDepB(MsgEphemerisGloDepB), + MsgEphemerisGloDepC(MsgEphemerisGloDepC), + MsgEphemerisGloDepD(MsgEphemerisGloDepD), + MsgEphemerisGlo(MsgEphemerisGlo), + MsgEphemerisDepD(MsgEphemerisDepD), + MsgEphemerisDepA(MsgEphemerisDepA), + MsgEphemerisDepB(MsgEphemerisDepB), + MsgEphemerisDepC(MsgEphemerisDepC), + MsgObsDepA(MsgObsDepA), + MsgObsDepB(MsgObsDepB), + MsgObsDepC(MsgObsDepC), + MsgIono(MsgIono), + MsgSvConfigurationGPSDep(MsgSvConfigurationGPSDep), + MsgGnssCapb(MsgGnssCapb), + MsgGroupDelayDepA(MsgGroupDelayDepA), + MsgGroupDelayDepB(MsgGroupDelayDepB), + MsgGroupDelay(MsgGroupDelay), + MsgAlmanacGPSDep(MsgAlmanacGPSDep), + MsgAlmanacGPS(MsgAlmanacGPS), + MsgAlmanacGloDep(MsgAlmanacGloDep), + MsgAlmanacGlo(MsgAlmanacGlo), + MsgGloBiases(MsgGloBiases), + MsgSvAzEl(MsgSvAzEl), + MsgOsr(MsgOsr), + MsgOdometry(MsgOdometry), + MsgSettingsSave(MsgSettingsSave), + MsgSettingsWrite(MsgSettingsWrite), + MsgSettingsWriteResp(MsgSettingsWriteResp), + MsgSettingsReadReq(MsgSettingsReadReq), + MsgSettingsReadResp(MsgSettingsReadResp), + MsgSettingsReadByIndexReq(MsgSettingsReadByIndexReq), + MsgSettingsReadByIndexResp(MsgSettingsReadByIndexResp), + MsgSettingsReadByIndexDone(MsgSettingsReadByIndexDone), + MsgSettingsRegister(MsgSettingsRegister), + MsgSettingsRegisterResp(MsgSettingsRegisterResp), + MsgFileioReadReq(MsgFileioReadReq), + MsgFileioReadResp(MsgFileioReadResp), + MsgFileioReadDirReq(MsgFileioReadDirReq), + MsgFileioReadDirResp(MsgFileioReadDirResp), + MsgFileioRemove(MsgFileioRemove), + MsgFileioWriteReq(MsgFileioWriteReq), + MsgFileioWriteResp(MsgFileioWriteResp), + MsgFileioConfigReq(MsgFileioConfigReq), + MsgFileioConfigResp(MsgFileioConfigResp), } impl SBP { - pub fn parse(id: u16, payload: &mut &[u8]) -> Result { - let x: Result = match id { - 1501 => Ok(SBP::MsgSsrOrbitClock(MsgSsrOrbitClock::parse(payload)?)), - 1500 => Ok(SBP::MsgSsrOrbitClockDepA(MsgSsrOrbitClockDepA::parse( - payload, - )?)), - 1505 => Ok(SBP::MsgSsrCodeBiases(MsgSsrCodeBiases::parse(payload)?)), - 1510 => Ok(SBP::MsgSsrPhaseBiases(MsgSsrPhaseBiases::parse(payload)?)), - 1515 => Ok(SBP::MsgSsrStecCorrection(MsgSsrStecCorrection::parse( - payload, - )?)), - 1520 => Ok(SBP::MsgSsrGriddedCorrection( - MsgSsrGriddedCorrection::parse(payload)?, - )), - 1525 => Ok(SBP::MsgSsrGridDefinition(MsgSsrGridDefinition::parse( - payload, - )?)), - 1024 => Ok(SBP::MsgNdbEvent(MsgNdbEvent::parse(payload)?)), - 2304 => Ok(SBP::MsgImuRaw(MsgImuRaw::parse(payload)?)), - 2305 => Ok(SBP::MsgImuAux(MsgImuAux::parse(payload)?)), - 2048 => Ok(SBP::MsgUserData(MsgUserData::parse(payload)?)), - 2307 => Ok(SBP::MsgOdometry(MsgOdometry::parse(payload)?)), - 30583 => Ok(SBP::MsgSbasRaw(MsgSbasRaw::parse(payload)?)), - 47 => Ok(SBP::MsgAcqResult(MsgAcqResult::parse(payload)?)), - 31 => Ok(SBP::MsgAcqResultDepC(MsgAcqResultDepC::parse(payload)?)), - 20 => Ok(SBP::MsgAcqResultDepB(MsgAcqResultDepB::parse(payload)?)), - 21 => Ok(SBP::MsgAcqResultDepA(MsgAcqResultDepA::parse(payload)?)), - 46 => Ok(SBP::MsgAcqSvProfile(MsgAcqSvProfile::parse(payload)?)), - 30 => Ok(SBP::MsgAcqSvProfileDep(MsgAcqSvProfileDep::parse(payload)?)), - 161 => Ok(SBP::MsgSettingsSave(MsgSettingsSave::parse(payload)?)), - 160 => Ok(SBP::MsgSettingsWrite(MsgSettingsWrite::parse(payload)?)), - 175 => Ok(SBP::MsgSettingsWriteResp(MsgSettingsWriteResp::parse( - payload, - )?)), - 164 => Ok(SBP::MsgSettingsReadReq(MsgSettingsReadReq::parse(payload)?)), - 165 => Ok(SBP::MsgSettingsReadResp(MsgSettingsReadResp::parse( - payload, - )?)), - 162 => Ok(SBP::MsgSettingsReadByIndexReq( - MsgSettingsReadByIndexReq::parse(payload)?, - )), - 167 => Ok(SBP::MsgSettingsReadByIndexResp( - MsgSettingsReadByIndexResp::parse(payload)?, - )), - 166 => Ok(SBP::MsgSettingsReadByIndexDone( - MsgSettingsReadByIndexDone::parse(payload)?, - )), - 174 => Ok(SBP::MsgSettingsRegister(MsgSettingsRegister::parse( - payload, - )?)), - 431 => Ok(SBP::MsgSettingsRegisterResp( - MsgSettingsRegisterResp::parse(payload)?, - )), - 168 => Ok(SBP::MsgFileioReadReq(MsgFileioReadReq::parse(payload)?)), - 163 => Ok(SBP::MsgFileioReadResp(MsgFileioReadResp::parse(payload)?)), - 169 => Ok(SBP::MsgFileioReadDirReq(MsgFileioReadDirReq::parse( - payload, - )?)), - 170 => Ok(SBP::MsgFileioReadDirResp(MsgFileioReadDirResp::parse( - payload, - )?)), - 172 => Ok(SBP::MsgFileioRemove(MsgFileioRemove::parse(payload)?)), - 173 => Ok(SBP::MsgFileioWriteReq(MsgFileioWriteReq::parse(payload)?)), - 171 => Ok(SBP::MsgFileioWriteResp(MsgFileioWriteResp::parse(payload)?)), - 4097 => Ok(SBP::MsgFileioConfigReq(MsgFileioConfigReq::parse(payload)?)), - 4098 => Ok(SBP::MsgFileioConfigResp(MsgFileioConfigResp::parse( - payload, - )?)), - 65280 => Ok(SBP::MsgStartup(MsgStartup::parse(payload)?)), - 65282 => Ok(SBP::MsgDgnssStatus(MsgDgnssStatus::parse(payload)?)), - 65535 => Ok(SBP::MsgHeartbeat(MsgHeartbeat::parse(payload)?)), - 65283 => Ok(SBP::MsgInsStatus(MsgInsStatus::parse(payload)?)), - 65284 => Ok(SBP::MsgCsacTelemetry(MsgCsacTelemetry::parse(payload)?)), - 65285 => Ok(SBP::MsgCsacTelemetryLabels(MsgCsacTelemetryLabels::parse( - payload, - )?)), - 32512 => Ok(SBP::MsgLinuxCpuState(MsgLinuxCpuState::parse(payload)?)), - 32513 => Ok(SBP::MsgLinuxMemState(MsgLinuxMemState::parse(payload)?)), - 32514 => Ok(SBP::MsgLinuxSysState(MsgLinuxSysState::parse(payload)?)), - 32515 => Ok(SBP::MsgLinuxProcessSocketCounts( - MsgLinuxProcessSocketCounts::parse(payload)?, - )), - 32516 => Ok(SBP::MsgLinuxProcessSocketQueues( - MsgLinuxProcessSocketQueues::parse(payload)?, - )), - 32517 => Ok(SBP::MsgLinuxSocketUsage(MsgLinuxSocketUsage::parse( - payload, - )?)), - 32518 => Ok(SBP::MsgLinuxProcessFdCount(MsgLinuxProcessFdCount::parse( - payload, - )?)), - 32519 => Ok(SBP::MsgLinuxProcessFdSummary( - MsgLinuxProcessFdSummary::parse(payload)?, - )), - 257 => Ok(SBP::MsgExtEvent(MsgExtEvent::parse(payload)?)), - 74 => Ok(SBP::MsgObs(MsgObs::parse(payload)?)), - 68 => Ok(SBP::MsgBasePosLLH(MsgBasePosLLH::parse(payload)?)), - 72 => Ok(SBP::MsgBasePosECEF(MsgBasePosECEF::parse(payload)?)), - 129 => Ok(SBP::MsgEphemerisGPSDepE(MsgEphemerisGPSDepE::parse( - payload, - )?)), - 134 => Ok(SBP::MsgEphemerisGPSDepF(MsgEphemerisGPSDepF::parse( - payload, - )?)), - 138 => Ok(SBP::MsgEphemerisGPS(MsgEphemerisGPS::parse(payload)?)), - 142 => Ok(SBP::MsgEphemerisQzss(MsgEphemerisQzss::parse(payload)?)), - 137 => Ok(SBP::MsgEphemerisBds(MsgEphemerisBds::parse(payload)?)), - 149 => Ok(SBP::MsgEphemerisGalDepA(MsgEphemerisGalDepA::parse( - payload, - )?)), - 141 => Ok(SBP::MsgEphemerisGal(MsgEphemerisGal::parse(payload)?)), - 130 => Ok(SBP::MsgEphemerisSbasDepA(MsgEphemerisSbasDepA::parse( - payload, - )?)), - 131 => Ok(SBP::MsgEphemerisGloDepA(MsgEphemerisGloDepA::parse( - payload, - )?)), - 132 => Ok(SBP::MsgEphemerisSbasDepB(MsgEphemerisSbasDepB::parse( - payload, - )?)), - 140 => Ok(SBP::MsgEphemerisSbas(MsgEphemerisSbas::parse(payload)?)), - 133 => Ok(SBP::MsgEphemerisGloDepB(MsgEphemerisGloDepB::parse( - payload, - )?)), - 135 => Ok(SBP::MsgEphemerisGloDepC(MsgEphemerisGloDepC::parse( - payload, - )?)), - 136 => Ok(SBP::MsgEphemerisGloDepD(MsgEphemerisGloDepD::parse( - payload, - )?)), - 139 => Ok(SBP::MsgEphemerisGlo(MsgEphemerisGlo::parse(payload)?)), - 128 => Ok(SBP::MsgEphemerisDepD(MsgEphemerisDepD::parse(payload)?)), - 26 => Ok(SBP::MsgEphemerisDepA(MsgEphemerisDepA::parse(payload)?)), - 70 => Ok(SBP::MsgEphemerisDepB(MsgEphemerisDepB::parse(payload)?)), - 71 => Ok(SBP::MsgEphemerisDepC(MsgEphemerisDepC::parse(payload)?)), - 69 => Ok(SBP::MsgObsDepA(MsgObsDepA::parse(payload)?)), - 67 => Ok(SBP::MsgObsDepB(MsgObsDepB::parse(payload)?)), - 73 => Ok(SBP::MsgObsDepC(MsgObsDepC::parse(payload)?)), - 144 => Ok(SBP::MsgIono(MsgIono::parse(payload)?)), - 145 => Ok(SBP::MsgSvConfigurationGPSDep( - MsgSvConfigurationGPSDep::parse(payload)?, - )), - 150 => Ok(SBP::MsgGnssCapb(MsgGnssCapb::parse(payload)?)), - 146 => Ok(SBP::MsgGroupDelayDepA(MsgGroupDelayDepA::parse(payload)?)), - 147 => Ok(SBP::MsgGroupDelayDepB(MsgGroupDelayDepB::parse(payload)?)), - 148 => Ok(SBP::MsgGroupDelay(MsgGroupDelay::parse(payload)?)), - 112 => Ok(SBP::MsgAlmanacGPSDep(MsgAlmanacGPSDep::parse(payload)?)), - 114 => Ok(SBP::MsgAlmanacGPS(MsgAlmanacGPS::parse(payload)?)), - 113 => Ok(SBP::MsgAlmanacGloDep(MsgAlmanacGloDep::parse(payload)?)), - 115 => Ok(SBP::MsgAlmanacGlo(MsgAlmanacGlo::parse(payload)?)), - 117 => Ok(SBP::MsgGloBiases(MsgGloBiases::parse(payload)?)), - 151 => Ok(SBP::MsgSvAzEl(MsgSvAzEl::parse(payload)?)), - 1600 => Ok(SBP::MsgOsr(MsgOsr::parse(payload)?)), - 230 => Ok(SBP::MsgFlashProgram(MsgFlashProgram::parse(payload)?)), - 224 => Ok(SBP::MsgFlashDone(MsgFlashDone::parse(payload)?)), - 231 => Ok(SBP::MsgFlashReadReq(MsgFlashReadReq::parse(payload)?)), - 225 => Ok(SBP::MsgFlashReadResp(MsgFlashReadResp::parse(payload)?)), - 226 => Ok(SBP::MsgFlashErase(MsgFlashErase::parse(payload)?)), - 227 => Ok(SBP::MsgStmFlashLockSector(MsgStmFlashLockSector::parse( - payload, - )?)), - 228 => Ok(SBP::MsgStmFlashUnlockSector( - MsgStmFlashUnlockSector::parse(payload)?, - )), - 232 => Ok(SBP::MsgStmUniqueIdReq(MsgStmUniqueIdReq::parse(payload)?)), - 229 => Ok(SBP::MsgStmUniqueIdResp(MsgStmUniqueIdResp::parse(payload)?)), - 243 => Ok(SBP::MsgM25FlashWriteStatus(MsgM25FlashWriteStatus::parse( - payload, - )?)), - 258 => Ok(SBP::MsgGPSTime(MsgGPSTime::parse(payload)?)), - 259 => Ok(SBP::MsgUtcTime(MsgUtcTime::parse(payload)?)), - 520 => Ok(SBP::MsgDops(MsgDops::parse(payload)?)), - 521 => Ok(SBP::MsgPosECEF(MsgPosECEF::parse(payload)?)), - 532 => Ok(SBP::MsgPosECEFCov(MsgPosECEFCov::parse(payload)?)), - 522 => Ok(SBP::MsgPosLLH(MsgPosLLH::parse(payload)?)), - 529 => Ok(SBP::MsgPosLLHCov(MsgPosLLHCov::parse(payload)?)), - 523 => Ok(SBP::MsgBaselineECEF(MsgBaselineECEF::parse(payload)?)), - 524 => Ok(SBP::MsgBaselineNED(MsgBaselineNED::parse(payload)?)), - 525 => Ok(SBP::MsgVelECEF(MsgVelECEF::parse(payload)?)), - 533 => Ok(SBP::MsgVelECEFCov(MsgVelECEFCov::parse(payload)?)), - 526 => Ok(SBP::MsgVelNED(MsgVelNED::parse(payload)?)), - 530 => Ok(SBP::MsgVelNEDCov(MsgVelNEDCov::parse(payload)?)), - 531 => Ok(SBP::MsgVelBody(MsgVelBody::parse(payload)?)), - 528 => Ok(SBP::MsgAgeCorrections(MsgAgeCorrections::parse(payload)?)), - 256 => Ok(SBP::MsgGPSTimeDepA(MsgGPSTimeDepA::parse(payload)?)), - 518 => Ok(SBP::MsgDopsDepA(MsgDopsDepA::parse(payload)?)), - 512 => Ok(SBP::MsgPosECEFDepA(MsgPosECEFDepA::parse(payload)?)), - 513 => Ok(SBP::MsgPosLLHDepA(MsgPosLLHDepA::parse(payload)?)), - 514 => Ok(SBP::MsgBaselineECEFDepA(MsgBaselineECEFDepA::parse( - payload, - )?)), - 515 => Ok(SBP::MsgBaselineNEDDepA(MsgBaselineNEDDepA::parse(payload)?)), - 516 => Ok(SBP::MsgVelECEFDepA(MsgVelECEFDepA::parse(payload)?)), - 517 => Ok(SBP::MsgVelNEDDepA(MsgVelNEDDepA::parse(payload)?)), - 519 => Ok(SBP::MsgBaselineHeadingDepA(MsgBaselineHeadingDepA::parse( - payload, - )?)), - 527 => Ok(SBP::MsgBaselineHeading(MsgBaselineHeading::parse(payload)?)), - 544 => Ok(SBP::MsgOrientQuat(MsgOrientQuat::parse(payload)?)), - 545 => Ok(SBP::MsgOrientEuler(MsgOrientEuler::parse(payload)?)), - 546 => Ok(SBP::MsgAngularRate(MsgAngularRate::parse(payload)?)), - 33 => Ok(SBP::MsgTrackingStateDetailedDepA( - MsgTrackingStateDetailedDepA::parse(payload)?, - )), - 17 => Ok(SBP::MsgTrackingStateDetailedDep( - MsgTrackingStateDetailedDep::parse(payload)?, - )), - 65 => Ok(SBP::MsgTrackingState(MsgTrackingState::parse(payload)?)), - 97 => Ok(SBP::MsgMeasurementState(MsgMeasurementState::parse( - payload, - )?)), - 45 => Ok(SBP::MsgTrackingIq(MsgTrackingIq::parse(payload)?)), - 44 => Ok(SBP::MsgTrackingIqDepB(MsgTrackingIqDepB::parse(payload)?)), - 28 => Ok(SBP::MsgTrackingIqDepA(MsgTrackingIqDepA::parse(payload)?)), - 22 => Ok(SBP::MsgTrackingStateDepA(MsgTrackingStateDepA::parse( - payload, - )?)), - 19 => Ok(SBP::MsgTrackingStateDepB(MsgTrackingStateDepB::parse( - payload, - )?)), - 1025 => Ok(SBP::MsgLog(MsgLog::parse(payload)?)), - 1026 => Ok(SBP::MsgFwd(MsgFwd::parse(payload)?)), - 16 => Ok(SBP::MsgPrintDep(MsgPrintDep::parse(payload)?)), - 179 => Ok(SBP::MsgBootloaderHandshakeReq( - MsgBootloaderHandshakeReq::parse(payload)?, - )), - 180 => Ok(SBP::MsgBootloaderHandshakeResp( - MsgBootloaderHandshakeResp::parse(payload)?, - )), - 177 => Ok(SBP::MsgBootloaderJumpToApp(MsgBootloaderJumpToApp::parse( - payload, - )?)), - 222 => Ok(SBP::MsgNapDeviceDnaReq(MsgNapDeviceDnaReq::parse(payload)?)), - 221 => Ok(SBP::MsgNapDeviceDnaResp(MsgNapDeviceDnaResp::parse( - payload, - )?)), - 176 => Ok(SBP::MsgBootloaderHandshakeDepA( - MsgBootloaderHandshakeDepA::parse(payload)?, - )), - 105 => Ok(SBP::MsgAlmanac(MsgAlmanac::parse(payload)?)), - 104 => Ok(SBP::MsgSetTime(MsgSetTime::parse(payload)?)), - 182 => Ok(SBP::MsgReset(MsgReset::parse(payload)?)), - 178 => Ok(SBP::MsgResetDep(MsgResetDep::parse(payload)?)), - 192 => Ok(SBP::MsgCwResults(MsgCwResults::parse(payload)?)), - 193 => Ok(SBP::MsgCwStart(MsgCwStart::parse(payload)?)), - 34 => Ok(SBP::MsgResetFilters(MsgResetFilters::parse(payload)?)), - 35 => Ok(SBP::MsgInitBaseDep(MsgInitBaseDep::parse(payload)?)), - 23 => Ok(SBP::MsgThreadState(MsgThreadState::parse(payload)?)), - 29 => Ok(SBP::MsgUartState(MsgUartState::parse(payload)?)), - 24 => Ok(SBP::MsgUartStateDepa(MsgUartStateDepa::parse(payload)?)), - 25 => Ok(SBP::MsgIarState(MsgIarState::parse(payload)?)), - 43 => Ok(SBP::MsgMaskSatellite(MsgMaskSatellite::parse(payload)?)), - 27 => Ok(SBP::MsgMaskSatelliteDep(MsgMaskSatelliteDep::parse( - payload, - )?)), - 181 => Ok(SBP::MsgDeviceMonitor(MsgDeviceMonitor::parse(payload)?)), - 184 => Ok(SBP::MsgCommandReq(MsgCommandReq::parse(payload)?)), - 185 => Ok(SBP::MsgCommandResp(MsgCommandResp::parse(payload)?)), - 188 => Ok(SBP::MsgCommandOutput(MsgCommandOutput::parse(payload)?)), - 186 => Ok(SBP::MsgNetworkStateReq(MsgNetworkStateReq::parse(payload)?)), - 187 => Ok(SBP::MsgNetworkStateResp(MsgNetworkStateResp::parse( - payload, - )?)), - 189 => Ok(SBP::MsgNetworkBandwidthUsage( - MsgNetworkBandwidthUsage::parse(payload)?, - )), - 190 => Ok(SBP::MsgCellModemStatus(MsgCellModemStatus::parse(payload)?)), - 80 => Ok(SBP::MsgSpecanDep(MsgSpecanDep::parse(payload)?)), - 81 => Ok(SBP::MsgSpecan(MsgSpecan::parse(payload)?)), - 191 => Ok(SBP::MsgFrontEndGain(MsgFrontEndGain::parse(payload)?)), - 2306 => Ok(SBP::MsgMagRaw(MsgMagRaw::parse(payload)?)), - _ => Ok(SBP::Unknown { id }), + pub fn parse(msg_id: u16, sender_id: u16, payload: &mut &[u8]) -> Result { + let x: Result = match msg_id { + 258 => { + let mut msg = MsgGPSTime::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgGPSTime(msg)) + } + 259 => { + let mut msg = MsgUtcTime::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgUtcTime(msg)) + } + 520 => { + let mut msg = MsgDops::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgDops(msg)) + } + 521 => { + let mut msg = MsgPosECEF::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgPosECEF(msg)) + } + 532 => { + let mut msg = MsgPosECEFCov::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgPosECEFCov(msg)) + } + 522 => { + let mut msg = MsgPosLLH::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgPosLLH(msg)) + } + 529 => { + let mut msg = MsgPosLLHCov::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgPosLLHCov(msg)) + } + 523 => { + let mut msg = MsgBaselineECEF::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBaselineECEF(msg)) + } + 524 => { + let mut msg = MsgBaselineNED::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBaselineNED(msg)) + } + 525 => { + let mut msg = MsgVelECEF::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgVelECEF(msg)) + } + 533 => { + let mut msg = MsgVelECEFCov::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgVelECEFCov(msg)) + } + 526 => { + let mut msg = MsgVelNED::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgVelNED(msg)) + } + 530 => { + let mut msg = MsgVelNEDCov::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgVelNEDCov(msg)) + } + 531 => { + let mut msg = MsgVelBody::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgVelBody(msg)) + } + 528 => { + let mut msg = MsgAgeCorrections::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAgeCorrections(msg)) + } + 256 => { + let mut msg = MsgGPSTimeDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgGPSTimeDepA(msg)) + } + 518 => { + let mut msg = MsgDopsDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgDopsDepA(msg)) + } + 512 => { + let mut msg = MsgPosECEFDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgPosECEFDepA(msg)) + } + 513 => { + let mut msg = MsgPosLLHDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgPosLLHDepA(msg)) + } + 514 => { + let mut msg = MsgBaselineECEFDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBaselineECEFDepA(msg)) + } + 515 => { + let mut msg = MsgBaselineNEDDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBaselineNEDDepA(msg)) + } + 516 => { + let mut msg = MsgVelECEFDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgVelECEFDepA(msg)) + } + 517 => { + let mut msg = MsgVelNEDDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgVelNEDDepA(msg)) + } + 519 => { + let mut msg = MsgBaselineHeadingDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBaselineHeadingDepA(msg)) + } + 33 => { + let mut msg = MsgTrackingStateDetailedDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingStateDetailedDepA(msg)) + } + 17 => { + let mut msg = MsgTrackingStateDetailedDep::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingStateDetailedDep(msg)) + } + 65 => { + let mut msg = MsgTrackingState::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingState(msg)) + } + 97 => { + let mut msg = MsgMeasurementState::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgMeasurementState(msg)) + } + 45 => { + let mut msg = MsgTrackingIq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingIq(msg)) + } + 44 => { + let mut msg = MsgTrackingIqDepB::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingIqDepB(msg)) + } + 28 => { + let mut msg = MsgTrackingIqDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingIqDepA(msg)) + } + 22 => { + let mut msg = MsgTrackingStateDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingStateDepA(msg)) + } + 19 => { + let mut msg = MsgTrackingStateDepB::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingStateDepB(msg)) + } + 1501 => { + let mut msg = MsgSsrOrbitClock::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrOrbitClock(msg)) + } + 1500 => { + let mut msg = MsgSsrOrbitClockDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrOrbitClockDepA(msg)) + } + 1505 => { + let mut msg = MsgSsrCodeBiases::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrCodeBiases(msg)) + } + 1510 => { + let mut msg = MsgSsrPhaseBiases::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrPhaseBiases(msg)) + } + 1515 => { + let mut msg = MsgSsrStecCorrection::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrStecCorrection(msg)) + } + 1520 => { + let mut msg = MsgSsrGriddedCorrection::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrGriddedCorrection(msg)) + } + 1525 => { + let mut msg = MsgSsrGridDefinition::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrGridDefinition(msg)) + } + 527 => { + let mut msg = MsgBaselineHeading::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBaselineHeading(msg)) + } + 544 => { + let mut msg = MsgOrientQuat::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgOrientQuat(msg)) + } + 545 => { + let mut msg = MsgOrientEuler::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgOrientEuler(msg)) + } + 546 => { + let mut msg = MsgAngularRate::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAngularRate(msg)) + } + 65280 => { + let mut msg = MsgStartup::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgStartup(msg)) + } + 65282 => { + let mut msg = MsgDgnssStatus::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgDgnssStatus(msg)) + } + 65535 => { + let mut msg = MsgHeartbeat::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgHeartbeat(msg)) + } + 65283 => { + let mut msg = MsgInsStatus::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgInsStatus(msg)) + } + 65284 => { + let mut msg = MsgCsacTelemetry::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgCsacTelemetry(msg)) + } + 65285 => { + let mut msg = MsgCsacTelemetryLabels::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgCsacTelemetryLabels(msg)) + } + 47 => { + let mut msg = MsgAcqResult::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAcqResult(msg)) + } + 31 => { + let mut msg = MsgAcqResultDepC::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAcqResultDepC(msg)) + } + 20 => { + let mut msg = MsgAcqResultDepB::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAcqResultDepB(msg)) + } + 21 => { + let mut msg = MsgAcqResultDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAcqResultDepA(msg)) + } + 46 => { + let mut msg = MsgAcqSvProfile::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAcqSvProfile(msg)) + } + 30 => { + let mut msg = MsgAcqSvProfileDep::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAcqSvProfileDep(msg)) + } + 105 => { + let mut msg = MsgAlmanac::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAlmanac(msg)) + } + 104 => { + let mut msg = MsgSetTime::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSetTime(msg)) + } + 182 => { + let mut msg = MsgReset::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgReset(msg)) + } + 178 => { + let mut msg = MsgResetDep::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgResetDep(msg)) + } + 192 => { + let mut msg = MsgCwResults::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgCwResults(msg)) + } + 193 => { + let mut msg = MsgCwStart::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgCwStart(msg)) + } + 34 => { + let mut msg = MsgResetFilters::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgResetFilters(msg)) + } + 35 => { + let mut msg = MsgInitBaseDep::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgInitBaseDep(msg)) + } + 23 => { + let mut msg = MsgThreadState::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgThreadState(msg)) + } + 29 => { + let mut msg = MsgUartState::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgUartState(msg)) + } + 24 => { + let mut msg = MsgUartStateDepa::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgUartStateDepa(msg)) + } + 25 => { + let mut msg = MsgIarState::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgIarState(msg)) + } + 43 => { + let mut msg = MsgMaskSatellite::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgMaskSatellite(msg)) + } + 27 => { + let mut msg = MsgMaskSatelliteDep::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgMaskSatelliteDep(msg)) + } + 181 => { + let mut msg = MsgDeviceMonitor::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgDeviceMonitor(msg)) + } + 184 => { + let mut msg = MsgCommandReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgCommandReq(msg)) + } + 185 => { + let mut msg = MsgCommandResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgCommandResp(msg)) + } + 188 => { + let mut msg = MsgCommandOutput::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgCommandOutput(msg)) + } + 186 => { + let mut msg = MsgNetworkStateReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgNetworkStateReq(msg)) + } + 187 => { + let mut msg = MsgNetworkStateResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgNetworkStateResp(msg)) + } + 189 => { + let mut msg = MsgNetworkBandwidthUsage::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgNetworkBandwidthUsage(msg)) + } + 190 => { + let mut msg = MsgCellModemStatus::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgCellModemStatus(msg)) + } + 80 => { + let mut msg = MsgSpecanDep::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSpecanDep(msg)) + } + 81 => { + let mut msg = MsgSpecan::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSpecan(msg)) + } + 191 => { + let mut msg = MsgFrontEndGain::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFrontEndGain(msg)) + } + 2304 => { + let mut msg = MsgImuRaw::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgImuRaw(msg)) + } + 2305 => { + let mut msg = MsgImuAux::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgImuAux(msg)) + } + 179 => { + let mut msg = MsgBootloaderHandshakeReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBootloaderHandshakeReq(msg)) + } + 180 => { + let mut msg = MsgBootloaderHandshakeResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBootloaderHandshakeResp(msg)) + } + 177 => { + let mut msg = MsgBootloaderJumpToApp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBootloaderJumpToApp(msg)) + } + 222 => { + let mut msg = MsgNapDeviceDnaReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgNapDeviceDnaReq(msg)) + } + 221 => { + let mut msg = MsgNapDeviceDnaResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgNapDeviceDnaResp(msg)) + } + 176 => { + let mut msg = MsgBootloaderHandshakeDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBootloaderHandshakeDepA(msg)) + } + 230 => { + let mut msg = MsgFlashProgram::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFlashProgram(msg)) + } + 224 => { + let mut msg = MsgFlashDone::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFlashDone(msg)) + } + 231 => { + let mut msg = MsgFlashReadReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFlashReadReq(msg)) + } + 225 => { + let mut msg = MsgFlashReadResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFlashReadResp(msg)) + } + 226 => { + let mut msg = MsgFlashErase::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFlashErase(msg)) + } + 227 => { + let mut msg = MsgStmFlashLockSector::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgStmFlashLockSector(msg)) + } + 228 => { + let mut msg = MsgStmFlashUnlockSector::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgStmFlashUnlockSector(msg)) + } + 232 => { + let mut msg = MsgStmUniqueIdReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgStmUniqueIdReq(msg)) + } + 229 => { + let mut msg = MsgStmUniqueIdResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgStmUniqueIdResp(msg)) + } + 243 => { + let mut msg = MsgM25FlashWriteStatus::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgM25FlashWriteStatus(msg)) + } + 1025 => { + let mut msg = MsgLog::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLog(msg)) + } + 1026 => { + let mut msg = MsgFwd::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFwd(msg)) + } + 16 => { + let mut msg = MsgPrintDep::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgPrintDep(msg)) + } + 257 => { + let mut msg = MsgExtEvent::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgExtEvent(msg)) + } + 30583 => { + let mut msg = MsgSbasRaw::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSbasRaw(msg)) + } + 2048 => { + let mut msg = MsgUserData::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgUserData(msg)) + } + 2306 => { + let mut msg = MsgMagRaw::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgMagRaw(msg)) + } + 1024 => { + let mut msg = MsgNdbEvent::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgNdbEvent(msg)) + } + 32512 => { + let mut msg = MsgLinuxCpuState::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxCpuState(msg)) + } + 32513 => { + let mut msg = MsgLinuxMemState::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxMemState(msg)) + } + 32514 => { + let mut msg = MsgLinuxSysState::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxSysState(msg)) + } + 32515 => { + let mut msg = MsgLinuxProcessSocketCounts::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxProcessSocketCounts(msg)) + } + 32516 => { + let mut msg = MsgLinuxProcessSocketQueues::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxProcessSocketQueues(msg)) + } + 32517 => { + let mut msg = MsgLinuxSocketUsage::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxSocketUsage(msg)) + } + 32518 => { + let mut msg = MsgLinuxProcessFdCount::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxProcessFdCount(msg)) + } + 32519 => { + let mut msg = MsgLinuxProcessFdSummary::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxProcessFdSummary(msg)) + } + 74 => { + let mut msg = MsgObs::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgObs(msg)) + } + 68 => { + let mut msg = MsgBasePosLLH::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBasePosLLH(msg)) + } + 72 => { + let mut msg = MsgBasePosECEF::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBasePosECEF(msg)) + } + 129 => { + let mut msg = MsgEphemerisGPSDepE::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGPSDepE(msg)) + } + 134 => { + let mut msg = MsgEphemerisGPSDepF::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGPSDepF(msg)) + } + 138 => { + let mut msg = MsgEphemerisGPS::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGPS(msg)) + } + 142 => { + let mut msg = MsgEphemerisQzss::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisQzss(msg)) + } + 137 => { + let mut msg = MsgEphemerisBds::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisBds(msg)) + } + 149 => { + let mut msg = MsgEphemerisGalDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGalDepA(msg)) + } + 141 => { + let mut msg = MsgEphemerisGal::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGal(msg)) + } + 130 => { + let mut msg = MsgEphemerisSbasDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisSbasDepA(msg)) + } + 131 => { + let mut msg = MsgEphemerisGloDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGloDepA(msg)) + } + 132 => { + let mut msg = MsgEphemerisSbasDepB::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisSbasDepB(msg)) + } + 140 => { + let mut msg = MsgEphemerisSbas::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisSbas(msg)) + } + 133 => { + let mut msg = MsgEphemerisGloDepB::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGloDepB(msg)) + } + 135 => { + let mut msg = MsgEphemerisGloDepC::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGloDepC(msg)) + } + 136 => { + let mut msg = MsgEphemerisGloDepD::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGloDepD(msg)) + } + 139 => { + let mut msg = MsgEphemerisGlo::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGlo(msg)) + } + 128 => { + let mut msg = MsgEphemerisDepD::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisDepD(msg)) + } + 26 => { + let mut msg = MsgEphemerisDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisDepA(msg)) + } + 70 => { + let mut msg = MsgEphemerisDepB::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisDepB(msg)) + } + 71 => { + let mut msg = MsgEphemerisDepC::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisDepC(msg)) + } + 69 => { + let mut msg = MsgObsDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgObsDepA(msg)) + } + 67 => { + let mut msg = MsgObsDepB::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgObsDepB(msg)) + } + 73 => { + let mut msg = MsgObsDepC::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgObsDepC(msg)) + } + 144 => { + let mut msg = MsgIono::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgIono(msg)) + } + 145 => { + let mut msg = MsgSvConfigurationGPSDep::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSvConfigurationGPSDep(msg)) + } + 150 => { + let mut msg = MsgGnssCapb::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgGnssCapb(msg)) + } + 146 => { + let mut msg = MsgGroupDelayDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgGroupDelayDepA(msg)) + } + 147 => { + let mut msg = MsgGroupDelayDepB::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgGroupDelayDepB(msg)) + } + 148 => { + let mut msg = MsgGroupDelay::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgGroupDelay(msg)) + } + 112 => { + let mut msg = MsgAlmanacGPSDep::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAlmanacGPSDep(msg)) + } + 114 => { + let mut msg = MsgAlmanacGPS::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAlmanacGPS(msg)) + } + 113 => { + let mut msg = MsgAlmanacGloDep::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAlmanacGloDep(msg)) + } + 115 => { + let mut msg = MsgAlmanacGlo::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAlmanacGlo(msg)) + } + 117 => { + let mut msg = MsgGloBiases::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgGloBiases(msg)) + } + 151 => { + let mut msg = MsgSvAzEl::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSvAzEl(msg)) + } + 1600 => { + let mut msg = MsgOsr::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgOsr(msg)) + } + 2307 => { + let mut msg = MsgOdometry::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgOdometry(msg)) + } + 161 => { + let mut msg = MsgSettingsSave::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSettingsSave(msg)) + } + 160 => { + let mut msg = MsgSettingsWrite::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSettingsWrite(msg)) + } + 175 => { + let mut msg = MsgSettingsWriteResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSettingsWriteResp(msg)) + } + 164 => { + let mut msg = MsgSettingsReadReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSettingsReadReq(msg)) + } + 165 => { + let mut msg = MsgSettingsReadResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSettingsReadResp(msg)) + } + 162 => { + let mut msg = MsgSettingsReadByIndexReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSettingsReadByIndexReq(msg)) + } + 167 => { + let mut msg = MsgSettingsReadByIndexResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSettingsReadByIndexResp(msg)) + } + 166 => { + let mut msg = MsgSettingsReadByIndexDone::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSettingsReadByIndexDone(msg)) + } + 174 => { + let mut msg = MsgSettingsRegister::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSettingsRegister(msg)) + } + 431 => { + let mut msg = MsgSettingsRegisterResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSettingsRegisterResp(msg)) + } + 168 => { + let mut msg = MsgFileioReadReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadReq(msg)) + } + 163 => { + let mut msg = MsgFileioReadResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadResp(msg)) + } + 169 => { + let mut msg = MsgFileioReadDirReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadDirReq(msg)) + } + 170 => { + let mut msg = MsgFileioReadDirResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadDirResp(msg)) + } + 172 => { + let mut msg = MsgFileioRemove::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioRemove(msg)) + } + 173 => { + let mut msg = MsgFileioWriteReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioWriteReq(msg)) + } + 171 => { + let mut msg = MsgFileioWriteResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioWriteResp(msg)) + } + 4097 => { + let mut msg = MsgFileioConfigReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioConfigReq(msg)) + } + 4098 => { + let mut msg = MsgFileioConfigResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioConfigResp(msg)) + } + _ => Ok(SBP::Unknown { + msg_id: msg_id, + sender_id: sender_id, + payload: payload.to_vec(), + }), }; match x { Ok(x) => Ok(x), diff --git a/rust/sbp/src/messages/navigation.rs b/rust/sbp/src/messages/navigation.rs index 7fa77b8e66..31bbc46593 100644 --- a/rust/sbp/src/messages/navigation.rs +++ b/rust/sbp/src/messages/navigation.rs @@ -53,6 +53,7 @@ use self::byteorder::{LittleEndian, ReadBytesExt}; #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgGPSTime { + pub sender_id: Option, pub wn: u16, // ^ GPS week number pub tow: u32, @@ -65,9 +66,9 @@ pub struct MsgGPSTime { } impl MsgGPSTime { - pub const TYPE: u16 = 258; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgGPSTime { + sender_id: None, wn: _buf.read_u16::()?, tow: _buf.read_u32::()?, ns_residual: _buf.read_i32::()?, @@ -75,6 +76,17 @@ impl MsgGPSTime { }) } } +impl super::SBPMessage for MsgGPSTime { + const MSG_ID: u16 = 258; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // UTC Time // @@ -84,6 +96,7 @@ impl MsgGPSTime { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgUtcTime { + pub sender_id: Option, pub flags: u8, // ^ Indicates source and time validity pub tow: u32, @@ -105,9 +118,9 @@ pub struct MsgUtcTime { } impl MsgUtcTime { - pub const TYPE: u16 = 259; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgUtcTime { + sender_id: None, flags: _buf.read_u8()?, tow: _buf.read_u32::()?, year: _buf.read_u16::()?, @@ -120,6 +133,17 @@ impl MsgUtcTime { }) } } +impl super::SBPMessage for MsgUtcTime { + const MSG_ID: u16 = 259; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Dilution of Precision // @@ -131,6 +155,7 @@ impl MsgUtcTime { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgDops { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub gdop: u16, @@ -148,9 +173,9 @@ pub struct MsgDops { } impl MsgDops { - pub const TYPE: u16 = 520; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgDops { + sender_id: None, tow: _buf.read_u32::()?, gdop: _buf.read_u16::()?, pdop: _buf.read_u16::()?, @@ -161,6 +186,17 @@ impl MsgDops { }) } } +impl super::SBPMessage for MsgDops { + const MSG_ID: u16 = 520; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Single-point position in ECEF // @@ -176,6 +212,7 @@ impl MsgDops { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgPosECEF { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub x: f64, @@ -193,9 +230,9 @@ pub struct MsgPosECEF { } impl MsgPosECEF { - pub const TYPE: u16 = 521; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgPosECEF { + sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_f64::()?, y: _buf.read_f64::()?, @@ -206,6 +243,17 @@ impl MsgPosECEF { }) } } +impl super::SBPMessage for MsgPosECEF { + const MSG_ID: u16 = 521; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Single-point position in ECEF // @@ -222,6 +270,7 @@ impl MsgPosECEF { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgPosECEFCov { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub x: f64, @@ -249,9 +298,9 @@ pub struct MsgPosECEFCov { } impl MsgPosECEFCov { - pub const TYPE: u16 = 532; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgPosECEFCov { + sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_f64::()?, y: _buf.read_f64::()?, @@ -267,6 +316,17 @@ impl MsgPosECEFCov { }) } } +impl super::SBPMessage for MsgPosECEFCov { + const MSG_ID: u16 = 532; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Geodetic Position // @@ -282,6 +342,7 @@ impl MsgPosECEFCov { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgPosLLH { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub lat: f64, @@ -301,9 +362,9 @@ pub struct MsgPosLLH { } impl MsgPosLLH { - pub const TYPE: u16 = 522; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgPosLLH { + sender_id: None, tow: _buf.read_u32::()?, lat: _buf.read_f64::()?, lon: _buf.read_f64::()?, @@ -315,6 +376,17 @@ impl MsgPosLLH { }) } } +impl super::SBPMessage for MsgPosLLH { + const MSG_ID: u16 = 522; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Geodetic Position // @@ -330,6 +402,7 @@ impl MsgPosLLH { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgPosLLHCov { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub lat: f64, @@ -357,9 +430,9 @@ pub struct MsgPosLLHCov { } impl MsgPosLLHCov { - pub const TYPE: u16 = 529; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgPosLLHCov { + sender_id: None, tow: _buf.read_u32::()?, lat: _buf.read_f64::()?, lon: _buf.read_f64::()?, @@ -375,6 +448,17 @@ impl MsgPosLLHCov { }) } } +impl super::SBPMessage for MsgPosLLHCov { + const MSG_ID: u16 = 529; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Baseline Position in ECEF // @@ -387,6 +471,7 @@ impl MsgPosLLHCov { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBaselineECEF { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub x: i32, @@ -404,9 +489,9 @@ pub struct MsgBaselineECEF { } impl MsgBaselineECEF { - pub const TYPE: u16 = 523; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBaselineECEF { + sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_i32::()?, y: _buf.read_i32::()?, @@ -417,6 +502,17 @@ impl MsgBaselineECEF { }) } } +impl super::SBPMessage for MsgBaselineECEF { + const MSG_ID: u16 = 523; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Baseline in NED // @@ -430,6 +526,7 @@ impl MsgBaselineECEF { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBaselineNED { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub n: i32, @@ -449,9 +546,9 @@ pub struct MsgBaselineNED { } impl MsgBaselineNED { - pub const TYPE: u16 = 524; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBaselineNED { + sender_id: None, tow: _buf.read_u32::()?, n: _buf.read_i32::()?, e: _buf.read_i32::()?, @@ -463,6 +560,17 @@ impl MsgBaselineNED { }) } } +impl super::SBPMessage for MsgBaselineNED { + const MSG_ID: u16 = 524; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Velocity in ECEF // @@ -473,6 +581,7 @@ impl MsgBaselineNED { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgVelECEF { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub x: i32, @@ -490,9 +599,9 @@ pub struct MsgVelECEF { } impl MsgVelECEF { - pub const TYPE: u16 = 525; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgVelECEF { + sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_i32::()?, y: _buf.read_i32::()?, @@ -503,6 +612,17 @@ impl MsgVelECEF { }) } } +impl super::SBPMessage for MsgVelECEF { + const MSG_ID: u16 = 525; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Velocity in ECEF // @@ -513,6 +633,7 @@ impl MsgVelECEF { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgVelECEFCov { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub x: i32, @@ -540,9 +661,9 @@ pub struct MsgVelECEFCov { } impl MsgVelECEFCov { - pub const TYPE: u16 = 533; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgVelECEFCov { + sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_i32::()?, y: _buf.read_i32::()?, @@ -558,6 +679,17 @@ impl MsgVelECEFCov { }) } } +impl super::SBPMessage for MsgVelECEFCov { + const MSG_ID: u16 = 533; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Velocity in NED // @@ -569,6 +701,7 @@ impl MsgVelECEFCov { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgVelNED { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub n: i32, @@ -588,9 +721,9 @@ pub struct MsgVelNED { } impl MsgVelNED { - pub const TYPE: u16 = 526; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgVelNED { + sender_id: None, tow: _buf.read_u32::()?, n: _buf.read_i32::()?, e: _buf.read_i32::()?, @@ -602,6 +735,17 @@ impl MsgVelNED { }) } } +impl super::SBPMessage for MsgVelNED { + const MSG_ID: u16 = 526; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Velocity in NED // @@ -615,6 +759,7 @@ impl MsgVelNED { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgVelNEDCov { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub n: i32, @@ -642,9 +787,9 @@ pub struct MsgVelNEDCov { } impl MsgVelNEDCov { - pub const TYPE: u16 = 530; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgVelNEDCov { + sender_id: None, tow: _buf.read_u32::()?, n: _buf.read_i32::()?, e: _buf.read_i32::()?, @@ -660,6 +805,17 @@ impl MsgVelNEDCov { }) } } +impl super::SBPMessage for MsgVelNEDCov { + const MSG_ID: u16 = 530; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Velocity in User Frame // @@ -675,6 +831,7 @@ impl MsgVelNEDCov { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgVelBody { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub x: i32, @@ -702,9 +859,9 @@ pub struct MsgVelBody { } impl MsgVelBody { - pub const TYPE: u16 = 531; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgVelBody { + sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_i32::()?, y: _buf.read_i32::()?, @@ -720,6 +877,17 @@ impl MsgVelBody { }) } } +impl super::SBPMessage for MsgVelBody { + const MSG_ID: u16 = 531; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Age of corrections // @@ -729,6 +897,7 @@ impl MsgVelBody { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAgeCorrections { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub age: u16, @@ -736,14 +905,25 @@ pub struct MsgAgeCorrections { } impl MsgAgeCorrections { - pub const TYPE: u16 = 528; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAgeCorrections { + sender_id: None, tow: _buf.read_u32::()?, age: _buf.read_u16::()?, }) } } +impl super::SBPMessage for MsgAgeCorrections { + const MSG_ID: u16 = 528; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // GPS Time (v1.0) // @@ -764,6 +944,7 @@ impl MsgAgeCorrections { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgGPSTimeDepA { + pub sender_id: Option, pub wn: u16, // ^ GPS week number pub tow: u32, @@ -776,9 +957,9 @@ pub struct MsgGPSTimeDepA { } impl MsgGPSTimeDepA { - pub const TYPE: u16 = 256; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgGPSTimeDepA { + sender_id: None, wn: _buf.read_u16::()?, tow: _buf.read_u32::()?, ns_residual: _buf.read_i32::()?, @@ -786,6 +967,17 @@ impl MsgGPSTimeDepA { }) } } +impl super::SBPMessage for MsgGPSTimeDepA { + const MSG_ID: u16 = 256; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Dilution of Precision // @@ -796,6 +988,7 @@ impl MsgGPSTimeDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgDopsDepA { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub gdop: u16, @@ -811,9 +1004,9 @@ pub struct MsgDopsDepA { } impl MsgDopsDepA { - pub const TYPE: u16 = 518; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgDopsDepA { + sender_id: None, tow: _buf.read_u32::()?, gdop: _buf.read_u16::()?, pdop: _buf.read_u16::()?, @@ -823,6 +1016,17 @@ impl MsgDopsDepA { }) } } +impl super::SBPMessage for MsgDopsDepA { + const MSG_ID: u16 = 518; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Single-point position in ECEF // @@ -838,6 +1042,7 @@ impl MsgDopsDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgPosECEFDepA { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub x: f64, @@ -855,9 +1060,9 @@ pub struct MsgPosECEFDepA { } impl MsgPosECEFDepA { - pub const TYPE: u16 = 512; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgPosECEFDepA { + sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_f64::()?, y: _buf.read_f64::()?, @@ -868,6 +1073,17 @@ impl MsgPosECEFDepA { }) } } +impl super::SBPMessage for MsgPosECEFDepA { + const MSG_ID: u16 = 512; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Geodetic Position // @@ -883,6 +1099,7 @@ impl MsgPosECEFDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgPosLLHDepA { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub lat: f64, @@ -902,9 +1119,9 @@ pub struct MsgPosLLHDepA { } impl MsgPosLLHDepA { - pub const TYPE: u16 = 513; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgPosLLHDepA { + sender_id: None, tow: _buf.read_u32::()?, lat: _buf.read_f64::()?, lon: _buf.read_f64::()?, @@ -916,6 +1133,17 @@ impl MsgPosLLHDepA { }) } } +impl super::SBPMessage for MsgPosLLHDepA { + const MSG_ID: u16 = 513; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Baseline Position in ECEF // @@ -928,6 +1156,7 @@ impl MsgPosLLHDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBaselineECEFDepA { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub x: i32, @@ -945,9 +1174,9 @@ pub struct MsgBaselineECEFDepA { } impl MsgBaselineECEFDepA { - pub const TYPE: u16 = 514; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBaselineECEFDepA { + sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_i32::()?, y: _buf.read_i32::()?, @@ -958,6 +1187,17 @@ impl MsgBaselineECEFDepA { }) } } +impl super::SBPMessage for MsgBaselineECEFDepA { + const MSG_ID: u16 = 514; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Baseline in NED // @@ -971,6 +1211,7 @@ impl MsgBaselineECEFDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBaselineNEDDepA { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub n: i32, @@ -990,9 +1231,9 @@ pub struct MsgBaselineNEDDepA { } impl MsgBaselineNEDDepA { - pub const TYPE: u16 = 515; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBaselineNEDDepA { + sender_id: None, tow: _buf.read_u32::()?, n: _buf.read_i32::()?, e: _buf.read_i32::()?, @@ -1004,6 +1245,17 @@ impl MsgBaselineNEDDepA { }) } } +impl super::SBPMessage for MsgBaselineNEDDepA { + const MSG_ID: u16 = 515; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Velocity in ECEF // @@ -1014,6 +1266,7 @@ impl MsgBaselineNEDDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgVelECEFDepA { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub x: i32, @@ -1031,9 +1284,9 @@ pub struct MsgVelECEFDepA { } impl MsgVelECEFDepA { - pub const TYPE: u16 = 516; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgVelECEFDepA { + sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_i32::()?, y: _buf.read_i32::()?, @@ -1044,6 +1297,17 @@ impl MsgVelECEFDepA { }) } } +impl super::SBPMessage for MsgVelECEFDepA { + const MSG_ID: u16 = 516; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Velocity in NED // @@ -1055,6 +1319,7 @@ impl MsgVelECEFDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgVelNEDDepA { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub n: i32, @@ -1074,9 +1339,9 @@ pub struct MsgVelNEDDepA { } impl MsgVelNEDDepA { - pub const TYPE: u16 = 517; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgVelNEDDepA { + sender_id: None, tow: _buf.read_u32::()?, n: _buf.read_i32::()?, e: _buf.read_i32::()?, @@ -1088,6 +1353,17 @@ impl MsgVelNEDDepA { }) } } +impl super::SBPMessage for MsgVelNEDDepA { + const MSG_ID: u16 = 517; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Heading relative to True North // @@ -1098,6 +1374,7 @@ impl MsgVelNEDDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBaselineHeadingDepA { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub heading: u32, @@ -1109,9 +1386,9 @@ pub struct MsgBaselineHeadingDepA { } impl MsgBaselineHeadingDepA { - pub const TYPE: u16 = 519; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBaselineHeadingDepA { + sender_id: None, tow: _buf.read_u32::()?, heading: _buf.read_u32::()?, n_sats: _buf.read_u8()?, @@ -1119,3 +1396,14 @@ impl MsgBaselineHeadingDepA { }) } } +impl super::SBPMessage for MsgBaselineHeadingDepA { + const MSG_ID: u16 = 519; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/ndb.rs b/rust/sbp/src/messages/ndb.rs index ca48e896b7..2081f12e50 100644 --- a/rust/sbp/src/messages/ndb.rs +++ b/rust/sbp/src/messages/ndb.rs @@ -26,6 +26,7 @@ use super::gnss::*; #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgNdbEvent { + pub sender_id: Option, pub recv_time: u64, // ^ HW time in milliseconds. pub event: u8, @@ -51,9 +52,9 @@ pub struct MsgNdbEvent { } impl MsgNdbEvent { - pub const TYPE: u16 = 1024; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgNdbEvent { + sender_id: None, recv_time: _buf.read_u64::()?, event: _buf.read_u8()?, object_type: _buf.read_u8()?, @@ -65,3 +66,14 @@ impl MsgNdbEvent { }) } } +impl super::SBPMessage for MsgNdbEvent { + const MSG_ID: u16 = 1024; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/observation.rs b/rust/sbp/src/messages/observation.rs index 80a9bcc6e8..b6fca30f5e 100644 --- a/rust/sbp/src/messages/observation.rs +++ b/rust/sbp/src/messages/observation.rs @@ -246,6 +246,7 @@ impl PackedOsrContent { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgObs { + pub sender_id: Option, pub header: ObservationHeader, // ^ Header of a GPS observation message pub obs: Vec, @@ -253,14 +254,25 @@ pub struct MsgObs { } impl MsgObs { - pub const TYPE: u16 = 74; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgObs { + sender_id: None, header: ObservationHeader::parse(_buf)?, obs: PackedObsContent::parse_array(_buf)?, }) } } +impl super::SBPMessage for MsgObs { + const MSG_ID: u16 = 74; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Base station position // @@ -273,6 +285,7 @@ impl MsgObs { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBasePosLLH { + pub sender_id: Option, pub lat: f64, // ^ Latitude pub lon: f64, @@ -282,15 +295,26 @@ pub struct MsgBasePosLLH { } impl MsgBasePosLLH { - pub const TYPE: u16 = 68; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBasePosLLH { + sender_id: None, lat: _buf.read_f64::()?, lon: _buf.read_f64::()?, height: _buf.read_f64::()?, }) } } +impl super::SBPMessage for MsgBasePosLLH { + const MSG_ID: u16 = 68; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Base station position in ECEF // @@ -304,6 +328,7 @@ impl MsgBasePosLLH { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBasePosECEF { + pub sender_id: Option, pub x: f64, // ^ ECEF X coodinate pub y: f64, @@ -313,15 +338,26 @@ pub struct MsgBasePosECEF { } impl MsgBasePosECEF { - pub const TYPE: u16 = 72; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBasePosECEF { + sender_id: None, x: _buf.read_f64::()?, y: _buf.read_f64::()?, z: _buf.read_f64::()?, }) } } +impl super::SBPMessage for MsgBasePosECEF { + const MSG_ID: u16 = 72; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} #[derive(Debug)] #[allow(non_snake_case)] @@ -487,6 +523,7 @@ impl EphemerisCommonContentDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGPSDepE { + pub sender_id: Option, pub common: EphemerisCommonContentDepA, // ^ Values common for all ephemeris types pub tgd: f64, @@ -540,9 +577,9 @@ pub struct MsgEphemerisGPSDepE { } impl MsgEphemerisGPSDepE { - pub const TYPE: u16 = 129; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGPSDepE { + sender_id: None, common: EphemerisCommonContentDepA::parse(_buf)?, tgd: _buf.read_f64::()?, c_rs: _buf.read_f64::()?, @@ -569,6 +606,17 @@ impl MsgEphemerisGPSDepE { }) } } +impl super::SBPMessage for MsgEphemerisGPSDepE { + const MSG_ID: u16 = 129; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -578,6 +626,7 @@ impl MsgEphemerisGPSDepE { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGPSDepF { + pub sender_id: Option, pub common: EphemerisCommonContentDepB, // ^ Values common for all ephemeris types pub tgd: f64, @@ -631,9 +680,9 @@ pub struct MsgEphemerisGPSDepF { } impl MsgEphemerisGPSDepF { - pub const TYPE: u16 = 134; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGPSDepF { + sender_id: None, common: EphemerisCommonContentDepB::parse(_buf)?, tgd: _buf.read_f64::()?, c_rs: _buf.read_f64::()?, @@ -660,6 +709,17 @@ impl MsgEphemerisGPSDepF { }) } } +impl super::SBPMessage for MsgEphemerisGPSDepF { + const MSG_ID: u16 = 134; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Satellite broadcast ephemeris for GPS // @@ -672,6 +732,7 @@ impl MsgEphemerisGPSDepF { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGPS { + pub sender_id: Option, pub common: EphemerisCommonContent, // ^ Values common for all ephemeris types pub tgd: f32, @@ -725,9 +786,9 @@ pub struct MsgEphemerisGPS { } impl MsgEphemerisGPS { - pub const TYPE: u16 = 138; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGPS { + sender_id: None, common: EphemerisCommonContent::parse(_buf)?, tgd: _buf.read_f32::()?, c_rs: _buf.read_f32::()?, @@ -754,6 +815,17 @@ impl MsgEphemerisGPS { }) } } +impl super::SBPMessage for MsgEphemerisGPS { + const MSG_ID: u16 = 138; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Satellite broadcast ephemeris for QZSS // @@ -764,6 +836,7 @@ impl MsgEphemerisGPS { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisQzss { + pub sender_id: Option, pub common: EphemerisCommonContent, // ^ Values common for all ephemeris types pub tgd: f32, @@ -817,9 +890,9 @@ pub struct MsgEphemerisQzss { } impl MsgEphemerisQzss { - pub const TYPE: u16 = 142; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisQzss { + sender_id: None, common: EphemerisCommonContent::parse(_buf)?, tgd: _buf.read_f32::()?, c_rs: _buf.read_f32::()?, @@ -846,6 +919,17 @@ impl MsgEphemerisQzss { }) } } +impl super::SBPMessage for MsgEphemerisQzss { + const MSG_ID: u16 = 142; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Satellite broadcast ephemeris for BDS // @@ -857,6 +941,7 @@ impl MsgEphemerisQzss { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisBds { + pub sender_id: Option, pub common: EphemerisCommonContent, // ^ Values common for all ephemeris types pub tgd1: f32, @@ -912,9 +997,9 @@ pub struct MsgEphemerisBds { } impl MsgEphemerisBds { - pub const TYPE: u16 = 137; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisBds { + sender_id: None, common: EphemerisCommonContent::parse(_buf)?, tgd1: _buf.read_f32::()?, tgd2: _buf.read_f32::()?, @@ -942,6 +1027,17 @@ impl MsgEphemerisBds { }) } } +impl super::SBPMessage for MsgEphemerisBds { + const MSG_ID: u16 = 137; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -951,6 +1047,7 @@ impl MsgEphemerisBds { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGalDepA { + pub sender_id: Option, pub common: EphemerisCommonContent, // ^ Values common for all ephemeris types pub bgd_e1e5a: f32, @@ -1006,9 +1103,9 @@ pub struct MsgEphemerisGalDepA { } impl MsgEphemerisGalDepA { - pub const TYPE: u16 = 149; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGalDepA { + sender_id: None, common: EphemerisCommonContent::parse(_buf)?, bgd_e1e5a: _buf.read_f32::()?, bgd_e1e5b: _buf.read_f32::()?, @@ -1036,6 +1133,17 @@ impl MsgEphemerisGalDepA { }) } } +impl super::SBPMessage for MsgEphemerisGalDepA { + const MSG_ID: u16 = 149; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Satellite broadcast ephemeris for Galileo // @@ -1047,6 +1155,7 @@ impl MsgEphemerisGalDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGal { + pub sender_id: Option, pub common: EphemerisCommonContent, // ^ Values common for all ephemeris types pub bgd_e1e5a: f32, @@ -1104,9 +1213,9 @@ pub struct MsgEphemerisGal { } impl MsgEphemerisGal { - pub const TYPE: u16 = 141; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGal { + sender_id: None, common: EphemerisCommonContent::parse(_buf)?, bgd_e1e5a: _buf.read_f32::()?, bgd_e1e5b: _buf.read_f32::()?, @@ -1135,10 +1244,22 @@ impl MsgEphemerisGal { }) } } +impl super::SBPMessage for MsgEphemerisGal { + const MSG_ID: u16 = 141; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisSbasDepA { + pub sender_id: Option, pub common: EphemerisCommonContentDepA, // ^ Values common for all ephemeris types pub pos: Vec, @@ -1154,9 +1275,9 @@ pub struct MsgEphemerisSbasDepA { } impl MsgEphemerisSbasDepA { - pub const TYPE: u16 = 130; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisSbasDepA { + sender_id: None, common: EphemerisCommonContentDepA::parse(_buf)?, pos: ::parser::read_double_array_limit(_buf, 3)?, vel: ::parser::read_double_array_limit(_buf, 3)?, @@ -1166,6 +1287,17 @@ impl MsgEphemerisSbasDepA { }) } } +impl super::SBPMessage for MsgEphemerisSbasDepA { + const MSG_ID: u16 = 130; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Satellite broadcast ephemeris for GLO // @@ -1178,6 +1310,7 @@ impl MsgEphemerisSbasDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGloDepA { + pub sender_id: Option, pub common: EphemerisCommonContentDepA, // ^ Values common for all ephemeris types pub gamma: f64, @@ -1193,9 +1326,9 @@ pub struct MsgEphemerisGloDepA { } impl MsgEphemerisGloDepA { - pub const TYPE: u16 = 131; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGloDepA { + sender_id: None, common: EphemerisCommonContentDepA::parse(_buf)?, gamma: _buf.read_f64::()?, tau: _buf.read_f64::()?, @@ -1205,6 +1338,17 @@ impl MsgEphemerisGloDepA { }) } } +impl super::SBPMessage for MsgEphemerisGloDepA { + const MSG_ID: u16 = 131; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -1214,6 +1358,7 @@ impl MsgEphemerisGloDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisSbasDepB { + pub sender_id: Option, pub common: EphemerisCommonContentDepB, // ^ Values common for all ephemeris types pub pos: Vec, @@ -1229,9 +1374,9 @@ pub struct MsgEphemerisSbasDepB { } impl MsgEphemerisSbasDepB { - pub const TYPE: u16 = 132; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisSbasDepB { + sender_id: None, common: EphemerisCommonContentDepB::parse(_buf)?, pos: ::parser::read_double_array_limit(_buf, 3)?, vel: ::parser::read_double_array_limit(_buf, 3)?, @@ -1241,10 +1386,22 @@ impl MsgEphemerisSbasDepB { }) } } +impl super::SBPMessage for MsgEphemerisSbasDepB { + const MSG_ID: u16 = 132; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisSbas { + pub sender_id: Option, pub common: EphemerisCommonContent, // ^ Values common for all ephemeris types pub pos: Vec, @@ -1260,9 +1417,9 @@ pub struct MsgEphemerisSbas { } impl MsgEphemerisSbas { - pub const TYPE: u16 = 140; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisSbas { + sender_id: None, common: EphemerisCommonContent::parse(_buf)?, pos: ::parser::read_double_array_limit(_buf, 3)?, vel: ::parser::read_float_array_limit(_buf, 3)?, @@ -1272,6 +1429,17 @@ impl MsgEphemerisSbas { }) } } +impl super::SBPMessage for MsgEphemerisSbas { + const MSG_ID: u16 = 140; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Satellite broadcast ephemeris for GLO // @@ -1284,6 +1452,7 @@ impl MsgEphemerisSbas { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGloDepB { + pub sender_id: Option, pub common: EphemerisCommonContentDepB, // ^ Values common for all ephemeris types pub gamma: f64, @@ -1299,9 +1468,9 @@ pub struct MsgEphemerisGloDepB { } impl MsgEphemerisGloDepB { - pub const TYPE: u16 = 133; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGloDepB { + sender_id: None, common: EphemerisCommonContentDepB::parse(_buf)?, gamma: _buf.read_f64::()?, tau: _buf.read_f64::()?, @@ -1311,6 +1480,17 @@ impl MsgEphemerisGloDepB { }) } } +impl super::SBPMessage for MsgEphemerisGloDepB { + const MSG_ID: u16 = 133; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Satellite broadcast ephemeris for GLO // @@ -1323,6 +1503,7 @@ impl MsgEphemerisGloDepB { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGloDepC { + pub sender_id: Option, pub common: EphemerisCommonContentDepB, // ^ Values common for all ephemeris types pub gamma: f64, @@ -1342,9 +1523,9 @@ pub struct MsgEphemerisGloDepC { } impl MsgEphemerisGloDepC { - pub const TYPE: u16 = 135; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGloDepC { + sender_id: None, common: EphemerisCommonContentDepB::parse(_buf)?, gamma: _buf.read_f64::()?, tau: _buf.read_f64::()?, @@ -1356,6 +1537,17 @@ impl MsgEphemerisGloDepC { }) } } +impl super::SBPMessage for MsgEphemerisGloDepC { + const MSG_ID: u16 = 135; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -1365,6 +1557,7 @@ impl MsgEphemerisGloDepC { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGloDepD { + pub sender_id: Option, pub common: EphemerisCommonContentDepB, // ^ Values common for all ephemeris types pub gamma: f64, @@ -1386,9 +1579,9 @@ pub struct MsgEphemerisGloDepD { } impl MsgEphemerisGloDepD { - pub const TYPE: u16 = 136; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGloDepD { + sender_id: None, common: EphemerisCommonContentDepB::parse(_buf)?, gamma: _buf.read_f64::()?, tau: _buf.read_f64::()?, @@ -1401,6 +1594,17 @@ impl MsgEphemerisGloDepD { }) } } +impl super::SBPMessage for MsgEphemerisGloDepD { + const MSG_ID: u16 = 136; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Satellite broadcast ephemeris for GLO // @@ -1413,6 +1617,7 @@ impl MsgEphemerisGloDepD { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGlo { + pub sender_id: Option, pub common: EphemerisCommonContent, // ^ Values common for all ephemeris types pub gamma: f32, @@ -1434,9 +1639,9 @@ pub struct MsgEphemerisGlo { } impl MsgEphemerisGlo { - pub const TYPE: u16 = 139; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGlo { + sender_id: None, common: EphemerisCommonContent::parse(_buf)?, gamma: _buf.read_f32::()?, tau: _buf.read_f32::()?, @@ -1449,6 +1654,17 @@ impl MsgEphemerisGlo { }) } } +impl super::SBPMessage for MsgEphemerisGlo { + const MSG_ID: u16 = 139; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Satellite broadcast ephemeris // @@ -1461,6 +1677,7 @@ impl MsgEphemerisGlo { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisDepD { + pub sender_id: Option, pub tgd: f64, // ^ Group delay differential between L1 and L2 pub c_rs: f64, @@ -1526,9 +1743,9 @@ pub struct MsgEphemerisDepD { } impl MsgEphemerisDepD { - pub const TYPE: u16 = 128; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisDepD { + sender_id: None, tgd: _buf.read_f64::()?, c_rs: _buf.read_f64::()?, c_rc: _buf.read_f64::()?, @@ -1561,6 +1778,17 @@ impl MsgEphemerisDepD { }) } } +impl super::SBPMessage for MsgEphemerisDepD { + const MSG_ID: u16 = 128; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -1569,6 +1797,7 @@ impl MsgEphemerisDepD { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisDepA { + pub sender_id: Option, pub tgd: f64, // ^ Group delay differential between L1 and L2 pub c_rs: f64, @@ -1628,9 +1857,9 @@ pub struct MsgEphemerisDepA { } impl MsgEphemerisDepA { - pub const TYPE: u16 = 26; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisDepA { + sender_id: None, tgd: _buf.read_f64::()?, c_rs: _buf.read_f64::()?, c_rc: _buf.read_f64::()?, @@ -1660,6 +1889,17 @@ impl MsgEphemerisDepA { }) } } +impl super::SBPMessage for MsgEphemerisDepA { + const MSG_ID: u16 = 26; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -1668,6 +1908,7 @@ impl MsgEphemerisDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisDepB { + pub sender_id: Option, pub tgd: f64, // ^ Group delay differential between L1 and L2 pub c_rs: f64, @@ -1729,9 +1970,9 @@ pub struct MsgEphemerisDepB { } impl MsgEphemerisDepB { - pub const TYPE: u16 = 70; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisDepB { + sender_id: None, tgd: _buf.read_f64::()?, c_rs: _buf.read_f64::()?, c_rc: _buf.read_f64::()?, @@ -1762,6 +2003,17 @@ impl MsgEphemerisDepB { }) } } +impl super::SBPMessage for MsgEphemerisDepB { + const MSG_ID: u16 = 70; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Satellite broadcast ephemeris // @@ -1774,6 +2026,7 @@ impl MsgEphemerisDepB { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisDepC { + pub sender_id: Option, pub tgd: f64, // ^ Group delay differential between L1 and L2 pub c_rs: f64, @@ -1839,9 +2092,9 @@ pub struct MsgEphemerisDepC { } impl MsgEphemerisDepC { - pub const TYPE: u16 = 71; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisDepC { + sender_id: None, tgd: _buf.read_f64::()?, c_rs: _buf.read_f64::()?, c_rc: _buf.read_f64::()?, @@ -1874,6 +2127,17 @@ impl MsgEphemerisDepC { }) } } +impl super::SBPMessage for MsgEphemerisDepC { + const MSG_ID: u16 = 71; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Header for observation message. // @@ -2131,6 +2395,7 @@ impl PackedObsContentDepC { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgObsDepA { + pub sender_id: Option, pub header: ObservationHeaderDep, // ^ Header of a GPS observation message pub obs: Vec, @@ -2138,14 +2403,25 @@ pub struct MsgObsDepA { } impl MsgObsDepA { - pub const TYPE: u16 = 69; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgObsDepA { + sender_id: None, header: ObservationHeaderDep::parse(_buf)?, obs: PackedObsContentDepA::parse_array(_buf)?, }) } } +impl super::SBPMessage for MsgObsDepA { + const MSG_ID: u16 = 69; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -2159,6 +2435,7 @@ impl MsgObsDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgObsDepB { + pub sender_id: Option, pub header: ObservationHeaderDep, // ^ Header of a GPS observation message pub obs: Vec, @@ -2166,14 +2443,25 @@ pub struct MsgObsDepB { } impl MsgObsDepB { - pub const TYPE: u16 = 67; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgObsDepB { + sender_id: None, header: ObservationHeaderDep::parse(_buf)?, obs: PackedObsContentDepB::parse_array(_buf)?, }) } } +impl super::SBPMessage for MsgObsDepB { + const MSG_ID: u16 = 67; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -2188,6 +2476,7 @@ impl MsgObsDepB { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgObsDepC { + pub sender_id: Option, pub header: ObservationHeaderDep, // ^ Header of a GPS observation message pub obs: Vec, @@ -2195,14 +2484,25 @@ pub struct MsgObsDepC { } impl MsgObsDepC { - pub const TYPE: u16 = 73; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgObsDepC { + sender_id: None, header: ObservationHeaderDep::parse(_buf)?, obs: PackedObsContentDepC::parse_array(_buf)?, }) } } +impl super::SBPMessage for MsgObsDepC { + const MSG_ID: u16 = 73; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Iono corrections // @@ -2213,6 +2513,7 @@ impl MsgObsDepC { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgIono { + pub sender_id: Option, pub t_nmct: GPSTimeSec, // ^ Navigation Message Correction Table Valitidy Time pub a0: f64, @@ -2226,9 +2527,9 @@ pub struct MsgIono { } impl MsgIono { - pub const TYPE: u16 = 144; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgIono { + sender_id: None, t_nmct: GPSTimeSec::parse(_buf)?, a0: _buf.read_f64::()?, a1: _buf.read_f64::()?, @@ -2241,6 +2542,17 @@ impl MsgIono { }) } } +impl super::SBPMessage for MsgIono { + const MSG_ID: u16 = 144; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // L2C capability mask // @@ -2249,6 +2561,7 @@ impl MsgIono { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSvConfigurationGPSDep { + pub sender_id: Option, pub t_nmct: GPSTimeSec, // ^ Navigation Message Correction Table Valitidy Time pub l2c_mask: u32, @@ -2256,14 +2569,25 @@ pub struct MsgSvConfigurationGPSDep { } impl MsgSvConfigurationGPSDep { - pub const TYPE: u16 = 145; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSvConfigurationGPSDep { + sender_id: None, t_nmct: GPSTimeSec::parse(_buf)?, l2c_mask: _buf.read_u32::()?, }) } } +impl super::SBPMessage for MsgSvConfigurationGPSDep { + const MSG_ID: u16 = 145; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} #[derive(Debug)] #[allow(non_snake_case)] @@ -2345,6 +2669,7 @@ impl GnssCapb { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgGnssCapb { + pub sender_id: Option, pub t_nmct: GPSTimeSec, // ^ Navigation Message Correction Table Validity Time pub gc: GnssCapb, @@ -2352,14 +2677,25 @@ pub struct MsgGnssCapb { } impl MsgGnssCapb { - pub const TYPE: u16 = 150; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgGnssCapb { + sender_id: None, t_nmct: GPSTimeSec::parse(_buf)?, gc: GnssCapb::parse(_buf)?, }) } } +impl super::SBPMessage for MsgGnssCapb { + const MSG_ID: u16 = 150; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Group Delay // @@ -2368,6 +2704,7 @@ impl MsgGnssCapb { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgGroupDelayDepA { + pub sender_id: Option, pub t_op: GPSTimeDep, // ^ Data Predict Time of Week pub prn: u8, @@ -2381,9 +2718,9 @@ pub struct MsgGroupDelayDepA { } impl MsgGroupDelayDepA { - pub const TYPE: u16 = 146; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgGroupDelayDepA { + sender_id: None, t_op: GPSTimeDep::parse(_buf)?, prn: _buf.read_u8()?, valid: _buf.read_u8()?, @@ -2393,6 +2730,17 @@ impl MsgGroupDelayDepA { }) } } +impl super::SBPMessage for MsgGroupDelayDepA { + const MSG_ID: u16 = 146; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Group Delay // @@ -2401,6 +2749,7 @@ impl MsgGroupDelayDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgGroupDelayDepB { + pub sender_id: Option, pub t_op: GPSTimeSec, // ^ Data Predict Time of Week pub sid: GnssSignalDep, @@ -2414,9 +2763,9 @@ pub struct MsgGroupDelayDepB { } impl MsgGroupDelayDepB { - pub const TYPE: u16 = 147; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgGroupDelayDepB { + sender_id: None, t_op: GPSTimeSec::parse(_buf)?, sid: GnssSignalDep::parse(_buf)?, valid: _buf.read_u8()?, @@ -2426,6 +2775,17 @@ impl MsgGroupDelayDepB { }) } } +impl super::SBPMessage for MsgGroupDelayDepB { + const MSG_ID: u16 = 147; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Group Delay // @@ -2434,6 +2794,7 @@ impl MsgGroupDelayDepB { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgGroupDelay { + pub sender_id: Option, pub t_op: GPSTimeSec, // ^ Data Predict Time of Week pub sid: GnssSignal, @@ -2447,9 +2808,9 @@ pub struct MsgGroupDelay { } impl MsgGroupDelay { - pub const TYPE: u16 = 148; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgGroupDelay { + sender_id: None, t_op: GPSTimeSec::parse(_buf)?, sid: GnssSignal::parse(_buf)?, valid: _buf.read_u8()?, @@ -2459,6 +2820,17 @@ impl MsgGroupDelay { }) } } +impl super::SBPMessage for MsgGroupDelay { + const MSG_ID: u16 = 148; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} #[derive(Debug)] #[allow(non_snake_case)] @@ -2588,6 +2960,7 @@ impl AlmanacCommonContentDep { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAlmanacGPSDep { + pub sender_id: Option, pub common: AlmanacCommonContentDep, // ^ Values common for all almanac types pub m0: f64, @@ -2611,9 +2984,9 @@ pub struct MsgAlmanacGPSDep { } impl MsgAlmanacGPSDep { - pub const TYPE: u16 = 112; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAlmanacGPSDep { + sender_id: None, common: AlmanacCommonContentDep::parse(_buf)?, m0: _buf.read_f64::()?, ecc: _buf.read_f64::()?, @@ -2627,6 +3000,17 @@ impl MsgAlmanacGPSDep { }) } } +impl super::SBPMessage for MsgAlmanacGPSDep { + const MSG_ID: u16 = 112; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Satellite broadcast ephemeris for GPS // @@ -2638,6 +3022,7 @@ impl MsgAlmanacGPSDep { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAlmanacGPS { + pub sender_id: Option, pub common: AlmanacCommonContent, // ^ Values common for all almanac types pub m0: f64, @@ -2661,9 +3046,9 @@ pub struct MsgAlmanacGPS { } impl MsgAlmanacGPS { - pub const TYPE: u16 = 114; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAlmanacGPS { + sender_id: None, common: AlmanacCommonContent::parse(_buf)?, m0: _buf.read_f64::()?, ecc: _buf.read_f64::()?, @@ -2677,6 +3062,17 @@ impl MsgAlmanacGPS { }) } } +impl super::SBPMessage for MsgAlmanacGPS { + const MSG_ID: u16 = 114; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Satellite broadcast ephemeris for GLO // @@ -2688,6 +3084,7 @@ impl MsgAlmanacGPS { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAlmanacGloDep { + pub sender_id: Option, pub common: AlmanacCommonContentDep, // ^ Values common for all almanac types pub lambda_na: f64, @@ -2708,9 +3105,9 @@ pub struct MsgAlmanacGloDep { } impl MsgAlmanacGloDep { - pub const TYPE: u16 = 113; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAlmanacGloDep { + sender_id: None, common: AlmanacCommonContentDep::parse(_buf)?, lambda_na: _buf.read_f64::()?, t_lambda_na: _buf.read_f64::()?, @@ -2722,6 +3119,17 @@ impl MsgAlmanacGloDep { }) } } +impl super::SBPMessage for MsgAlmanacGloDep { + const MSG_ID: u16 = 113; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Satellite broadcast ephemeris for GLO // @@ -2733,6 +3141,7 @@ impl MsgAlmanacGloDep { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAlmanacGlo { + pub sender_id: Option, pub common: AlmanacCommonContent, // ^ Values common for all almanac types pub lambda_na: f64, @@ -2753,9 +3162,9 @@ pub struct MsgAlmanacGlo { } impl MsgAlmanacGlo { - pub const TYPE: u16 = 115; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAlmanacGlo { + sender_id: None, common: AlmanacCommonContent::parse(_buf)?, lambda_na: _buf.read_f64::()?, t_lambda_na: _buf.read_f64::()?, @@ -2767,6 +3176,17 @@ impl MsgAlmanacGlo { }) } } +impl super::SBPMessage for MsgAlmanacGlo { + const MSG_ID: u16 = 115; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // GLONASS L1/L2 Code-Phase biases // @@ -2778,6 +3198,7 @@ impl MsgAlmanacGlo { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgGloBiases { + pub sender_id: Option, pub mask: u8, // ^ GLONASS FDMA signals mask pub l1ca_bias: i16, @@ -2791,9 +3212,9 @@ pub struct MsgGloBiases { } impl MsgGloBiases { - pub const TYPE: u16 = 117; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgGloBiases { + sender_id: None, mask: _buf.read_u8()?, l1ca_bias: _buf.read_i16::()?, l1p_bias: _buf.read_i16::()?, @@ -2802,6 +3223,17 @@ impl MsgGloBiases { }) } } +impl super::SBPMessage for MsgGloBiases { + const MSG_ID: u16 = 117; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Satellite azimuth and elevation. // @@ -2854,18 +3286,30 @@ impl SvAzEl { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSvAzEl { + pub sender_id: Option, pub azel: Vec, // ^ Azimuth and elevation per satellite } impl MsgSvAzEl { - pub const TYPE: u16 = 151; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSvAzEl { + sender_id: None, azel: SvAzEl::parse_array(_buf)?, }) } } +impl super::SBPMessage for MsgSvAzEl { + const MSG_ID: u16 = 151; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // OSR corrections // @@ -2874,6 +3318,7 @@ impl MsgSvAzEl { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgOsr { + pub sender_id: Option, pub header: ObservationHeader, // ^ Header of a GPS observation message pub obs: Vec, @@ -2881,11 +3326,22 @@ pub struct MsgOsr { } impl MsgOsr { - pub const TYPE: u16 = 1600; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgOsr { + sender_id: None, header: ObservationHeader::parse(_buf)?, obs: PackedOsrContent::parse_array(_buf)?, }) } } +impl super::SBPMessage for MsgOsr { + const MSG_ID: u16 = 1600; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/orientation.rs b/rust/sbp/src/messages/orientation.rs index 7e14220d1a..472811d5cb 100644 --- a/rust/sbp/src/messages/orientation.rs +++ b/rust/sbp/src/messages/orientation.rs @@ -27,6 +27,7 @@ use self::byteorder::{LittleEndian, ReadBytesExt}; #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBaselineHeading { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub heading: u32, @@ -38,9 +39,9 @@ pub struct MsgBaselineHeading { } impl MsgBaselineHeading { - pub const TYPE: u16 = 527; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBaselineHeading { + sender_id: None, tow: _buf.read_u32::()?, heading: _buf.read_u32::()?, n_sats: _buf.read_u8()?, @@ -48,6 +49,17 @@ impl MsgBaselineHeading { }) } } +impl super::SBPMessage for MsgBaselineHeading { + const MSG_ID: u16 = 527; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Quaternion 4 component vector // @@ -60,6 +72,7 @@ impl MsgBaselineHeading { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgOrientQuat { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub w: i32, @@ -83,9 +96,9 @@ pub struct MsgOrientQuat { } impl MsgOrientQuat { - pub const TYPE: u16 = 544; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgOrientQuat { + sender_id: None, tow: _buf.read_u32::()?, w: _buf.read_i32::()?, x: _buf.read_i32::()?, @@ -99,6 +112,17 @@ impl MsgOrientQuat { }) } } +impl super::SBPMessage for MsgOrientQuat { + const MSG_ID: u16 = 544; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Euler angles // @@ -111,6 +135,7 @@ impl MsgOrientQuat { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgOrientEuler { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub roll: i32, @@ -130,9 +155,9 @@ pub struct MsgOrientEuler { } impl MsgOrientEuler { - pub const TYPE: u16 = 545; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgOrientEuler { + sender_id: None, tow: _buf.read_u32::()?, roll: _buf.read_i32::()?, pitch: _buf.read_i32::()?, @@ -144,6 +169,17 @@ impl MsgOrientEuler { }) } } +impl super::SBPMessage for MsgOrientEuler { + const MSG_ID: u16 = 545; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Vehicle Body Frame instantaneous angular rates // @@ -160,6 +196,7 @@ impl MsgOrientEuler { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAngularRate { + pub sender_id: Option, pub tow: u32, // ^ GPS Time of Week pub x: i32, @@ -173,9 +210,9 @@ pub struct MsgAngularRate { } impl MsgAngularRate { - pub const TYPE: u16 = 546; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAngularRate { + sender_id: None, tow: _buf.read_u32::()?, x: _buf.read_i32::()?, y: _buf.read_i32::()?, @@ -184,3 +221,14 @@ impl MsgAngularRate { }) } } +impl super::SBPMessage for MsgAngularRate { + const MSG_ID: u16 = 546; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/piksi.rs b/rust/sbp/src/messages/piksi.rs index c49e9e0707..41689e0c6f 100644 --- a/rust/sbp/src/messages/piksi.rs +++ b/rust/sbp/src/messages/piksi.rs @@ -27,12 +27,24 @@ use super::gnss::*; // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgAlmanac {} +pub struct MsgAlmanac { + pub sender_id: Option, +} impl MsgAlmanac { - pub const TYPE: u16 = 105; pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgAlmanac {}) + Ok(MsgAlmanac { sender_id: None }) + } +} +impl super::SBPMessage for MsgAlmanac { + const MSG_ID: u16 = 105; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); } } @@ -43,12 +55,24 @@ impl MsgAlmanac { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgSetTime {} +pub struct MsgSetTime { + pub sender_id: Option, +} impl MsgSetTime { - pub const TYPE: u16 = 104; pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSetTime {}) + Ok(MsgSetTime { sender_id: None }) + } +} +impl super::SBPMessage for MsgSetTime { + const MSG_ID: u16 = 104; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); } } @@ -60,18 +84,30 @@ impl MsgSetTime { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgReset { + pub sender_id: Option, pub flags: u32, // ^ Reset flags } impl MsgReset { - pub const TYPE: u16 = 182; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgReset { + sender_id: None, flags: _buf.read_u32::()?, }) } } +impl super::SBPMessage for MsgReset { + const MSG_ID: u16 = 182; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Reset the device (host => Piksi) // @@ -80,12 +116,24 @@ impl MsgReset { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgResetDep {} +pub struct MsgResetDep { + pub sender_id: Option, +} impl MsgResetDep { - pub const TYPE: u16 = 178; pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgResetDep {}) + Ok(MsgResetDep { sender_id: None }) + } +} +impl super::SBPMessage for MsgResetDep { + const MSG_ID: u16 = 178; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); } } @@ -97,12 +145,24 @@ impl MsgResetDep { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgCwResults {} +pub struct MsgCwResults { + pub sender_id: Option, +} impl MsgCwResults { - pub const TYPE: u16 = 192; pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgCwResults {}) + Ok(MsgCwResults { sender_id: None }) + } +} +impl super::SBPMessage for MsgCwResults { + const MSG_ID: u16 = 192; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); } } @@ -114,12 +174,24 @@ impl MsgCwResults { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgCwStart {} +pub struct MsgCwStart { + pub sender_id: Option, +} impl MsgCwStart { - pub const TYPE: u16 = 193; pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgCwStart {}) + Ok(MsgCwStart { sender_id: None }) + } +} +impl super::SBPMessage for MsgCwStart { + const MSG_ID: u16 = 193; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); } } @@ -131,18 +203,30 @@ impl MsgCwStart { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgResetFilters { + pub sender_id: Option, pub filter: u8, // ^ Filter flags } impl MsgResetFilters { - pub const TYPE: u16 = 34; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgResetFilters { + sender_id: None, filter: _buf.read_u8()?, }) } } +impl super::SBPMessage for MsgResetFilters { + const MSG_ID: u16 = 34; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -150,12 +234,24 @@ impl MsgResetFilters { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgInitBaseDep {} +pub struct MsgInitBaseDep { + pub sender_id: Option, +} impl MsgInitBaseDep { - pub const TYPE: u16 = 35; pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgInitBaseDep {}) + Ok(MsgInitBaseDep { sender_id: None }) + } +} +impl super::SBPMessage for MsgInitBaseDep { + const MSG_ID: u16 = 35; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); } } @@ -168,6 +264,7 @@ impl MsgInitBaseDep { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgThreadState { + pub sender_id: Option, pub name: String, // ^ Thread name (NULL terminated) pub cpu: u16, @@ -178,15 +275,26 @@ pub struct MsgThreadState { } impl MsgThreadState { - pub const TYPE: u16 = 23; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgThreadState { + sender_id: None, name: ::parser::read_string_limit(_buf, 20)?, cpu: _buf.read_u16::()?, stack_free: _buf.read_u32::()?, }) } } +impl super::SBPMessage for MsgThreadState { + const MSG_ID: u16 = 23; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // State of the UART channel // @@ -358,6 +466,7 @@ impl Latency { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgUartState { + pub sender_id: Option, pub uart_a: UARTChannel, // ^ State of UART A pub uart_b: UARTChannel, @@ -371,9 +480,9 @@ pub struct MsgUartState { } impl MsgUartState { - pub const TYPE: u16 = 29; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgUartState { + sender_id: None, uart_a: UARTChannel::parse(_buf)?, uart_b: UARTChannel::parse(_buf)?, uart_ftdi: UARTChannel::parse(_buf)?, @@ -382,6 +491,17 @@ impl MsgUartState { }) } } +impl super::SBPMessage for MsgUartState { + const MSG_ID: u16 = 29; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -390,6 +510,7 @@ impl MsgUartState { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgUartStateDepa { + pub sender_id: Option, pub uart_a: UARTChannel, // ^ State of UART A pub uart_b: UARTChannel, @@ -401,9 +522,9 @@ pub struct MsgUartStateDepa { } impl MsgUartStateDepa { - pub const TYPE: u16 = 24; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgUartStateDepa { + sender_id: None, uart_a: UARTChannel::parse(_buf)?, uart_b: UARTChannel::parse(_buf)?, uart_ftdi: UARTChannel::parse(_buf)?, @@ -411,6 +532,17 @@ impl MsgUartStateDepa { }) } } +impl super::SBPMessage for MsgUartStateDepa { + const MSG_ID: u16 = 24; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // State of the Integer Ambiguity Resolution (IAR) process // @@ -422,18 +554,30 @@ impl MsgUartStateDepa { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgIarState { + pub sender_id: Option, pub num_hyps: u32, // ^ Number of integer ambiguity hypotheses remaining } impl MsgIarState { - pub const TYPE: u16 = 25; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgIarState { + sender_id: None, num_hyps: _buf.read_u32::()?, }) } } +impl super::SBPMessage for MsgIarState { + const MSG_ID: u16 = 25; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Mask a satellite from use in Piksi subsystems // @@ -443,6 +587,7 @@ impl MsgIarState { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgMaskSatellite { + pub sender_id: Option, pub mask: u8, // ^ Mask of systems that should ignore this satellite. pub sid: GnssSignal, @@ -450,14 +595,25 @@ pub struct MsgMaskSatellite { } impl MsgMaskSatellite { - pub const TYPE: u16 = 43; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgMaskSatellite { + sender_id: None, mask: _buf.read_u8()?, sid: GnssSignal::parse(_buf)?, }) } } +impl super::SBPMessage for MsgMaskSatellite { + const MSG_ID: u16 = 43; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -466,6 +622,7 @@ impl MsgMaskSatellite { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgMaskSatelliteDep { + pub sender_id: Option, pub mask: u8, // ^ Mask of systems that should ignore this satellite. pub sid: GnssSignalDep, @@ -473,14 +630,25 @@ pub struct MsgMaskSatelliteDep { } impl MsgMaskSatelliteDep { - pub const TYPE: u16 = 27; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgMaskSatelliteDep { + sender_id: None, mask: _buf.read_u8()?, sid: GnssSignalDep::parse(_buf)?, }) } } +impl super::SBPMessage for MsgMaskSatelliteDep { + const MSG_ID: u16 = 27; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Device temperature and voltage levels // @@ -491,6 +659,7 @@ impl MsgMaskSatelliteDep { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgDeviceMonitor { + pub sender_id: Option, pub dev_vin: i16, // ^ Device V_in pub cpu_vint: i16, @@ -504,9 +673,9 @@ pub struct MsgDeviceMonitor { } impl MsgDeviceMonitor { - pub const TYPE: u16 = 181; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgDeviceMonitor { + sender_id: None, dev_vin: _buf.read_i16::()?, cpu_vint: _buf.read_i16::()?, cpu_vaux: _buf.read_i16::()?, @@ -515,6 +684,17 @@ impl MsgDeviceMonitor { }) } } +impl super::SBPMessage for MsgDeviceMonitor { + const MSG_ID: u16 = 181; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Execute a command (host => device) // @@ -525,6 +705,7 @@ impl MsgDeviceMonitor { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgCommandReq { + pub sender_id: Option, pub sequence: u32, // ^ Sequence number pub command: String, @@ -532,14 +713,25 @@ pub struct MsgCommandReq { } impl MsgCommandReq { - pub const TYPE: u16 = 184; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgCommandReq { + sender_id: None, sequence: _buf.read_u32::()?, command: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgCommandReq { + const MSG_ID: u16 = 184; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Exit code from executed command (device => host) // @@ -549,6 +741,7 @@ impl MsgCommandReq { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgCommandResp { + pub sender_id: Option, pub sequence: u32, // ^ Sequence number pub code: i32, @@ -556,14 +749,25 @@ pub struct MsgCommandResp { } impl MsgCommandResp { - pub const TYPE: u16 = 185; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgCommandResp { + sender_id: None, sequence: _buf.read_u32::()?, code: _buf.read_i32::()?, }) } } +impl super::SBPMessage for MsgCommandResp { + const MSG_ID: u16 = 185; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Command output // @@ -575,6 +779,7 @@ impl MsgCommandResp { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgCommandOutput { + pub sender_id: Option, pub sequence: u32, // ^ Sequence number pub line: String, @@ -582,14 +787,25 @@ pub struct MsgCommandOutput { } impl MsgCommandOutput { - pub const TYPE: u16 = 188; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgCommandOutput { + sender_id: None, sequence: _buf.read_u32::()?, line: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgCommandOutput { + const MSG_ID: u16 = 188; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Request state of Piksi network interfaces // @@ -598,12 +814,24 @@ impl MsgCommandOutput { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgNetworkStateReq {} +pub struct MsgNetworkStateReq { + pub sender_id: Option, +} impl MsgNetworkStateReq { - pub const TYPE: u16 = 186; pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgNetworkStateReq {}) + Ok(MsgNetworkStateReq { sender_id: None }) + } +} +impl super::SBPMessage for MsgNetworkStateReq { + const MSG_ID: u16 = 186; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); } } @@ -616,6 +844,7 @@ impl MsgNetworkStateReq { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgNetworkStateResp { + pub sender_id: Option, pub ipv4_address: Vec, // ^ IPv4 address (all zero when unavailable) pub ipv4_mask_size: u8, @@ -635,9 +864,9 @@ pub struct MsgNetworkStateResp { } impl MsgNetworkStateResp { - pub const TYPE: u16 = 187; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgNetworkStateResp { + sender_id: None, ipv4_address: ::parser::read_u8_array_limit(_buf, 4)?, ipv4_mask_size: _buf.read_u8()?, ipv6_address: ::parser::read_u8_array_limit(_buf, 16)?, @@ -649,6 +878,17 @@ impl MsgNetworkStateResp { }) } } +impl super::SBPMessage for MsgNetworkStateResp { + const MSG_ID: u16 = 187; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Bandwidth usage measurement for a single interface. // @@ -711,18 +951,30 @@ impl NetworkUsage { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgNetworkBandwidthUsage { + pub sender_id: Option, pub interfaces: Vec, // ^ Usage measurement array } impl MsgNetworkBandwidthUsage { - pub const TYPE: u16 = 189; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgNetworkBandwidthUsage { + sender_id: None, interfaces: NetworkUsage::parse_array(_buf)?, }) } } +impl super::SBPMessage for MsgNetworkBandwidthUsage { + const MSG_ID: u16 = 189; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Cell modem information update message // @@ -733,6 +985,7 @@ impl MsgNetworkBandwidthUsage { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgCellModemStatus { + pub sender_id: Option, pub signal_strength: i8, // ^ Received cell signal strength in dBm, zero translates to unknown pub signal_error_rate: f32, @@ -742,15 +995,26 @@ pub struct MsgCellModemStatus { } impl MsgCellModemStatus { - pub const TYPE: u16 = 190; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgCellModemStatus { + sender_id: None, signal_strength: _buf.read_i8()?, signal_error_rate: _buf.read_f32::()?, reserved: ::parser::read_u8_array(_buf)?, }) } } +impl super::SBPMessage for MsgCellModemStatus { + const MSG_ID: u16 = 190; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -759,6 +1023,7 @@ impl MsgCellModemStatus { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSpecanDep { + pub sender_id: Option, pub channel_tag: u16, // ^ Channel ID pub t: GPSTimeDep, @@ -776,9 +1041,9 @@ pub struct MsgSpecanDep { } impl MsgSpecanDep { - pub const TYPE: u16 = 80; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSpecanDep { + sender_id: None, channel_tag: _buf.read_u16::()?, t: GPSTimeDep::parse(_buf)?, freq_ref: _buf.read_f32::()?, @@ -789,6 +1054,17 @@ impl MsgSpecanDep { }) } } +impl super::SBPMessage for MsgSpecanDep { + const MSG_ID: u16 = 80; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Spectrum analyzer // @@ -797,6 +1073,7 @@ impl MsgSpecanDep { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSpecan { + pub sender_id: Option, pub channel_tag: u16, // ^ Channel ID pub t: GPSTime, @@ -814,9 +1091,9 @@ pub struct MsgSpecan { } impl MsgSpecan { - pub const TYPE: u16 = 81; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSpecan { + sender_id: None, channel_tag: _buf.read_u16::()?, t: GPSTime::parse(_buf)?, freq_ref: _buf.read_f32::()?, @@ -827,6 +1104,17 @@ impl MsgSpecan { }) } } +impl super::SBPMessage for MsgSpecan { + const MSG_ID: u16 = 81; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // RF AGC status // @@ -840,6 +1128,7 @@ impl MsgSpecan { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFrontEndGain { + pub sender_id: Option, pub rf_gain: Vec, // ^ RF gain for each frontend channel pub if_gain: Vec, @@ -847,11 +1136,22 @@ pub struct MsgFrontEndGain { } impl MsgFrontEndGain { - pub const TYPE: u16 = 191; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFrontEndGain { + sender_id: None, rf_gain: ::parser::read_s8_array_limit(_buf, 8)?, if_gain: ::parser::read_s8_array_limit(_buf, 8)?, }) } } +impl super::SBPMessage for MsgFrontEndGain { + const MSG_ID: u16 = 191; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/sbas.rs b/rust/sbp/src/messages/sbas.rs index aaad8df3de..f5689e9631 100644 --- a/rust/sbp/src/messages/sbas.rs +++ b/rust/sbp/src/messages/sbas.rs @@ -26,6 +26,7 @@ use super::gnss::*; #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSbasRaw { + pub sender_id: Option, pub sid: GnssSignal, // ^ GNSS signal identifier. pub tow: u32, @@ -37,9 +38,9 @@ pub struct MsgSbasRaw { } impl MsgSbasRaw { - pub const TYPE: u16 = 30583; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSbasRaw { + sender_id: None, sid: GnssSignal::parse(_buf)?, tow: _buf.read_u32::()?, message_type: _buf.read_u8()?, @@ -47,3 +48,14 @@ impl MsgSbasRaw { }) } } +impl super::SBPMessage for MsgSbasRaw { + const MSG_ID: u16 = 30583; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/settings.rs b/rust/sbp/src/messages/settings.rs index 4303c8df64..4f618631ef 100644 --- a/rust/sbp/src/messages/settings.rs +++ b/rust/sbp/src/messages/settings.rs @@ -49,12 +49,24 @@ use self::byteorder::{LittleEndian, ReadBytesExt}; // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgSettingsSave {} +pub struct MsgSettingsSave { + pub sender_id: Option, +} impl MsgSettingsSave { - pub const TYPE: u16 = 161; pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSettingsSave {}) + Ok(MsgSettingsSave { sender_id: None }) + } +} +impl super::SBPMessage for MsgSettingsSave { + const MSG_ID: u16 = 161; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); } } @@ -71,19 +83,31 @@ impl MsgSettingsSave { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsWrite { + pub sender_id: Option, pub setting: String, // ^ A NULL-terminated and NULL-delimited string with contents // "SECTION_SETTING\0SETTING\0VALUE\0" } impl MsgSettingsWrite { - pub const TYPE: u16 = 160; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsWrite { + sender_id: None, setting: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgSettingsWrite { + const MSG_ID: u16 = 160; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Acknowledgement with status of MSG_SETTINGS_WRITE // @@ -98,6 +122,7 @@ impl MsgSettingsWrite { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsWriteResp { + pub sender_id: Option, pub status: u8, // ^ Write status pub setting: String, @@ -106,14 +131,25 @@ pub struct MsgSettingsWriteResp { } impl MsgSettingsWriteResp { - pub const TYPE: u16 = 175; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsWriteResp { + sender_id: None, status: _buf.read_u8()?, setting: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgSettingsWriteResp { + const MSG_ID: u16 = 175; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Read device configuration settings (host => device) // @@ -129,19 +165,31 @@ impl MsgSettingsWriteResp { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsReadReq { + pub sender_id: Option, pub setting: String, // ^ A NULL-terminated and NULL-delimited string with contents // "SECTION_SETTING\0SETTING\0" } impl MsgSettingsReadReq { - pub const TYPE: u16 = 164; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsReadReq { + sender_id: None, setting: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgSettingsReadReq { + const MSG_ID: u16 = 164; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Read device configuration settings (host <= device) // @@ -156,19 +204,31 @@ impl MsgSettingsReadReq { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsReadResp { + pub sender_id: Option, pub setting: String, // ^ A NULL-terminated and NULL-delimited string with contents // "SECTION_SETTING\0SETTING\0VALUE\0" } impl MsgSettingsReadResp { - pub const TYPE: u16 = 165; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsReadResp { + sender_id: None, setting: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgSettingsReadResp { + const MSG_ID: u16 = 165; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Read setting by direct index (host => device) // @@ -179,19 +239,31 @@ impl MsgSettingsReadResp { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsReadByIndexReq { + pub sender_id: Option, pub index: u16, // ^ An index into the device settings, with values ranging from 0 to // length(settings) } impl MsgSettingsReadByIndexReq { - pub const TYPE: u16 = 162; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsReadByIndexReq { + sender_id: None, index: _buf.read_u16::()?, }) } } +impl super::SBPMessage for MsgSettingsReadByIndexReq { + const MSG_ID: u16 = 162; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Read setting by direct index (host <= device) // @@ -209,6 +281,7 @@ impl MsgSettingsReadByIndexReq { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsReadByIndexResp { + pub sender_id: Option, pub index: u16, // ^ An index into the device settings, with values ranging from 0 to // length(settings) @@ -218,14 +291,25 @@ pub struct MsgSettingsReadByIndexResp { } impl MsgSettingsReadByIndexResp { - pub const TYPE: u16 = 167; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsReadByIndexResp { + sender_id: None, index: _buf.read_u16::()?, setting: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgSettingsReadByIndexResp { + const MSG_ID: u16 = 167; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Finished reading settings (host <= device) // @@ -233,12 +317,24 @@ impl MsgSettingsReadByIndexResp { // #[derive(Debug)] #[allow(non_snake_case)] -pub struct MsgSettingsReadByIndexDone {} +pub struct MsgSettingsReadByIndexDone { + pub sender_id: Option, +} impl MsgSettingsReadByIndexDone { - pub const TYPE: u16 = 166; pub fn parse(_buf: &mut &[u8]) -> Result { - Ok(MsgSettingsReadByIndexDone {}) + Ok(MsgSettingsReadByIndexDone { sender_id: None }) + } +} +impl super::SBPMessage for MsgSettingsReadByIndexDone { + const MSG_ID: u16 = 166; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); } } @@ -251,19 +347,31 @@ impl MsgSettingsReadByIndexDone { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsRegister { + pub sender_id: Option, pub setting: String, // ^ A NULL-terminated and delimited string with contents // "SECTION_SETTING\0SETTING\0VALUE". } impl MsgSettingsRegister { - pub const TYPE: u16 = 174; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsRegister { + sender_id: None, setting: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgSettingsRegister { + const MSG_ID: u16 = 174; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Register setting and default value (device <= host) // @@ -275,6 +383,7 @@ impl MsgSettingsRegister { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsRegisterResp { + pub sender_id: Option, pub status: u8, // ^ Register status pub setting: String, @@ -284,11 +393,22 @@ pub struct MsgSettingsRegisterResp { } impl MsgSettingsRegisterResp { - pub const TYPE: u16 = 431; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsRegisterResp { + sender_id: None, status: _buf.read_u8()?, setting: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgSettingsRegisterResp { + const MSG_ID: u16 = 431; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/ssr.rs b/rust/sbp/src/messages/ssr.rs index fed2991140..79203defa1 100644 --- a/rust/sbp/src/messages/ssr.rs +++ b/rust/sbp/src/messages/ssr.rs @@ -451,6 +451,7 @@ impl GridDefinitionHeader { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSsrOrbitClock { + pub sender_id: Option, pub time: GPSTimeSec, // ^ GNSS reference time of the correction pub sid: GnssSignal, @@ -483,9 +484,9 @@ pub struct MsgSsrOrbitClock { } impl MsgSsrOrbitClock { - pub const TYPE: u16 = 1501; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSsrOrbitClock { + sender_id: None, time: GPSTimeSec::parse(_buf)?, sid: GnssSignal::parse(_buf)?, update_interval: _buf.read_u8()?, @@ -503,6 +504,17 @@ impl MsgSsrOrbitClock { }) } } +impl super::SBPMessage for MsgSsrOrbitClock { + const MSG_ID: u16 = 1501; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Precise orbit and clock correction // @@ -514,6 +526,7 @@ impl MsgSsrOrbitClock { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSsrOrbitClockDepA { + pub sender_id: Option, pub time: GPSTimeSec, // ^ GNSS reference time of the correction pub sid: GnssSignal, @@ -546,9 +559,9 @@ pub struct MsgSsrOrbitClockDepA { } impl MsgSsrOrbitClockDepA { - pub const TYPE: u16 = 1500; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSsrOrbitClockDepA { + sender_id: None, time: GPSTimeSec::parse(_buf)?, sid: GnssSignal::parse(_buf)?, update_interval: _buf.read_u8()?, @@ -566,6 +579,17 @@ impl MsgSsrOrbitClockDepA { }) } } +impl super::SBPMessage for MsgSsrOrbitClockDepA { + const MSG_ID: u16 = 1500; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Precise code biases correction // @@ -577,6 +601,7 @@ impl MsgSsrOrbitClockDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSsrCodeBiases { + pub sender_id: Option, pub time: GPSTimeSec, // ^ GNSS reference time of the correction pub sid: GnssSignal, @@ -591,9 +616,9 @@ pub struct MsgSsrCodeBiases { } impl MsgSsrCodeBiases { - pub const TYPE: u16 = 1505; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSsrCodeBiases { + sender_id: None, time: GPSTimeSec::parse(_buf)?, sid: GnssSignal::parse(_buf)?, update_interval: _buf.read_u8()?, @@ -602,6 +627,17 @@ impl MsgSsrCodeBiases { }) } } +impl super::SBPMessage for MsgSsrCodeBiases { + const MSG_ID: u16 = 1505; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Precise phase biases correction // @@ -615,6 +651,7 @@ impl MsgSsrCodeBiases { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSsrPhaseBiases { + pub sender_id: Option, pub time: GPSTimeSec, // ^ GNSS reference time of the correction pub sid: GnssSignal, @@ -637,9 +674,9 @@ pub struct MsgSsrPhaseBiases { } impl MsgSsrPhaseBiases { - pub const TYPE: u16 = 1510; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSsrPhaseBiases { + sender_id: None, time: GPSTimeSec::parse(_buf)?, sid: GnssSignal::parse(_buf)?, update_interval: _buf.read_u8()?, @@ -652,6 +689,17 @@ impl MsgSsrPhaseBiases { }) } } +impl super::SBPMessage for MsgSsrPhaseBiases { + const MSG_ID: u16 = 1510; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Slant Total Electron Content // @@ -663,6 +711,7 @@ impl MsgSsrPhaseBiases { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSsrStecCorrection { + pub sender_id: Option, pub header: STECHeader, // ^ Header of a STEC message pub stec_sat_list: Vec, @@ -670,14 +719,25 @@ pub struct MsgSsrStecCorrection { } impl MsgSsrStecCorrection { - pub const TYPE: u16 = 1515; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSsrStecCorrection { + sender_id: None, header: STECHeader::parse(_buf)?, stec_sat_list: STECSatElement::parse_array(_buf)?, }) } } +impl super::SBPMessage for MsgSsrStecCorrection { + const MSG_ID: u16 = 1515; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Gridded troposphere and STEC residuals // @@ -686,6 +746,7 @@ impl MsgSsrStecCorrection { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSsrGriddedCorrection { + pub sender_id: Option, pub header: GriddedCorrectionHeader, // ^ Header of a Gridded Correction message pub element: GridElement, @@ -693,14 +754,25 @@ pub struct MsgSsrGriddedCorrection { } impl MsgSsrGriddedCorrection { - pub const TYPE: u16 = 1520; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSsrGriddedCorrection { + sender_id: None, header: GriddedCorrectionHeader::parse(_buf)?, element: GridElement::parse(_buf)?, }) } } +impl super::SBPMessage for MsgSsrGriddedCorrection { + const MSG_ID: u16 = 1520; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // None // @@ -709,6 +781,7 @@ impl MsgSsrGriddedCorrection { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSsrGridDefinition { + pub sender_id: Option, pub header: GridDefinitionHeader, // ^ Header of a Gridded Correction message pub rle_list: Vec, @@ -719,11 +792,22 @@ pub struct MsgSsrGridDefinition { } impl MsgSsrGridDefinition { - pub const TYPE: u16 = 1525; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSsrGridDefinition { + sender_id: None, header: GridDefinitionHeader::parse(_buf)?, rle_list: ::parser::read_u8_array(_buf)?, }) } } +impl super::SBPMessage for MsgSsrGridDefinition { + const MSG_ID: u16 = 1525; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/system.rs b/rust/sbp/src/messages/system.rs index e667307aa5..418775b8a6 100644 --- a/rust/sbp/src/messages/system.rs +++ b/rust/sbp/src/messages/system.rs @@ -27,6 +27,7 @@ use self::byteorder::{LittleEndian, ReadBytesExt}; #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgStartup { + pub sender_id: Option, pub cause: u8, // ^ Cause of startup pub startup_type: u8, @@ -36,15 +37,26 @@ pub struct MsgStartup { } impl MsgStartup { - pub const TYPE: u16 = 65280; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgStartup { + sender_id: None, cause: _buf.read_u8()?, startup_type: _buf.read_u8()?, reserved: _buf.read_u16::()?, }) } } +impl super::SBPMessage for MsgStartup { + const MSG_ID: u16 = 65280; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Status of received corrections // @@ -55,6 +67,7 @@ impl MsgStartup { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgDgnssStatus { + pub sender_id: Option, pub flags: u8, // ^ Status flags pub latency: u16, @@ -66,9 +79,9 @@ pub struct MsgDgnssStatus { } impl MsgDgnssStatus { - pub const TYPE: u16 = 65282; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgDgnssStatus { + sender_id: None, flags: _buf.read_u8()?, latency: _buf.read_u16::()?, num_signals: _buf.read_u8()?, @@ -76,6 +89,17 @@ impl MsgDgnssStatus { }) } } +impl super::SBPMessage for MsgDgnssStatus { + const MSG_ID: u16 = 65282; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // System heartbeat message // @@ -93,18 +117,30 @@ impl MsgDgnssStatus { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgHeartbeat { + pub sender_id: Option, pub flags: u32, // ^ Status flags } impl MsgHeartbeat { - pub const TYPE: u16 = 65535; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgHeartbeat { + sender_id: None, flags: _buf.read_u32::()?, }) } } +impl super::SBPMessage for MsgHeartbeat { + const MSG_ID: u16 = 65535; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Inertial Navigation System status message // @@ -114,18 +150,30 @@ impl MsgHeartbeat { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgInsStatus { + pub sender_id: Option, pub flags: u32, // ^ Status flags } impl MsgInsStatus { - pub const TYPE: u16 = 65283; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgInsStatus { + sender_id: None, flags: _buf.read_u32::()?, }) } } +impl super::SBPMessage for MsgInsStatus { + const MSG_ID: u16 = 65283; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Experimental telemetry message // @@ -136,6 +184,7 @@ impl MsgInsStatus { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgCsacTelemetry { + pub sender_id: Option, pub id: u8, // ^ Index representing the type of telemetry in use. It is implemention // defined. @@ -144,14 +193,25 @@ pub struct MsgCsacTelemetry { } impl MsgCsacTelemetry { - pub const TYPE: u16 = 65284; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgCsacTelemetry { + sender_id: None, id: _buf.read_u8()?, telemetry: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgCsacTelemetry { + const MSG_ID: u16 = 65284; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Experimental telemetry message labels // @@ -162,6 +222,7 @@ impl MsgCsacTelemetry { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgCsacTelemetryLabels { + pub sender_id: Option, pub id: u8, // ^ Index representing the type of telemetry in use. It is implemention // defined. @@ -170,11 +231,22 @@ pub struct MsgCsacTelemetryLabels { } impl MsgCsacTelemetryLabels { - pub const TYPE: u16 = 65285; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgCsacTelemetryLabels { + sender_id: None, id: _buf.read_u8()?, telemetry_labels: ::parser::read_string(_buf)?, }) } } +impl super::SBPMessage for MsgCsacTelemetryLabels { + const MSG_ID: u16 = 65285; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/tracking.rs b/rust/sbp/src/messages/tracking.rs index 865c8cc859..8e17b9b2a6 100644 --- a/rust/sbp/src/messages/tracking.rs +++ b/rust/sbp/src/messages/tracking.rs @@ -26,6 +26,7 @@ use super::gnss::*; #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgTrackingStateDetailedDepA { + pub sender_id: Option, pub recv_time: u64, // ^ Receiver clock time. pub tot: GPSTime, @@ -77,9 +78,9 @@ pub struct MsgTrackingStateDetailedDepA { } impl MsgTrackingStateDetailedDepA { - pub const TYPE: u16 = 33; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgTrackingStateDetailedDepA { + sender_id: None, recv_time: _buf.read_u64::()?, tot: GPSTime::parse(_buf)?, P: _buf.read_u32::()?, @@ -104,6 +105,17 @@ impl MsgTrackingStateDetailedDepA { }) } } +impl super::SBPMessage for MsgTrackingStateDetailedDepA { + const MSG_ID: u16 = 33; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -112,6 +124,7 @@ impl MsgTrackingStateDetailedDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgTrackingStateDetailedDep { + pub sender_id: Option, pub recv_time: u64, // ^ Receiver clock time. pub tot: GPSTimeDep, @@ -163,9 +176,9 @@ pub struct MsgTrackingStateDetailedDep { } impl MsgTrackingStateDetailedDep { - pub const TYPE: u16 = 17; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgTrackingStateDetailedDep { + sender_id: None, recv_time: _buf.read_u64::()?, tot: GPSTimeDep::parse(_buf)?, P: _buf.read_u32::()?, @@ -190,6 +203,17 @@ impl MsgTrackingStateDetailedDep { }) } } +impl super::SBPMessage for MsgTrackingStateDetailedDep { + const MSG_ID: u16 = 17; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Signal tracking channel state // @@ -246,18 +270,30 @@ impl TrackingChannelState { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgTrackingState { + pub sender_id: Option, pub states: Vec, // ^ Signal tracking channel state } impl MsgTrackingState { - pub const TYPE: u16 = 65; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgTrackingState { + sender_id: None, states: TrackingChannelState::parse_array(_buf)?, }) } } +impl super::SBPMessage for MsgTrackingState { + const MSG_ID: u16 = 65; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Measurement Engine signal tracking channel state // @@ -313,18 +349,30 @@ impl MeasurementState { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgMeasurementState { + pub sender_id: Option, pub states: Vec, // ^ ME signal tracking channel state } impl MsgMeasurementState { - pub const TYPE: u16 = 97; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgMeasurementState { + sender_id: None, states: MeasurementState::parse_array(_buf)?, }) } } +impl super::SBPMessage for MsgMeasurementState { + const MSG_ID: u16 = 97; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Complex correlation structure // @@ -376,6 +424,7 @@ impl TrackingChannelCorrelation { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgTrackingIq { + pub sender_id: Option, pub channel: u8, // ^ Tracking channel of origin pub sid: GnssSignal, @@ -385,15 +434,26 @@ pub struct MsgTrackingIq { } impl MsgTrackingIq { - pub const TYPE: u16 = 45; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgTrackingIq { + sender_id: None, channel: _buf.read_u8()?, sid: GnssSignal::parse(_buf)?, corrs: TrackingChannelCorrelation::parse_array_limit(_buf, 3)?, }) } } +impl super::SBPMessage for MsgTrackingIq { + const MSG_ID: u16 = 45; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Complex correlation structure // @@ -447,6 +507,7 @@ impl TrackingChannelCorrelationDep { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgTrackingIqDepB { + pub sender_id: Option, pub channel: u8, // ^ Tracking channel of origin pub sid: GnssSignal, @@ -456,15 +517,26 @@ pub struct MsgTrackingIqDepB { } impl MsgTrackingIqDepB { - pub const TYPE: u16 = 44; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgTrackingIqDepB { + sender_id: None, channel: _buf.read_u8()?, sid: GnssSignal::parse(_buf)?, corrs: TrackingChannelCorrelationDep::parse_array_limit(_buf, 3)?, }) } } +impl super::SBPMessage for MsgTrackingIqDepB { + const MSG_ID: u16 = 44; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -473,6 +545,7 @@ impl MsgTrackingIqDepB { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgTrackingIqDepA { + pub sender_id: Option, pub channel: u8, // ^ Tracking channel of origin pub sid: GnssSignalDep, @@ -482,15 +555,26 @@ pub struct MsgTrackingIqDepA { } impl MsgTrackingIqDepA { - pub const TYPE: u16 = 28; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgTrackingIqDepA { + sender_id: None, channel: _buf.read_u8()?, sid: GnssSignalDep::parse(_buf)?, corrs: TrackingChannelCorrelationDep::parse_array_limit(_buf, 3)?, }) } } +impl super::SBPMessage for MsgTrackingIqDepA { + const MSG_ID: u16 = 28; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated // @@ -544,18 +628,30 @@ impl TrackingChannelStateDepA { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgTrackingStateDepA { + pub sender_id: Option, pub states: Vec, // ^ Satellite tracking channel state } impl MsgTrackingStateDepA { - pub const TYPE: u16 = 22; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgTrackingStateDepA { + sender_id: None, states: TrackingChannelStateDepA::parse_array(_buf)?, }) } } +impl super::SBPMessage for MsgTrackingStateDepA { + const MSG_ID: u16 = 22; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} // Deprecated. // @@ -609,15 +705,27 @@ impl TrackingChannelStateDepB { #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgTrackingStateDepB { + pub sender_id: Option, pub states: Vec, // ^ Signal tracking channel state } impl MsgTrackingStateDepB { - pub const TYPE: u16 = 19; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgTrackingStateDepB { + sender_id: None, states: TrackingChannelStateDepB::parse_array(_buf)?, }) } } +impl super::SBPMessage for MsgTrackingStateDepB { + const MSG_ID: u16 = 19; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/user.rs b/rust/sbp/src/messages/user.rs index 58559560d0..cd47f0f499 100644 --- a/rust/sbp/src/messages/user.rs +++ b/rust/sbp/src/messages/user.rs @@ -25,15 +25,27 @@ use self::byteorder::{LittleEndian, ReadBytesExt}; #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgUserData { + pub sender_id: Option, pub contents: Vec, // ^ User data payload } impl MsgUserData { - pub const TYPE: u16 = 2048; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgUserData { + sender_id: None, contents: ::parser::read_u8_array(_buf)?, }) } } +impl super::SBPMessage for MsgUserData { + const MSG_ID: u16 = 2048; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} diff --git a/rust/sbp/src/messages/vehicle.rs b/rust/sbp/src/messages/vehicle.rs index 4cc4cf2b84..c99217c205 100644 --- a/rust/sbp/src/messages/vehicle.rs +++ b/rust/sbp/src/messages/vehicle.rs @@ -28,6 +28,7 @@ use self::byteorder::{LittleEndian, ReadBytesExt}; #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgOdometry { + pub sender_id: Option, pub tow: u32, // ^ Time field representing either milliseconds in the GPS Week or local CPU // time from the producing system in milliseconds. See the tow_source flag @@ -39,12 +40,23 @@ pub struct MsgOdometry { } impl MsgOdometry { - pub const TYPE: u16 = 2307; pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgOdometry { + sender_id: None, tow: _buf.read_u32::()?, velocity: _buf.read_i32::()?, flags: _buf.read_u8()?, }) } } +impl super::SBPMessage for MsgOdometry { + const MSG_ID: u16 = 2307; + + fn get_sender_id(&self) -> Option { + self.sender_id + } + + fn set_sender_id(&mut self, new_id: u16) { + self.sender_id = Some(new_id); + } +} From c5d35575f1d6886d026a442a725d5272e8c58100 Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Wed, 17 Jul 2019 16:50:26 -0700 Subject: [PATCH 15/25] Fixed up the travis config --- .travis.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4e61a5f7e9..8f1fe6e03f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,12 +13,6 @@ addons: - lcov - gradle - libgmp-dev - - oracle-java8-installer - - oracle-java8-set-default - - cargo - -env: - - JAVA_HOME=/usr/lib/jvm/java-8-oracle cache: apt: true From 57ac74f996145ce9acf5d86b4fe541bb43f6043c Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Thu, 18 Jul 2019 11:33:31 -0700 Subject: [PATCH 16/25] Fixed tests --- rust/sbp/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rust/sbp/src/lib.rs b/rust/sbp/src/lib.rs index 70906c04d9..1cca8a067a 100644 --- a/rust/sbp/src/lib.rs +++ b/rust/sbp/src/lib.rs @@ -18,6 +18,7 @@ mod tests { 0x09, 0x00, 0x00, 0x00, 0x0e, 0x00, ]; let baseline_ecef_expectation = ::messages::navigation::MsgBaselineECEF { + sender_id: Some(1234), accuracy: 0, flags: 0, n_sats: 14, @@ -26,9 +27,10 @@ mod tests { y: 1327294, z: 631798, }; - let sbp_result = ::messages::SBP::parse(0x20b, &mut &baseline_ecef_payload[..]); + let sbp_result = ::messages::SBP::parse(0x20b, 1234,&mut &baseline_ecef_payload[..]); assert!(sbp_result.is_ok()); if let ::messages::SBP::MsgBaselineECEF(msg) = sbp_result.unwrap() { + assert_eq!(msg.sender_id, baseline_ecef_expectation.sender_id); assert_eq!(msg.accuracy, baseline_ecef_expectation.accuracy); assert_eq!(msg.flags, baseline_ecef_expectation.flags); assert_eq!(msg.n_sats, baseline_ecef_expectation.n_sats); @@ -48,6 +50,7 @@ mod tests { 0xbe, 0x40, 0x14, 0x00, 0xf6, 0xa3, 0x09, 0x00, 0x00, 0x00, 0x0e, 0x00, 0xdb, 0xbf, ]; let baseline_ecef_expectation = ::messages::navigation::MsgBaselineECEF { + sender_id: Some(0x88d3), accuracy: 0, flags: 0, n_sats: 14, @@ -59,6 +62,7 @@ mod tests { let (sbp_result, _remaining_data) = ::parser::frame(&packet[..]); assert!(sbp_result.is_ok()); if let ::messages::SBP::MsgBaselineECEF(msg) = sbp_result.unwrap() { + assert_eq!(msg.sender_id, baseline_ecef_expectation.sender_id); assert_eq!(msg.accuracy, baseline_ecef_expectation.accuracy); assert_eq!(msg.flags, baseline_ecef_expectation.flags); assert_eq!(msg.n_sats, baseline_ecef_expectation.n_sats); @@ -80,6 +84,7 @@ mod tests { ]; let mut reader = std::io::Cursor::new(packet); let baseline_ecef_expectation = ::messages::navigation::MsgBaselineECEF { + sender_id: Some(0x88d3), accuracy: 0, flags: 0, n_sats: 14, @@ -93,6 +98,7 @@ mod tests { let sbp_result = parser.parse(&mut reader); assert!(sbp_result.is_ok()); if let ::messages::SBP::MsgBaselineECEF(msg) = sbp_result.unwrap() { + assert_eq!(msg.sender_id, baseline_ecef_expectation.sender_id); assert_eq!(msg.accuracy, baseline_ecef_expectation.accuracy); assert_eq!(msg.flags, baseline_ecef_expectation.flags); assert_eq!(msg.n_sats, baseline_ecef_expectation.n_sats); From f2b58d5078fee0789416d98b8d16a0443b86c95b Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Thu, 18 Jul 2019 08:55:35 -0700 Subject: [PATCH 17/25] Added rust build to the travis config Removed generating before testing for rust --- .travis.yml | 6 ++++++ Makefile | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8f1fe6e03f..008126ec4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -75,6 +75,12 @@ matrix: - make test-c after_success: bash <(curl -s https://codecov.io/bash) -s c/build || echo "Codecov did not collect coverage reports"; + - env: + language: rust + rust: + - stable + script: + - make test-rust deploy: provider: releases diff --git a/Makefile b/Makefile index 55fc2c10b2..301468815e 100644 --- a/Makefile +++ b/Makefile @@ -260,7 +260,7 @@ test-haskell: cd $(SWIFTNAV_ROOT)/haskell/ && stack build --test --allow-different-user $(call announce-end,"Finished running Haskell tests") -test-rust: rust +test-rust: $(call announce-begin,"Running Rust tests") cd $(SWIFTNAV_ROOT)/rust/sbp && cargo test $(call announce-end,"Finished running Rust tests") From 8aa3570569ca5e8486c93ece66744a342f272fb0 Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Thu, 18 Jul 2019 11:41:55 -0700 Subject: [PATCH 18/25] Enabled verbose tests --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 301468815e..bf2e612d2a 100644 --- a/Makefile +++ b/Makefile @@ -262,7 +262,7 @@ test-haskell: test-rust: $(call announce-begin,"Running Rust tests") - cd $(SWIFTNAV_ROOT)/rust/sbp && cargo test + cd $(SWIFTNAV_ROOT)/rust/sbp && cargo test --verbose $(call announce-end,"Finished running Rust tests") test-protobuf: From f36cbc2681d09fc3ab242df4b519e79e63cbd3ae Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Mon, 22 Jul 2019 08:30:30 -0700 Subject: [PATCH 19/25] Changed rust generator to make doc comments --- .../sbpg/targets/resources/sbp_messages_template.rs | 13 +++++++------ generator/sbpg/targets/rust.py | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/generator/sbpg/targets/resources/sbp_messages_template.rs b/generator/sbpg/targets/resources/sbp_messages_template.rs index 2634ccf421..9e781f8270 100644 --- a/generator/sbpg/targets/resources/sbp_messages_template.rs +++ b/generator/sbpg/targets/resources/sbp_messages_template.rs @@ -14,6 +14,7 @@ //****************************************************************************/ (((description|commentify))) + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian,ReadBytesExt}; @@ -24,10 +25,10 @@ use super::(((i)))::*; ((* for m in msgs *)) ((*- if m.desc *)) -// (((m.short_desc))) -// +/// (((m.short_desc))) +/// (((m.desc|commentify))) -// +/// ((*- endif *)) #[derive(Debug)] #[allow(non_snake_case)] @@ -36,10 +37,10 @@ pub struct (((m.identifier|camel_case))) { pub sender_id: Option, ((*- endif *)) ((*- for f in m.fields *)) + ((*- if f.desc *)) + /// (((f.desc | replace("\n", " ") | wordwrap(width=72, wrapstring="\n /// ")))) + ((*- endif *)) pub (((f.identifier))): (((f|type_map))), - ((*- if f.desc *)) - // ^ (((f.desc | replace("\n", " ") | wordwrap(width=72, wrapstring="\n // ")))) - ((*- endif *)) ((*- endfor *)) } diff --git a/generator/sbpg/targets/rust.py b/generator/sbpg/targets/rust.py index 05a3d6a28f..11acb1877b 100644 --- a/generator/sbpg/targets/rust.py +++ b/generator/sbpg/targets/rust.py @@ -36,9 +36,9 @@ def commentify(value): if value is None: return if len(value.split('\n')) == 1: - return "// " + value + return "/// " + value else: - return '\n'.join(['// ' + l for l in value.split('\n')[:-1]]) + return '\n'.join(['/// ' + l for l in value.split('\n')[:-1]]) TYPE_MAP = {'u8': 'u8', 'u16': 'u16', From 69d06346e0fb63872a4e23db0da1859b6d7547a5 Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Mon, 22 Jul 2019 08:31:12 -0700 Subject: [PATCH 20/25] Regenerated all of the rust code --- rust/sbp/src/messages/acquisition.rs | 170 +-- rust/sbp/src/messages/bootload.rs | 100 +- rust/sbp/src/messages/ext_events.rs | 26 +- rust/sbp/src/messages/file_io.rs | 222 ++-- rust/sbp/src/messages/flash.rs | 190 +-- rust/sbp/src/messages/gnss.rs | 120 +- rust/sbp/src/messages/imu.rs | 52 +- rust/sbp/src/messages/linux.rs | 184 +-- rust/sbp/src/messages/logging.rs | 54 +- rust/sbp/src/messages/mag.rs | 22 +- rust/sbp/src/messages/mod.rs | 1254 +++++++++---------- rust/sbp/src/messages/navigation.rs | 840 ++++++------- rust/sbp/src/messages/ndb.rs | 40 +- rust/sbp/src/messages/observation.rs | 1734 +++++++++++++------------- rust/sbp/src/messages/orientation.rs | 126 +- rust/sbp/src/messages/piksi.rs | 508 ++++---- rust/sbp/src/messages/sbas.rs | 20 +- rust/sbp/src/messages/settings.rs | 258 ++-- rust/sbp/src/messages/ssr.rs | 395 +++--- rust/sbp/src/messages/system.rs | 118 +- rust/sbp/src/messages/tracking.rs | 312 ++--- rust/sbp/src/messages/user.rs | 14 +- rust/sbp/src/messages/vehicle.rs | 28 +- 23 files changed, 3399 insertions(+), 3388 deletions(-) diff --git a/rust/sbp/src/messages/acquisition.rs b/rust/sbp/src/messages/acquisition.rs index 1c84f47fa2..f144ce86b6 100644 --- a/rust/sbp/src/messages/acquisition.rs +++ b/rust/sbp/src/messages/acquisition.rs @@ -12,32 +12,32 @@ // Automatically generated from yaml/swiftnav/sbp/acquisition.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Satellite acquisition messages from the device. +/// Satellite acquisition messages from the device. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; use super::gnss::*; -// Satellite acquisition result -// -// This message describes the results from an attempted GPS signal -// acquisition search for a satellite PRN over a code phase/carrier -// frequency range. It contains the parameters of the point in the -// acquisition search space with the best carrier-to-noise (CN/0) -// ratio. -// +/// Satellite acquisition result +/// +/// This message describes the results from an attempted GPS signal +/// acquisition search for a satellite PRN over a code phase/carrier +/// frequency range. It contains the parameters of the point in the +/// acquisition search space with the best carrier-to-noise (CN/0) +/// ratio. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAcqResult { pub sender_id: Option, + /// CN/0 of best point pub cn0: f32, - // ^ CN/0 of best point + /// Code phase of best point pub cp: f32, - // ^ Code phase of best point + /// Carrier frequency of best point pub cf: f32, - // ^ Carrier frequency of best point + /// GNSS signal for which acquisition was attempted pub sid: GnssSignal, - // ^ GNSS signal for which acquisition was attempted } impl MsgAcqResult { @@ -63,22 +63,22 @@ impl super::SBPMessage for MsgAcqResult { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAcqResultDepC { pub sender_id: Option, + /// CN/0 of best point pub cn0: f32, - // ^ CN/0 of best point + /// Code phase of best point pub cp: f32, - // ^ Code phase of best point + /// Carrier frequency of best point pub cf: f32, - // ^ Carrier frequency of best point + /// GNSS signal for which acquisition was attempted pub sid: GnssSignalDep, - // ^ GNSS signal for which acquisition was attempted } impl MsgAcqResultDepC { @@ -104,23 +104,23 @@ impl super::SBPMessage for MsgAcqResultDepC { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAcqResultDepB { pub sender_id: Option, + /// SNR of best point. Currently in arbitrary SNR points, but will be in + /// units of dB Hz in a later revision of this message. pub snr: f32, - // ^ SNR of best point. Currently in arbitrary SNR points, but will be in - // units of dB Hz in a later revision of this message. + /// Code phase of best point pub cp: f32, - // ^ Code phase of best point + /// Carrier frequency of best point pub cf: f32, - // ^ Carrier frequency of best point + /// GNSS signal for which acquisition was attempted pub sid: GnssSignalDep, - // ^ GNSS signal for which acquisition was attempted } impl MsgAcqResultDepB { @@ -146,24 +146,24 @@ impl super::SBPMessage for MsgAcqResultDepB { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAcqResultDepA { pub sender_id: Option, + /// SNR of best point. Currently dimensonless, but will have units of dB Hz + /// in the revision of this message. pub snr: f32, - // ^ SNR of best point. Currently dimensonless, but will have units of dB Hz - // in the revision of this message. + /// Code phase of best point pub cp: f32, - // ^ Code phase of best point + /// Carrier frequency of best point pub cf: f32, - // ^ Carrier frequency of best point + /// PRN-1 identifier of the satellite signal for which acquisition was + /// attempted pub prn: u8, - // ^ PRN-1 identifier of the satellite signal for which acquisition was - // attempted } impl MsgAcqResultDepA { @@ -189,39 +189,39 @@ impl super::SBPMessage for MsgAcqResultDepA { } } -// Acq perfomance measurement and debug -// -// Profile for a specific SV for debugging purposes -// The message describes SV profile during acquisition time. -// The message is used to debug and measure the performance. -// +/// Acq perfomance measurement and debug +/// +/// Profile for a specific SV for debugging purposes +/// The message describes SV profile during acquisition time. +/// The message is used to debug and measure the performance. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct AcqSvProfile { + /// SV search job type (deep, fallback, etc) pub job_type: u8, - // ^ SV search job type (deep, fallback, etc) + /// Acquisition status 1 is Success, 0 is Failure pub status: u8, - // ^ Acquisition status 1 is Success, 0 is Failure + /// CN0 value. Only valid if status is '1' pub cn0: u16, - // ^ CN0 value. Only valid if status is '1' + /// Acquisition integration time pub int_time: u8, - // ^ Acquisition integration time + /// GNSS signal for which acquisition was attempted pub sid: GnssSignal, - // ^ GNSS signal for which acquisition was attempted + /// Acq frequency bin width pub bin_width: u16, - // ^ Acq frequency bin width + /// Timestamp of the job complete event pub timestamp: u32, - // ^ Timestamp of the job complete event + /// Time spent to search for sid.code pub time_spent: u32, - // ^ Time spent to search for sid.code + /// Doppler range lowest frequency pub cf_min: i32, - // ^ Doppler range lowest frequency + /// Doppler range highest frequency pub cf_max: i32, - // ^ Doppler range highest frequency + /// Doppler value of detected peak. Only valid if status is '1' pub cf: i32, - // ^ Doppler value of detected peak. Only valid if status is '1' + /// Codephase of detected peak. Only valid if status is '1' pub cp: u32, - // ^ Codephase of detected peak. Only valid if status is '1' } impl AcqSvProfile { @@ -261,37 +261,37 @@ impl AcqSvProfile { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct AcqSvProfileDep { + /// SV search job type (deep, fallback, etc) pub job_type: u8, - // ^ SV search job type (deep, fallback, etc) + /// Acquisition status 1 is Success, 0 is Failure pub status: u8, - // ^ Acquisition status 1 is Success, 0 is Failure + /// CN0 value. Only valid if status is '1' pub cn0: u16, - // ^ CN0 value. Only valid if status is '1' + /// Acquisition integration time pub int_time: u8, - // ^ Acquisition integration time + /// GNSS signal for which acquisition was attempted pub sid: GnssSignalDep, - // ^ GNSS signal for which acquisition was attempted + /// Acq frequency bin width pub bin_width: u16, - // ^ Acq frequency bin width + /// Timestamp of the job complete event pub timestamp: u32, - // ^ Timestamp of the job complete event + /// Time spent to search for sid.code pub time_spent: u32, - // ^ Time spent to search for sid.code + /// Doppler range lowest frequency pub cf_min: i32, - // ^ Doppler range lowest frequency + /// Doppler range highest frequency pub cf_max: i32, - // ^ Doppler range highest frequency + /// Doppler value of detected peak. Only valid if status is '1' pub cf: i32, - // ^ Doppler value of detected peak. Only valid if status is '1' + /// Codephase of detected peak. Only valid if status is '1' pub cp: u32, - // ^ Codephase of detected peak. Only valid if status is '1' } impl AcqSvProfileDep { @@ -331,17 +331,17 @@ impl AcqSvProfileDep { } } -// Acquisition perfomance measurement and debug -// -// The message describes all SV profiles during acquisition time. -// The message is used to debug and measure the performance. -// +/// Acquisition perfomance measurement and debug +/// +/// The message describes all SV profiles during acquisition time. +/// The message is used to debug and measure the performance. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAcqSvProfile { pub sender_id: Option, + /// SV profiles during acquisition time pub acq_sv_profile: Vec, - // ^ SV profiles during acquisition time } impl MsgAcqSvProfile { @@ -364,16 +364,16 @@ impl super::SBPMessage for MsgAcqSvProfile { } } -// Deprecated. -// -// Deprecated. -// +/// Deprecated. +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAcqSvProfileDep { pub sender_id: Option, + /// SV profiles during acquisition time pub acq_sv_profile: Vec, - // ^ SV profiles during acquisition time } impl MsgAcqSvProfileDep { diff --git a/rust/sbp/src/messages/bootload.rs b/rust/sbp/src/messages/bootload.rs index 0f5fb8aa63..1b2eaa9f53 100644 --- a/rust/sbp/src/messages/bootload.rs +++ b/rust/sbp/src/messages/bootload.rs @@ -12,21 +12,21 @@ // Automatically generated from yaml/swiftnav/sbp/bootload.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Messages for the bootloading configuration of a Piksi 2.3.1. This message -// group does not apply to Piksi Multi. -// -// Note that some of these messages share the same message type ID for both the -// host request and the device response. +/// Messages for the bootloading configuration of a Piksi 2.3.1. This message +/// group does not apply to Piksi Multi. +/// +/// Note that some of these messages share the same message type ID for both the +/// host request and the device response. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; -// Bootloading handshake request (host => device) -// -// The handshake message request from the host establishes a -// handshake between the device bootloader and the host. The -// response from the device is MSG_BOOTLOADER_HANDSHAKE_RESP. -// +/// Bootloading handshake request (host => device) +/// +/// The handshake message request from the host establishes a +/// handshake between the device bootloader and the host. The +/// response from the device is MSG_BOOTLOADER_HANDSHAKE_RESP. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBootloaderHandshakeReq { @@ -50,22 +50,22 @@ impl super::SBPMessage for MsgBootloaderHandshakeReq { } } -// Bootloading handshake response (host <= device) -// -// The handshake message response from the device establishes a -// handshake between the device bootloader and the host. The -// request from the host is MSG_BOOTLOADER_HANDSHAKE_REQ. The -// payload contains the bootloader version number and the SBP -// protocol version number. -// +/// Bootloading handshake response (host <= device) +/// +/// The handshake message response from the device establishes a +/// handshake between the device bootloader and the host. The +/// request from the host is MSG_BOOTLOADER_HANDSHAKE_REQ. The +/// payload contains the bootloader version number and the SBP +/// protocol version number. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBootloaderHandshakeResp { pub sender_id: Option, + /// Bootloader flags pub flags: u32, - // ^ Bootloader flags + /// Bootloader version number pub version: String, - // ^ Bootloader version number } impl MsgBootloaderHandshakeResp { @@ -89,16 +89,16 @@ impl super::SBPMessage for MsgBootloaderHandshakeResp { } } -// Bootloader jump to application (host => device) -// -// The host initiates the bootloader to jump to the application. -// +/// Bootloader jump to application (host => device) +/// +/// The host initiates the bootloader to jump to the application. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBootloaderJumpToApp { pub sender_id: Option, + /// Ignored by the device pub jump: u8, - // ^ Ignored by the device } impl MsgBootloaderJumpToApp { @@ -121,15 +121,15 @@ impl super::SBPMessage for MsgBootloaderJumpToApp { } } -// Read FPGA device ID over UART request (host => device) -// -// The device message from the host reads a unique device -// identifier from the SwiftNAP, an FPGA. The host requests the ID -// by sending a MSG_NAP_DEVICE_DNA_REQ message. The device -// responds with a MSG_NAP_DEVICE_DNA_RESP message with the -// device ID in the payload. Note that this ID is tied to the FPGA, -// and not related to the Piksi's serial number. -// +/// Read FPGA device ID over UART request (host => device) +/// +/// The device message from the host reads a unique device +/// identifier from the SwiftNAP, an FPGA. The host requests the ID +/// by sending a MSG_NAP_DEVICE_DNA_REQ message. The device +/// responds with a MSG_NAP_DEVICE_DNA_RESP message with the +/// device ID in the payload. Note that this ID is tied to the FPGA, +/// and not related to the Piksi's serial number. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgNapDeviceDnaReq { @@ -153,21 +153,21 @@ impl super::SBPMessage for MsgNapDeviceDnaReq { } } -// Read FPGA device ID over UART response (host <= device) -// -// The device message from the host reads a unique device -// identifier from the SwiftNAP, an FPGA. The host requests the ID -// by sending a MSG_NAP_DEVICE_DNA_REQ message. The device -// responds with a MSG_NAP_DEVICE_DNA_RESP messagage with the -// device ID in the payload. Note that this ID is tied to the FPGA, -// and not related to the Piksi's serial number. -// +/// Read FPGA device ID over UART response (host <= device) +/// +/// The device message from the host reads a unique device +/// identifier from the SwiftNAP, an FPGA. The host requests the ID +/// by sending a MSG_NAP_DEVICE_DNA_REQ message. The device +/// responds with a MSG_NAP_DEVICE_DNA_RESP messagage with the +/// device ID in the payload. Note that this ID is tied to the FPGA, +/// and not related to the Piksi's serial number. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgNapDeviceDnaResp { pub sender_id: Option, + /// 57-bit SwiftNAP FPGA Device ID. Remaining bits are padded on the right. pub dna: Vec, - // ^ 57-bit SwiftNAP FPGA Device ID. Remaining bits are padded on the right. } impl MsgNapDeviceDnaResp { @@ -190,16 +190,16 @@ impl super::SBPMessage for MsgNapDeviceDnaResp { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBootloaderHandshakeDepA { pub sender_id: Option, + /// Version number string (not NULL terminated) pub handshake: Vec, - // ^ Version number string (not NULL terminated) } impl MsgBootloaderHandshakeDepA { diff --git a/rust/sbp/src/messages/ext_events.rs b/rust/sbp/src/messages/ext_events.rs index bb5a002ec0..2a32a82e45 100644 --- a/rust/sbp/src/messages/ext_events.rs +++ b/rust/sbp/src/messages/ext_events.rs @@ -12,32 +12,32 @@ // Automatically generated from yaml/swiftnav/sbp/ext_events.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Messages reporting accurately-timestamped external events, -// e.g. camera shutter time. +/// Messages reporting accurately-timestamped external events, +/// e.g. camera shutter time. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; -// Reports timestamped external pin event -// -// Reports detection of an external event, the GPS time it occurred, -// which pin it was and whether it was rising or falling. -// +/// Reports timestamped external pin event +/// +/// Reports detection of an external event, the GPS time it occurred, +/// which pin it was and whether it was rising or falling. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgExtEvent { pub sender_id: Option, + /// GPS week number pub wn: u16, - // ^ GPS week number + /// GPS time of week rounded to the nearest millisecond pub tow: u32, - // ^ GPS time of week rounded to the nearest millisecond + /// Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to + /// 500000) pub ns_residual: i32, - // ^ Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to - // 500000) + /// Flags pub flags: u8, - // ^ Flags + /// Pin number. 0..9 = DEBUG0..9. pub pin: u8, - // ^ Pin number. 0..9 = DEBUG0..9. } impl MsgExtEvent { diff --git a/rust/sbp/src/messages/file_io.rs b/rust/sbp/src/messages/file_io.rs index d064c4cde7..a3dcbed75a 100644 --- a/rust/sbp/src/messages/file_io.rs +++ b/rust/sbp/src/messages/file_io.rs @@ -12,41 +12,41 @@ // Automatically generated from yaml/swiftnav/sbp/file_io.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Messages for using device's onboard flash filesystem -// functionality. This allows data to be stored persistently in the -// device's program flash with wear-levelling using a simple filesystem -// interface. The file system interface (CFS) defines an abstract API -// for reading directories and for reading and writing files. -// -// Note that some of these messages share the same message type ID for both the -// host request and the device response. +/// Messages for using device's onboard flash filesystem +/// functionality. This allows data to be stored persistently in the +/// device's program flash with wear-levelling using a simple filesystem +/// interface. The file system interface (CFS) defines an abstract API +/// for reading directories and for reading and writing files. +/// +/// Note that some of these messages share the same message type ID for both the +/// host request and the device response. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; -// Read file from the file system (host => device) -// -// The file read message reads a certain length (up to 255 bytes) -// from a given offset into a file, and returns the data in a -// MSG_FILEIO_READ_RESP message where the message length field -// indicates how many bytes were succesfully read.The sequence -// number in the request will be returned in the response. -// If the message is invalid, a followup MSG_PRINT message will -// print "Invalid fileio read message". A device will only respond -// to this message when it is received from sender ID 0x42. -// +/// Read file from the file system (host => device) +/// +/// The file read message reads a certain length (up to 255 bytes) +/// from a given offset into a file, and returns the data in a +/// MSG_FILEIO_READ_RESP message where the message length field +/// indicates how many bytes were succesfully read.The sequence +/// number in the request will be returned in the response. +/// If the message is invalid, a followup MSG_PRINT message will +/// print "Invalid fileio read message". A device will only respond +/// to this message when it is received from sender ID 0x42. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioReadReq { pub sender_id: Option, + /// Read sequence number pub sequence: u32, - // ^ Read sequence number + /// File offset pub offset: u32, - // ^ File offset + /// Chunk size to read pub chunk_size: u8, - // ^ Chunk size to read + /// Name of the file to read from pub filename: String, - // ^ Name of the file to read from } impl MsgFileioReadReq { @@ -72,22 +72,22 @@ impl super::SBPMessage for MsgFileioReadReq { } } -// File read from the file system (host <= device) -// -// The file read message reads a certain length (up to 255 bytes) -// from a given offset into a file, and returns the data in a -// message where the message length field indicates how many bytes -// were succesfully read. The sequence number in the response is -// preserved from the request. -// +/// File read from the file system (host <= device) +/// +/// The file read message reads a certain length (up to 255 bytes) +/// from a given offset into a file, and returns the data in a +/// message where the message length field indicates how many bytes +/// were succesfully read. The sequence number in the response is +/// preserved from the request. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioReadResp { pub sender_id: Option, + /// Read sequence number pub sequence: u32, - // ^ Read sequence number + /// Contents of read file pub contents: Vec, - // ^ Contents of read file } impl MsgFileioReadResp { @@ -111,29 +111,29 @@ impl super::SBPMessage for MsgFileioReadResp { } } -// List files in a directory (host => device) -// -// The read directory message lists the files in a directory on the -// device's onboard flash file system. The offset parameter can be -// used to skip the first n elements of the file list. Returns a -// MSG_FILEIO_READ_DIR_RESP message containing the directory -// listings as a NULL delimited list. The listing is chunked over -// multiple SBP packets. The sequence number in the request will be -// returned in the response. If message is invalid, a followup -// MSG_PRINT message will print "Invalid fileio read message". -// A device will only respond to this message when it is received -// from sender ID 0x42. -// +/// List files in a directory (host => device) +/// +/// The read directory message lists the files in a directory on the +/// device's onboard flash file system. The offset parameter can be +/// used to skip the first n elements of the file list. Returns a +/// MSG_FILEIO_READ_DIR_RESP message containing the directory +/// listings as a NULL delimited list. The listing is chunked over +/// multiple SBP packets. The sequence number in the request will be +/// returned in the response. If message is invalid, a followup +/// MSG_PRINT message will print "Invalid fileio read message". +/// A device will only respond to this message when it is received +/// from sender ID 0x42. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioReadDirReq { pub sender_id: Option, + /// Read sequence number pub sequence: u32, - // ^ Read sequence number + /// The offset to skip the first n elements of the file list pub offset: u32, - // ^ The offset to skip the first n elements of the file list + /// Name of the directory to list pub dirname: String, - // ^ Name of the directory to list } impl MsgFileioReadDirReq { @@ -158,23 +158,23 @@ impl super::SBPMessage for MsgFileioReadDirReq { } } -// Files listed in a directory (host <= device) -// -// The read directory message lists the files in a directory on the -// device's onboard flash file system. Message contains the directory -// listings as a NULL delimited list. The listing is chunked over -// multiple SBP packets and the end of the list is identified by an -// entry containing just the character 0xFF. The sequence number in -// the response is preserved from the request. -// +/// Files listed in a directory (host <= device) +/// +/// The read directory message lists the files in a directory on the +/// device's onboard flash file system. Message contains the directory +/// listings as a NULL delimited list. The listing is chunked over +/// multiple SBP packets and the end of the list is identified by an +/// entry containing just the character 0xFF. The sequence number in +/// the response is preserved from the request. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioReadDirResp { pub sender_id: Option, + /// Read sequence number pub sequence: u32, - // ^ Read sequence number + /// Contents of read directory pub contents: Vec, - // ^ Contents of read directory } impl MsgFileioReadDirResp { @@ -198,19 +198,19 @@ impl super::SBPMessage for MsgFileioReadDirResp { } } -// Delete a file from the file system (host => device) -// -// The file remove message deletes a file from the file system. -// If the message is invalid, a followup MSG_PRINT message will -// print "Invalid fileio remove message". A device will only -// process this message when it is received from sender ID 0x42. -// +/// Delete a file from the file system (host => device) +/// +/// The file remove message deletes a file from the file system. +/// If the message is invalid, a followup MSG_PRINT message will +/// print "Invalid fileio remove message". A device will only +/// process this message when it is received from sender ID 0x42. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioRemove { pub sender_id: Option, + /// Name of the file to delete pub filename: String, - // ^ Name of the file to delete } impl MsgFileioRemove { @@ -233,29 +233,29 @@ impl super::SBPMessage for MsgFileioRemove { } } -// Write to file (host => device) -// -// The file write message writes a certain length (up to 255 bytes) -// of data to a file at a given offset. Returns a copy of the -// original MSG_FILEIO_WRITE_RESP message to check integrity of -// the write. The sequence number in the request will be returned -// in the response. If message is invalid, a followup MSG_PRINT -// message will print "Invalid fileio write message". A device will -// only process this message when it is received from sender ID -// 0x42. -// +/// Write to file (host => device) +/// +/// The file write message writes a certain length (up to 255 bytes) +/// of data to a file at a given offset. Returns a copy of the +/// original MSG_FILEIO_WRITE_RESP message to check integrity of +/// the write. The sequence number in the request will be returned +/// in the response. If message is invalid, a followup MSG_PRINT +/// message will print "Invalid fileio write message". A device will +/// only process this message when it is received from sender ID +/// 0x42. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioWriteReq { pub sender_id: Option, + /// Write sequence number pub sequence: u32, - // ^ Write sequence number + /// Offset into the file at which to start writing in bytes pub offset: u32, - // ^ Offset into the file at which to start writing in bytes + /// Name of the file to write to pub filename: String, - // ^ Name of the file to write to + /// Variable-length array of data to write pub data: Vec, - // ^ Variable-length array of data to write } impl MsgFileioWriteReq { @@ -281,20 +281,20 @@ impl super::SBPMessage for MsgFileioWriteReq { } } -// File written to (host <= device) -// -// The file write message writes a certain length (up to 255 bytes) -// of data to a file at a given offset. The message is a copy of the -// original MSG_FILEIO_WRITE_REQ message to check integrity of the -// write. The sequence number in the response is preserved from the -// request. -// +/// File written to (host <= device) +/// +/// The file write message writes a certain length (up to 255 bytes) +/// of data to a file at a given offset. The message is a copy of the +/// original MSG_FILEIO_WRITE_REQ message to check integrity of the +/// write. The sequence number in the response is preserved from the +/// request. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioWriteResp { pub sender_id: Option, + /// Write sequence number pub sequence: u32, - // ^ Write sequence number } impl MsgFileioWriteResp { @@ -317,19 +317,19 @@ impl super::SBPMessage for MsgFileioWriteResp { } } -// Request advice on the optimal configuration for FileIO. -// -// Requests advice on the optimal configuration for a FileIO -// transfer. Newer version of FileIO can support greater -// throughput by supporting a large window of FileIO data -// that can be in-flight during read or write operations. -// +/// Request advice on the optimal configuration for FileIO. +/// +/// Requests advice on the optimal configuration for a FileIO +/// transfer. Newer version of FileIO can support greater +/// throughput by supporting a large window of FileIO data +/// that can be in-flight during read or write operations. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioConfigReq { pub sender_id: Option, + /// Advice sequence number pub sequence: u32, - // ^ Advice sequence number } impl MsgFileioConfigReq { @@ -352,26 +352,26 @@ impl super::SBPMessage for MsgFileioConfigReq { } } -// Response with advice on the optimal configuration for FileIO. +/// Response with advice on the optimal configuration for FileIO. -// -// The advice on the optimal configuration for a FileIO -// transfer. Newer version of FileIO can support greater -// throughput by supporting a large window of FileIO data -// that can be in-flight during read or write operations. -// +/// +/// The advice on the optimal configuration for a FileIO +/// transfer. Newer version of FileIO can support greater +/// throughput by supporting a large window of FileIO data +/// that can be in-flight during read or write operations. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFileioConfigResp { pub sender_id: Option, + /// Advice sequence number pub sequence: u32, - // ^ Advice sequence number + /// The number of SBP packets in the data in-flight window pub window_size: u32, - // ^ The number of SBP packets in the data in-flight window + /// The number of SBP packets sent in one PDU pub batch_size: u32, - // ^ The number of SBP packets sent in one PDU + /// The version of FileIO that is supported pub fileio_version: u32, - // ^ The version of FileIO that is supported } impl MsgFileioConfigResp { diff --git a/rust/sbp/src/messages/flash.rs b/rust/sbp/src/messages/flash.rs index 167116e806..944326ea9d 100644 --- a/rust/sbp/src/messages/flash.rs +++ b/rust/sbp/src/messages/flash.rs @@ -12,36 +12,36 @@ // Automatically generated from yaml/swiftnav/sbp/flash.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Messages for reading/writing the device's onboard flash memory. Many -// of these messages target specific flash memory peripherals used in -// Swift Navigation devices: the STM32 flash and the M25Pxx FPGA -// configuration flash from Piksi 2.3.1. This module does not apply -// to Piksi Multi. +/// Messages for reading/writing the device's onboard flash memory. Many +/// of these messages target specific flash memory peripherals used in +/// Swift Navigation devices: the STM32 flash and the M25Pxx FPGA +/// configuration flash from Piksi 2.3.1. This module does not apply +/// to Piksi Multi. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; -// Program flash addresses -// -// The flash program message programs a set of addresses of either -// the STM or M25 flash. The device replies with either a -// MSG_FLASH_DONE message containing the return code FLASH_OK (0) -// on success, or FLASH_INVALID_LEN (2) if the maximum write size -// is exceeded. Note that the sector-containing addresses must be -// erased before addresses can be programmed. -// +/// Program flash addresses +/// +/// The flash program message programs a set of addresses of either +/// the STM or M25 flash. The device replies with either a +/// MSG_FLASH_DONE message containing the return code FLASH_OK (0) +/// on success, or FLASH_INVALID_LEN (2) if the maximum write size +/// is exceeded. Note that the sector-containing addresses must be +/// erased before addresses can be programmed. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFlashProgram { pub sender_id: Option, + /// Target flags pub target: u8, - // ^ Target flags + /// Starting address offset to program pub addr_start: Vec, - // ^ Starting address offset to program + /// Length of set of addresses to program, counting up from starting address pub addr_len: u8, - // ^ Length of set of addresses to program, counting up from starting address + /// Data to program addresses with, with length N=addr_len pub data: Vec, - // ^ Data to program addresses with, with length N=addr_len } impl MsgFlashProgram { @@ -67,19 +67,19 @@ impl super::SBPMessage for MsgFlashProgram { } } -// Flash response message (host <= device). -// -// This message defines success or failure codes for a variety of -// flash memory requests from the host to the device. Flash read -// and write messages, such as MSG_FLASH_READ_REQ, or -// MSG_FLASH_PROGRAM, may return this message on failure. -// +/// Flash response message (host <= device). +/// +/// This message defines success or failure codes for a variety of +/// flash memory requests from the host to the device. Flash read +/// and write messages, such as MSG_FLASH_READ_REQ, or +/// MSG_FLASH_PROGRAM, may return this message on failure. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFlashDone { pub sender_id: Option, + /// Response flags pub response: u8, - // ^ Response flags } impl MsgFlashDone { @@ -102,26 +102,26 @@ impl super::SBPMessage for MsgFlashDone { } } -// Read STM or M25 flash address request (host => device). -// -// The flash read message reads a set of addresses of either the -// STM or M25 onboard flash. The device replies with a -// MSG_FLASH_READ_RESP message containing either the read data on -// success or a MSG_FLASH_DONE message containing the return code -// FLASH_INVALID_LEN (2) if the maximum read size is exceeded or -// FLASH_INVALID_ADDR (3) if the address is outside of the allowed -// range. -// +/// Read STM or M25 flash address request (host => device). +/// +/// The flash read message reads a set of addresses of either the +/// STM or M25 onboard flash. The device replies with a +/// MSG_FLASH_READ_RESP message containing either the read data on +/// success or a MSG_FLASH_DONE message containing the return code +/// FLASH_INVALID_LEN (2) if the maximum read size is exceeded or +/// FLASH_INVALID_ADDR (3) if the address is outside of the allowed +/// range. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFlashReadReq { pub sender_id: Option, + /// Target flags pub target: u8, - // ^ Target flags + /// Starting address offset to read from pub addr_start: Vec, - // ^ Starting address offset to read from + /// Length of set of addresses to read, counting up from starting address pub addr_len: u8, - // ^ Length of set of addresses to read, counting up from starting address } impl MsgFlashReadReq { @@ -146,26 +146,26 @@ impl super::SBPMessage for MsgFlashReadReq { } } -// Read STM or M25 flash address response (host <= device). -// -// The flash read message reads a set of addresses of either the -// STM or M25 onboard flash. The device replies with a -// MSG_FLASH_READ_RESP message containing either the read data on -// success or a MSG_FLASH_DONE message containing the return code -// FLASH_INVALID_LEN (2) if the maximum read size is exceeded or -// FLASH_INVALID_ADDR (3) if the address is outside of the allowed -// range. -// +/// Read STM or M25 flash address response (host <= device). +/// +/// The flash read message reads a set of addresses of either the +/// STM or M25 onboard flash. The device replies with a +/// MSG_FLASH_READ_RESP message containing either the read data on +/// success or a MSG_FLASH_DONE message containing the return code +/// FLASH_INVALID_LEN (2) if the maximum read size is exceeded or +/// FLASH_INVALID_ADDR (3) if the address is outside of the allowed +/// range. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFlashReadResp { pub sender_id: Option, + /// Target flags pub target: u8, - // ^ Target flags + /// Starting address offset to read from pub addr_start: Vec, - // ^ Starting address offset to read from + /// Length of set of addresses to read, counting up from starting address pub addr_len: u8, - // ^ Length of set of addresses to read, counting up from starting address } impl MsgFlashReadResp { @@ -190,22 +190,22 @@ impl super::SBPMessage for MsgFlashReadResp { } } -// Erase sector of device flash memory (host => device). -// -// The flash erase message from the host erases a sector of either -// the STM or M25 onboard flash memory. The device will reply with a -// MSG_FLASH_DONE message containing the return code - FLASH_OK (0) -// on success or FLASH_INVALID_FLASH (1) if the flash specified is -// invalid. -// +/// Erase sector of device flash memory (host => device). +/// +/// The flash erase message from the host erases a sector of either +/// the STM or M25 onboard flash memory. The device will reply with a +/// MSG_FLASH_DONE message containing the return code - FLASH_OK (0) +/// on success or FLASH_INVALID_FLASH (1) if the flash specified is +/// invalid. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFlashErase { pub sender_id: Option, + /// Target flags pub target: u8, - // ^ Target flags + /// Flash sector number to erase (0-11 for the STM, 0-15 for the M25) pub sector_num: u32, - // ^ Flash sector number to erase (0-11 for the STM, 0-15 for the M25) } impl MsgFlashErase { @@ -229,17 +229,17 @@ impl super::SBPMessage for MsgFlashErase { } } -// Lock sector of STM flash memory (host => device) -// -// The flash lock message locks a sector of the STM flash -// memory. The device replies with a MSG_FLASH_DONE message. -// +/// Lock sector of STM flash memory (host => device) +/// +/// The flash lock message locks a sector of the STM flash +/// memory. The device replies with a MSG_FLASH_DONE message. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgStmFlashLockSector { pub sender_id: Option, + /// Flash sector number to lock pub sector: u32, - // ^ Flash sector number to lock } impl MsgStmFlashLockSector { @@ -262,17 +262,17 @@ impl super::SBPMessage for MsgStmFlashLockSector { } } -// Unlock sector of STM flash memory (host => device) -// -// The flash unlock message unlocks a sector of the STM flash -// memory. The device replies with a MSG_FLASH_DONE message. -// +/// Unlock sector of STM flash memory (host => device) +/// +/// The flash unlock message unlocks a sector of the STM flash +/// memory. The device replies with a MSG_FLASH_DONE message. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgStmFlashUnlockSector { pub sender_id: Option, + /// Flash sector number to unlock pub sector: u32, - // ^ Flash sector number to unlock } impl MsgStmFlashUnlockSector { @@ -295,14 +295,14 @@ impl super::SBPMessage for MsgStmFlashUnlockSector { } } -// Read device's hardcoded unique ID request (host => device) +/// Read device's hardcoded unique ID request (host => device) -// -// This message reads the device's hardcoded unique ID. The host -// requests the ID by sending a MSG_STM_UNIQUE_ID_REQ. The device -// responds with a MSG_STM_UNIQUE_ID_RESP with the 12-byte unique -// ID in the payload. -// +/// +/// This message reads the device's hardcoded unique ID. The host +/// requests the ID by sending a MSG_STM_UNIQUE_ID_REQ. The device +/// responds with a MSG_STM_UNIQUE_ID_RESP with the 12-byte unique +/// ID in the payload. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgStmUniqueIdReq { @@ -326,20 +326,20 @@ impl super::SBPMessage for MsgStmUniqueIdReq { } } -// Read device's hardcoded unique ID response (host <= device) +/// Read device's hardcoded unique ID response (host <= device) -// -// This message reads the device's hardcoded unique ID. The host -// requests the ID by sending a MSG_STM_UNIQUE_ID_REQ. The device -// responds with a MSG_STM_UNIQUE_ID_RESP with the 12-byte unique -// ID in the payload.. -// +/// +/// This message reads the device's hardcoded unique ID. The host +/// requests the ID by sending a MSG_STM_UNIQUE_ID_REQ. The device +/// responds with a MSG_STM_UNIQUE_ID_RESP with the 12-byte unique +/// ID in the payload.. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgStmUniqueIdResp { pub sender_id: Option, + /// Device unique ID pub stm_id: Vec, - // ^ Device unique ID } impl MsgStmUniqueIdResp { @@ -362,17 +362,17 @@ impl super::SBPMessage for MsgStmUniqueIdResp { } } -// Write M25 flash status register (host => device) -// -// The flash status message writes to the 8-bit M25 flash status -// register. The device replies with a MSG_FLASH_DONE message. -// +/// Write M25 flash status register (host => device) +/// +/// The flash status message writes to the 8-bit M25 flash status +/// register. The device replies with a MSG_FLASH_DONE message. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgM25FlashWriteStatus { pub sender_id: Option, + /// Byte to write to the M25 flash status register pub status: Vec, - // ^ Byte to write to the M25 flash status register } impl MsgM25FlashWriteStatus { diff --git a/rust/sbp/src/messages/gnss.rs b/rust/sbp/src/messages/gnss.rs index 4b642c6c29..12e0f96c98 100644 --- a/rust/sbp/src/messages/gnss.rs +++ b/rust/sbp/src/messages/gnss.rs @@ -12,23 +12,23 @@ // Automatically generated from yaml/swiftnav/sbp/gnss.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Various structs shared between modules +/// Various structs shared between modules extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; -// Represents all the relevant information about the signal -// -// Signal identifier containing constellation, band, and satellite identifier -// +/// Represents all the relevant information about the signal +/// +/// Signal identifier containing constellation, band, and satellite identifier +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct GnssSignal { + /// Constellation-specific satellite identifier. This field for Glonass can + /// either be (100+FCN) where FCN is in [-7,+6] or the Slot ID in [1,28] pub sat: u8, - // ^ Constellation-specific satellite identifier. This field for Glonass can - // either be (100+FCN) where FCN is in [-7,+6] or the Slot ID in [1,28] + /// Signal constellation, band and code pub code: u8, - // ^ Signal constellation, band and code } impl GnssSignal { @@ -58,18 +58,18 @@ impl GnssSignal { } } -// Space vehicle identifier -// -// A (Constellation ID, satellite ID) tuple that uniquely identifies -// a space vehicle -// +/// Space vehicle identifier +/// +/// A (Constellation ID, satellite ID) tuple that uniquely identifies +/// a space vehicle +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct SvId { + /// ID of the space vehicle within its constellation pub satId: u8, - // ^ ID of the space vehicle within its constellation + /// Constellation ID to which the SV belongs pub constellation: u8, - // ^ Constellation ID to which the SV belongs } impl SvId { @@ -99,21 +99,21 @@ impl SvId { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct GnssSignalDep { + /// Constellation-specific satellite identifier. Note: unlike GnssSignal, + /// GPS satellites are encoded as (PRN - 1). Other constellations do not + /// have this offset. pub sat: u16, - // ^ Constellation-specific satellite identifier. Note: unlike GnssSignal, - // GPS satellites are encoded as (PRN - 1). Other constellations do not - // have this offset. + /// Signal constellation, band and code pub code: u8, - // ^ Signal constellation, band and code + /// Reserved pub reserved: u8, - // ^ Reserved } impl GnssSignalDep { @@ -144,19 +144,19 @@ impl GnssSignalDep { } } -// Millisecond-accurate GPS time -// -// A wire-appropriate GPS time, defined as the number of -// milliseconds since beginning of the week on the Saturday/Sunday -// transition. -// +/// Millisecond-accurate GPS time +/// +/// A wire-appropriate GPS time, defined as the number of +/// milliseconds since beginning of the week on the Saturday/Sunday +/// transition. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct GPSTimeDep { + /// Milliseconds since start of GPS week pub tow: u32, - // ^ Milliseconds since start of GPS week + /// GPS week number pub wn: u16, - // ^ GPS week number } impl GPSTimeDep { @@ -186,19 +186,19 @@ impl GPSTimeDep { } } -// Whole second accurate GPS time -// -// A GPS time, defined as the number of -// seconds since beginning of the week on the Saturday/Sunday -// transition. -// +/// Whole second accurate GPS time +/// +/// A GPS time, defined as the number of +/// seconds since beginning of the week on the Saturday/Sunday +/// transition. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct GPSTimeSec { + /// Seconds since start of GPS week pub tow: u32, - // ^ Seconds since start of GPS week + /// GPS week number pub wn: u16, - // ^ GPS week number } impl GPSTimeSec { @@ -228,23 +228,23 @@ impl GPSTimeSec { } } -// Nanosecond-accurate receiver clock time -// -// A wire-appropriate receiver clock time, defined as the time -// since the beginning of the week on the Saturday/Sunday -// transition. In most cases, observations are epoch aligned -// so ns field will be 0. -// +/// Nanosecond-accurate receiver clock time +/// +/// A wire-appropriate receiver clock time, defined as the time +/// since the beginning of the week on the Saturday/Sunday +/// transition. In most cases, observations are epoch aligned +/// so ns field will be 0. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct GPSTime { + /// Milliseconds since start of GPS week pub tow: u32, - // ^ Milliseconds since start of GPS week + /// Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to + /// 500000) pub ns_residual: i32, - // ^ Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to - // 500000) + /// GPS week number pub wn: u16, - // ^ GPS week number } impl GPSTime { @@ -275,20 +275,20 @@ impl GPSTime { } } -// GNSS carrier phase measurement. -// -// Carrier phase measurement in cycles represented as a 40-bit -// fixed point number with Q32.8 layout, i.e. 32-bits of whole -// cycles and 8-bits of fractional cycles. This phase has the -// same sign as the pseudorange. -// +/// GNSS carrier phase measurement. +/// +/// Carrier phase measurement in cycles represented as a 40-bit +/// fixed point number with Q32.8 layout, i.e. 32-bits of whole +/// cycles and 8-bits of fractional cycles. This phase has the +/// same sign as the pseudorange. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct CarrierPhase { + /// Carrier phase whole cycles pub i: i32, - // ^ Carrier phase whole cycles + /// Carrier phase fractional part pub f: u8, - // ^ Carrier phase fractional part } impl CarrierPhase { diff --git a/rust/sbp/src/messages/imu.rs b/rust/sbp/src/messages/imu.rs index 60d39e1d43..1e8541bbc9 100644 --- a/rust/sbp/src/messages/imu.rs +++ b/rust/sbp/src/messages/imu.rs @@ -12,39 +12,39 @@ // Automatically generated from yaml/swiftnav/sbp/imu.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Inertial Measurement Unit (IMU) messages. +/// Inertial Measurement Unit (IMU) messages. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; -// Raw IMU data -// -// Raw data from the Inertial Measurement Unit, containing accelerometer and -// gyroscope readings. The sense of the measurements are to be aligned with -// the indications on the device itself. Measurement units, which are specific to the -// device hardware and settings, are communicated via the MSG_IMU_AUX message. -// +/// Raw IMU data +/// +/// Raw data from the Inertial Measurement Unit, containing accelerometer and +/// gyroscope readings. The sense of the measurements are to be aligned with +/// the indications on the device itself. Measurement units, which are specific to the +/// device hardware and settings, are communicated via the MSG_IMU_AUX message. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgImuRaw { pub sender_id: Option, + /// Milliseconds since start of GPS week. If the high bit is set, the time + /// is unknown or invalid. pub tow: u32, - // ^ Milliseconds since start of GPS week. If the high bit is set, the time - // is unknown or invalid. + /// Milliseconds since start of GPS week, fractional part pub tow_f: u8, - // ^ Milliseconds since start of GPS week, fractional part + /// Acceleration in the IMU frame X axis pub acc_x: i16, - // ^ Acceleration in the IMU frame X axis + /// Acceleration in the IMU frame Y axis pub acc_y: i16, - // ^ Acceleration in the IMU frame Y axis + /// Acceleration in the IMU frame Z axis pub acc_z: i16, - // ^ Acceleration in the IMU frame Z axis + /// Angular rate around IMU frame X axis pub gyr_x: i16, - // ^ Angular rate around IMU frame X axis + /// Angular rate around IMU frame Y axis pub gyr_y: i16, - // ^ Angular rate around IMU frame Y axis + /// Angular rate around IMU frame Z axis pub gyr_z: i16, - // ^ Angular rate around IMU frame Z axis } impl MsgImuRaw { @@ -74,22 +74,22 @@ impl super::SBPMessage for MsgImuRaw { } } -// Auxiliary IMU data -// -// Auxiliary data specific to a particular IMU. The `imu_type` field will -// always be consistent but the rest of the payload is device specific and -// depends on the value of `imu_type`. -// +/// Auxiliary IMU data +/// +/// Auxiliary data specific to a particular IMU. The `imu_type` field will +/// always be consistent but the rest of the payload is device specific and +/// depends on the value of `imu_type`. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgImuAux { pub sender_id: Option, + /// IMU type pub imu_type: u8, - // ^ IMU type + /// Raw IMU temperature pub temp: i16, - // ^ Raw IMU temperature + /// IMU configuration pub imu_conf: u8, - // ^ IMU configuration } impl MsgImuAux { diff --git a/rust/sbp/src/messages/linux.rs b/rust/sbp/src/messages/linux.rs index e719513b03..8e36750a11 100644 --- a/rust/sbp/src/messages/linux.rs +++ b/rust/sbp/src/messages/linux.rs @@ -12,30 +12,30 @@ // Automatically generated from yaml/swiftnav/sbp/linux.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Linux state monitoring. +/// Linux state monitoring. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; -// List CPU state on the system -// -// This message indicates the process state of the top 10 heaviest -// consumers of CPU on the system. -// +/// List CPU state on the system +/// +/// This message indicates the process state of the top 10 heaviest +/// consumers of CPU on the system. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLinuxCpuState { pub sender_id: Option, + /// sequence of this status message, values from 0-9 pub index: u8, - // ^ sequence of this status message, values from 0-9 + /// the PID of the process pub pid: u16, - // ^ the PID of the process + /// percent of cpu used, expressed as a fraction of 256 pub pcpu: u8, - // ^ percent of cpu used, expressed as a fraction of 256 + /// fixed length string representing the thread name pub tname: String, - // ^ fixed length string representing the thread name + /// the command line (as much as it fits in the remaining packet) pub cmdline: String, - // ^ the command line (as much as it fits in the remaining packet) } impl MsgLinuxCpuState { @@ -62,25 +62,25 @@ impl super::SBPMessage for MsgLinuxCpuState { } } -// List CPU state on the system -// -// This message indicates the process state of the top 10 heaviest -// consumers of memory on the system. -// +/// List CPU state on the system +/// +/// This message indicates the process state of the top 10 heaviest +/// consumers of memory on the system. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLinuxMemState { pub sender_id: Option, + /// sequence of this status message, values from 0-9 pub index: u8, - // ^ sequence of this status message, values from 0-9 + /// the PID of the process pub pid: u16, - // ^ the PID of the process + /// percent of memory used, expressed as a fraction of 256 pub pmem: u8, - // ^ percent of memory used, expressed as a fraction of 256 + /// fixed length string representing the thread name pub tname: String, - // ^ fixed length string representing the thread name + /// the command line (as much as it fits in the remaining packet) pub cmdline: String, - // ^ the command line (as much as it fits in the remaining packet) } impl MsgLinuxMemState { @@ -107,26 +107,26 @@ impl super::SBPMessage for MsgLinuxMemState { } } -// CPU, Memory and Process Starts/Stops -// -// This presents a summary of CPU and memory utilization. -// +/// CPU, Memory and Process Starts/Stops +/// +/// This presents a summary of CPU and memory utilization. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLinuxSysState { pub sender_id: Option, + /// total system memory pub mem_total: u16, - // ^ total system memory + /// percent of total cpu currently utilized pub pcpu: u8, - // ^ percent of total cpu currently utilized + /// percent of total memory currently utilized pub pmem: u8, - // ^ percent of total memory currently utilized + /// number of processes that started during collection phase pub procs_starting: u16, - // ^ number of processes that started during collection phase + /// number of processes that stopped during collection phase pub procs_stopping: u16, - // ^ number of processes that stopped during collection phase + /// the count of processes on the system pub pid_count: u16, - // ^ the count of processes on the system } impl MsgLinuxSysState { @@ -154,30 +154,30 @@ impl super::SBPMessage for MsgLinuxSysState { } } -// A list of processes with high socket counts -// -// Top 10 list of processes with high socket counts. -// +/// A list of processes with high socket counts +/// +/// Top 10 list of processes with high socket counts. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLinuxProcessSocketCounts { pub sender_id: Option, + /// sequence of this status message, values from 0-9 pub index: u8, - // ^ sequence of this status message, values from 0-9 + /// the PID of the process in question pub pid: u16, - // ^ the PID of the process in question + /// the number of sockets the process is using pub socket_count: u16, - // ^ the number of sockets the process is using + /// A bitfield indicating the socket types used: 0x1 (tcp), 0x2 (udp), 0x4 + /// (unix stream), 0x8 (unix dgram), 0x10 (netlink), and 0x8000 (unknown) pub socket_types: u16, - // ^ A bitfield indicating the socket types used: 0x1 (tcp), 0x2 (udp), 0x4 - // (unix stream), 0x8 (unix dgram), 0x10 (netlink), and 0x8000 (unknown) + /// A bitfield indicating the socket states: 0x1 (established), 0x2 (syn- + /// sent), 0x4 (syn-recv), 0x8 (fin-wait-1), 0x10 (fin-wait-2), 0x20 + /// (time-wait), 0x40 (closed), 0x80 (close-wait), 0x100 (last-ack), 0x200 + /// (listen), 0x400 (closing), 0x800 (unconnected), and 0x8000 (unknown) pub socket_states: u16, - // ^ A bitfield indicating the socket states: 0x1 (established), 0x2 (syn- - // sent), 0x4 (syn-recv), 0x8 (fin-wait-1), 0x10 (fin-wait-2), 0x20 - // (time-wait), 0x40 (closed), 0x80 (close-wait), 0x100 (last-ack), 0x200 - // (listen), 0x400 (closing), 0x800 (unconnected), and 0x8000 (unknown) + /// the command line of the process in question pub cmdline: String, - // ^ the command line of the process in question } impl MsgLinuxProcessSocketCounts { @@ -205,35 +205,35 @@ impl super::SBPMessage for MsgLinuxProcessSocketCounts { } } -// A list of processes with deep socket queues -// -// Top 10 list of sockets with deep queues. -// +/// A list of processes with deep socket queues +/// +/// Top 10 list of sockets with deep queues. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLinuxProcessSocketQueues { pub sender_id: Option, + /// sequence of this status message, values from 0-9 pub index: u8, - // ^ sequence of this status message, values from 0-9 + /// the PID of the process in question pub pid: u16, - // ^ the PID of the process in question + /// the total amount of receive data queued for this process pub recv_queued: u16, - // ^ the total amount of receive data queued for this process + /// the total amount of send data queued for this process pub send_queued: u16, - // ^ the total amount of send data queued for this process + /// A bitfield indicating the socket types used: 0x1 (tcp), 0x2 (udp), 0x4 + /// (unix stream), 0x8 (unix dgram), 0x10 (netlink), and 0x8000 (unknown) pub socket_types: u16, - // ^ A bitfield indicating the socket types used: 0x1 (tcp), 0x2 (udp), 0x4 - // (unix stream), 0x8 (unix dgram), 0x10 (netlink), and 0x8000 (unknown) + /// A bitfield indicating the socket states: 0x1 (established), 0x2 (syn- + /// sent), 0x4 (syn-recv), 0x8 (fin-wait-1), 0x10 (fin-wait-2), 0x20 + /// (time-wait), 0x40 (closed), 0x80 (close-wait), 0x100 (last-ack), 0x200 + /// (listen), 0x400 (closing), 0x800 (unconnected), and 0x8000 (unknown) pub socket_states: u16, - // ^ A bitfield indicating the socket states: 0x1 (established), 0x2 (syn- - // sent), 0x4 (syn-recv), 0x8 (fin-wait-1), 0x10 (fin-wait-2), 0x20 - // (time-wait), 0x40 (closed), 0x80 (close-wait), 0x100 (last-ack), 0x200 - // (listen), 0x400 (closing), 0x800 (unconnected), and 0x8000 (unknown) + /// Address of the largest queue, remote or local depending on the + /// directionality of the connection. pub address_of_largest: String, - // ^ Address of the largest queue, remote or local depending on the - // directionality of the connection. + /// the command line of the process in question pub cmdline: String, - // ^ the command line of the process in question } impl MsgLinuxProcessSocketQueues { @@ -263,26 +263,26 @@ impl super::SBPMessage for MsgLinuxProcessSocketQueues { } } -// Summary of socket usage across the system -// -// Summaries the socket usage across the system. -// +/// Summary of socket usage across the system +/// +/// Summaries the socket usage across the system. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLinuxSocketUsage { pub sender_id: Option, + /// average socket queue depths across all sockets on the system pub avg_queue_depth: u32, - // ^ average socket queue depths across all sockets on the system + /// the max queue depth seen within the reporting period pub max_queue_depth: u32, - // ^ the max queue depth seen within the reporting period + /// A count for each socket type reported in the `socket_types_reported` + /// field, the first entry corresponds to the first enabled bit in + /// `types_reported`. pub socket_state_counts: Vec, - // ^ A count for each socket type reported in the `socket_types_reported` - // field, the first entry corresponds to the first enabled bit in - // `types_reported`. + /// A count for each socket type reported in the `socket_types_reported` + /// field, the first entry corresponds to the first enabled bit in + /// `types_reported`. pub socket_type_counts: Vec, - // ^ A count for each socket type reported in the `socket_types_reported` - // field, the first entry corresponds to the first enabled bit in - // `types_reported`. } impl MsgLinuxSocketUsage { @@ -308,22 +308,22 @@ impl super::SBPMessage for MsgLinuxSocketUsage { } } -// Summary of processes with large amounts of open file descriptors -// -// Top 10 list of processes with a large number of open file descriptors. -// +/// Summary of processes with large amounts of open file descriptors +/// +/// Top 10 list of processes with a large number of open file descriptors. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLinuxProcessFdCount { pub sender_id: Option, + /// sequence of this status message, values from 0-9 pub index: u8, - // ^ sequence of this status message, values from 0-9 + /// the PID of the process in question pub pid: u16, - // ^ the PID of the process in question + /// a count of the number of file descriptors opened by the process pub fd_count: u16, - // ^ a count of the number of file descriptors opened by the process + /// the command line of the process in question pub cmdline: String, - // ^ the command line of the process in question } impl MsgLinuxProcessFdCount { @@ -349,22 +349,22 @@ impl super::SBPMessage for MsgLinuxProcessFdCount { } } -// Summary of open file descriptors on the system -// -// Summary of open file descriptors on the system. -// +/// Summary of open file descriptors on the system +/// +/// Summary of open file descriptors on the system. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLinuxProcessFdSummary { pub sender_id: Option, + /// count of total FDs open on the system pub sys_fd_count: u32, - // ^ count of total FDs open on the system + /// A null delimited list of strings which alternates between a string + /// representation of the process count and the file name whose count it + /// being reported. That is, in C string syntax + /// "32\0/var/log/syslog\012\0/tmp/foo\0" with the end of the list being 2 + /// NULL terminators in a row. pub most_opened: String, - // ^ A null delimited list of strings which alternates between a string - // representation of the process count and the file name whose count it - // being reported. That is, in C string syntax - // "32\0/var/log/syslog\012\0/tmp/foo\0" with the end of the list being 2 - // NULL terminators in a row. } impl MsgLinuxProcessFdSummary { diff --git a/rust/sbp/src/messages/logging.rs b/rust/sbp/src/messages/logging.rs index fd940ef89b..60a5d391a1 100644 --- a/rust/sbp/src/messages/logging.rs +++ b/rust/sbp/src/messages/logging.rs @@ -12,25 +12,25 @@ // Automatically generated from yaml/swiftnav/sbp/logging.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Logging and debugging messages from the device. +/// Logging and debugging messages from the device. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; -// Plaintext logging messages with levels -// -// This message contains a human-readable payload string from the -// device containing errors, warnings and informational messages at -// ERROR, WARNING, DEBUG, INFO logging levels. -// +/// Plaintext logging messages with levels +/// +/// This message contains a human-readable payload string from the +/// device containing errors, warnings and informational messages at +/// ERROR, WARNING, DEBUG, INFO logging levels. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgLog { pub sender_id: Option, + /// Logging level pub level: u8, - // ^ Logging level + /// Human-readable string pub text: String, - // ^ Human-readable string } impl MsgLog { @@ -54,26 +54,26 @@ impl super::SBPMessage for MsgLog { } } -// Wrapper for FWD a separate stream of information over SBP -// -// This message provides the ability to forward messages over SBP. This may take the form -// of wrapping up SBP messages received by Piksi for logging purposes or wrapping -// another protocol with SBP. -// -// The source identifier indicates from what interface a forwarded stream derived. -// The protocol identifier identifies what the expected protocol the forwarded msg contains. -// Protocol 0 represents SBP and the remaining values are implementation defined. -// +/// Wrapper for FWD a separate stream of information over SBP +/// +/// This message provides the ability to forward messages over SBP. This may take the form +/// of wrapping up SBP messages received by Piksi for logging purposes or wrapping +/// another protocol with SBP. +/// +/// The source identifier indicates from what interface a forwarded stream derived. +/// The protocol identifier identifies what the expected protocol the forwarded msg contains. +/// Protocol 0 represents SBP and the remaining values are implementation defined. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFwd { pub sender_id: Option, + /// source identifier pub source: u8, - // ^ source identifier + /// protocol identifier pub protocol: u8, - // ^ protocol identifier + /// variable length wrapped binary message pub fwd_payload: String, - // ^ variable length wrapped binary message } impl MsgFwd { @@ -98,16 +98,16 @@ impl super::SBPMessage for MsgFwd { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgPrintDep { pub sender_id: Option, + /// Human-readable string pub text: String, - // ^ Human-readable string } impl MsgPrintDep { diff --git a/rust/sbp/src/messages/mag.rs b/rust/sbp/src/messages/mag.rs index 106132eff7..3f6a91e8fc 100644 --- a/rust/sbp/src/messages/mag.rs +++ b/rust/sbp/src/messages/mag.rs @@ -12,30 +12,30 @@ // Automatically generated from yaml/swiftnav/sbp/mag.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Magnetometer (mag) messages. +/// Magnetometer (mag) messages. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; -// Raw magnetometer data -// -// Raw data from the magnetometer. -// +/// Raw magnetometer data +/// +/// Raw data from the magnetometer. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgMagRaw { pub sender_id: Option, + /// Milliseconds since start of GPS week. If the high bit is set, the time + /// is unknown or invalid. pub tow: u32, - // ^ Milliseconds since start of GPS week. If the high bit is set, the time - // is unknown or invalid. + /// Milliseconds since start of GPS week, fractional part pub tow_f: u8, - // ^ Milliseconds since start of GPS week, fractional part + /// Magnetic field in the body frame X axis pub mag_x: i16, - // ^ Magnetic field in the body frame X axis + /// Magnetic field in the body frame Y axis pub mag_y: i16, - // ^ Magnetic field in the body frame Y axis + /// Magnetic field in the body frame Z axis pub mag_z: i16, - // ^ Magnetic field in the body frame Z axis } impl MsgMagRaw { diff --git a/rust/sbp/src/messages/mod.rs b/rust/sbp/src/messages/mod.rs index da2267af7d..6cf1c19419 100644 --- a/rust/sbp/src/messages/mod.rs +++ b/rust/sbp/src/messages/mod.rs @@ -217,19 +217,6 @@ pub enum SBP { sender_id: u16, payload: Vec, }, - MsgGPSTime(MsgGPSTime), - MsgUtcTime(MsgUtcTime), - MsgDops(MsgDops), - MsgPosECEF(MsgPosECEF), - MsgPosECEFCov(MsgPosECEFCov), - MsgPosLLH(MsgPosLLH), - MsgPosLLHCov(MsgPosLLHCov), - MsgBaselineECEF(MsgBaselineECEF), - MsgBaselineNED(MsgBaselineNED), - MsgVelECEF(MsgVelECEF), - MsgVelECEFCov(MsgVelECEFCov), - MsgVelNED(MsgVelNED), - MsgVelNEDCov(MsgVelNEDCov), MsgVelBody(MsgVelBody), MsgAgeCorrections(MsgAgeCorrections), MsgGPSTimeDepA(MsgGPSTimeDepA), @@ -241,15 +228,6 @@ pub enum SBP { MsgVelECEFDepA(MsgVelECEFDepA), MsgVelNEDDepA(MsgVelNEDDepA), MsgBaselineHeadingDepA(MsgBaselineHeadingDepA), - MsgTrackingStateDetailedDepA(MsgTrackingStateDetailedDepA), - MsgTrackingStateDetailedDep(MsgTrackingStateDetailedDep), - MsgTrackingState(MsgTrackingState), - MsgMeasurementState(MsgMeasurementState), - MsgTrackingIq(MsgTrackingIq), - MsgTrackingIqDepB(MsgTrackingIqDepB), - MsgTrackingIqDepA(MsgTrackingIqDepA), - MsgTrackingStateDepA(MsgTrackingStateDepA), - MsgTrackingStateDepB(MsgTrackingStateDepB), MsgSsrOrbitClock(MsgSsrOrbitClock), MsgSsrOrbitClockDepA(MsgSsrOrbitClockDepA), MsgSsrCodeBiases(MsgSsrCodeBiases), @@ -257,22 +235,102 @@ pub enum SBP { MsgSsrStecCorrection(MsgSsrStecCorrection), MsgSsrGriddedCorrection(MsgSsrGriddedCorrection), MsgSsrGridDefinition(MsgSsrGridDefinition), + MsgMagRaw(MsgMagRaw), + MsgNdbEvent(MsgNdbEvent), MsgBaselineHeading(MsgBaselineHeading), MsgOrientQuat(MsgOrientQuat), MsgOrientEuler(MsgOrientEuler), MsgAngularRate(MsgAngularRate), + MsgObs(MsgObs), + MsgBasePosLLH(MsgBasePosLLH), + MsgBasePosECEF(MsgBasePosECEF), + MsgEphemerisGPSDepF(MsgEphemerisGPSDepF), + MsgEphemerisGPS(MsgEphemerisGPS), + MsgEphemerisGPSDepE(MsgEphemerisGPSDepE), + MsgEphemerisQzss(MsgEphemerisQzss), + MsgEphemerisBds(MsgEphemerisBds), + MsgLinuxProcessSocketQueues(MsgLinuxProcessSocketQueues), + MsgLinuxSocketUsage(MsgLinuxSocketUsage), + MsgLinuxProcessFdCount(MsgLinuxProcessFdCount), + MsgLinuxProcessFdSummary(MsgLinuxProcessFdSummary), + MsgUserData(MsgUserData), + MsgGPSTime(MsgGPSTime), + MsgUtcTime(MsgUtcTime), + MsgDops(MsgDops), + MsgPosECEF(MsgPosECEF), + MsgPosECEFCov(MsgPosECEFCov), + MsgPosLLH(MsgPosLLH), + MsgPosLLHCov(MsgPosLLHCov), + MsgBaselineECEF(MsgBaselineECEF), + MsgBaselineNED(MsgBaselineNED), + MsgVelECEF(MsgVelECEF), + MsgVelECEFCov(MsgVelECEFCov), + MsgVelNED(MsgVelNED), + MsgVelNEDCov(MsgVelNEDCov), + MsgCommandResp(MsgCommandResp), + MsgCommandOutput(MsgCommandOutput), + MsgNetworkStateReq(MsgNetworkStateReq), + MsgNetworkStateResp(MsgNetworkStateResp), + MsgNetworkBandwidthUsage(MsgNetworkBandwidthUsage), + MsgCellModemStatus(MsgCellModemStatus), + MsgSpecanDep(MsgSpecanDep), + MsgSpecan(MsgSpecan), + MsgFrontEndGain(MsgFrontEndGain), MsgStartup(MsgStartup), MsgDgnssStatus(MsgDgnssStatus), MsgHeartbeat(MsgHeartbeat), MsgInsStatus(MsgInsStatus), MsgCsacTelemetry(MsgCsacTelemetry), MsgCsacTelemetryLabels(MsgCsacTelemetryLabels), + MsgBootloaderHandshakeReq(MsgBootloaderHandshakeReq), + MsgBootloaderHandshakeResp(MsgBootloaderHandshakeResp), + MsgBootloaderJumpToApp(MsgBootloaderJumpToApp), + MsgNapDeviceDnaReq(MsgNapDeviceDnaReq), + MsgNapDeviceDnaResp(MsgNapDeviceDnaResp), + MsgBootloaderHandshakeDepA(MsgBootloaderHandshakeDepA), + MsgSettingsSave(MsgSettingsSave), + MsgSettingsWrite(MsgSettingsWrite), + MsgSettingsWriteResp(MsgSettingsWriteResp), + MsgSettingsReadReq(MsgSettingsReadReq), + MsgSettingsReadResp(MsgSettingsReadResp), + MsgSettingsReadByIndexReq(MsgSettingsReadByIndexReq), + MsgSettingsReadByIndexResp(MsgSettingsReadByIndexResp), + MsgSettingsReadByIndexDone(MsgSettingsReadByIndexDone), + MsgSettingsRegister(MsgSettingsRegister), + MsgSettingsRegisterResp(MsgSettingsRegisterResp), + MsgLog(MsgLog), + MsgFwd(MsgFwd), + MsgPrintDep(MsgPrintDep), + MsgFileioReadReq(MsgFileioReadReq), + MsgFileioReadResp(MsgFileioReadResp), + MsgFileioReadDirReq(MsgFileioReadDirReq), + MsgFileioReadDirResp(MsgFileioReadDirResp), + MsgFileioRemove(MsgFileioRemove), + MsgFileioWriteReq(MsgFileioWriteReq), + MsgFileioWriteResp(MsgFileioWriteResp), + MsgFileioConfigReq(MsgFileioConfigReq), + MsgFileioConfigResp(MsgFileioConfigResp), + MsgLinuxCpuState(MsgLinuxCpuState), + MsgLinuxMemState(MsgLinuxMemState), + MsgLinuxSysState(MsgLinuxSysState), + MsgLinuxProcessSocketCounts(MsgLinuxProcessSocketCounts), + MsgTrackingStateDetailedDep(MsgTrackingStateDetailedDep), + MsgTrackingState(MsgTrackingState), + MsgMeasurementState(MsgMeasurementState), + MsgTrackingIq(MsgTrackingIq), + MsgTrackingIqDepB(MsgTrackingIqDepB), + MsgTrackingIqDepA(MsgTrackingIqDepA), + MsgTrackingStateDepA(MsgTrackingStateDepA), + MsgTrackingStateDepB(MsgTrackingStateDepB), + MsgExtEvent(MsgExtEvent), + MsgSbasRaw(MsgSbasRaw), MsgAcqResult(MsgAcqResult), MsgAcqResultDepC(MsgAcqResultDepC), MsgAcqResultDepB(MsgAcqResultDepB), MsgAcqResultDepA(MsgAcqResultDepA), MsgAcqSvProfile(MsgAcqSvProfile), MsgAcqSvProfileDep(MsgAcqSvProfileDep), + MsgOdometry(MsgOdometry), MsgAlmanac(MsgAlmanac), MsgSetTime(MsgSetTime), MsgReset(MsgReset), @@ -289,23 +347,17 @@ pub enum SBP { MsgMaskSatelliteDep(MsgMaskSatelliteDep), MsgDeviceMonitor(MsgDeviceMonitor), MsgCommandReq(MsgCommandReq), - MsgCommandResp(MsgCommandResp), - MsgCommandOutput(MsgCommandOutput), - MsgNetworkStateReq(MsgNetworkStateReq), - MsgNetworkStateResp(MsgNetworkStateResp), - MsgNetworkBandwidthUsage(MsgNetworkBandwidthUsage), - MsgCellModemStatus(MsgCellModemStatus), - MsgSpecanDep(MsgSpecanDep), - MsgSpecan(MsgSpecan), - MsgFrontEndGain(MsgFrontEndGain), + MsgGroupDelayDepB(MsgGroupDelayDepB), + MsgGroupDelay(MsgGroupDelay), + MsgAlmanacGPSDep(MsgAlmanacGPSDep), + MsgAlmanacGPS(MsgAlmanacGPS), + MsgAlmanacGloDep(MsgAlmanacGloDep), + MsgAlmanacGlo(MsgAlmanacGlo), + MsgGloBiases(MsgGloBiases), + MsgSvAzEl(MsgSvAzEl), + MsgOsr(MsgOsr), MsgImuRaw(MsgImuRaw), MsgImuAux(MsgImuAux), - MsgBootloaderHandshakeReq(MsgBootloaderHandshakeReq), - MsgBootloaderHandshakeResp(MsgBootloaderHandshakeResp), - MsgBootloaderJumpToApp(MsgBootloaderJumpToApp), - MsgNapDeviceDnaReq(MsgNapDeviceDnaReq), - MsgNapDeviceDnaResp(MsgNapDeviceDnaResp), - MsgBootloaderHandshakeDepA(MsgBootloaderHandshakeDepA), MsgFlashProgram(MsgFlashProgram), MsgFlashDone(MsgFlashDone), MsgFlashReadReq(MsgFlashReadReq), @@ -316,40 +368,7 @@ pub enum SBP { MsgStmUniqueIdReq(MsgStmUniqueIdReq), MsgStmUniqueIdResp(MsgStmUniqueIdResp), MsgM25FlashWriteStatus(MsgM25FlashWriteStatus), - MsgLog(MsgLog), - MsgFwd(MsgFwd), - MsgPrintDep(MsgPrintDep), - MsgExtEvent(MsgExtEvent), - MsgSbasRaw(MsgSbasRaw), - MsgUserData(MsgUserData), - MsgMagRaw(MsgMagRaw), - MsgNdbEvent(MsgNdbEvent), - MsgLinuxCpuState(MsgLinuxCpuState), - MsgLinuxMemState(MsgLinuxMemState), - MsgLinuxSysState(MsgLinuxSysState), - MsgLinuxProcessSocketCounts(MsgLinuxProcessSocketCounts), - MsgLinuxProcessSocketQueues(MsgLinuxProcessSocketQueues), - MsgLinuxSocketUsage(MsgLinuxSocketUsage), - MsgLinuxProcessFdCount(MsgLinuxProcessFdCount), - MsgLinuxProcessFdSummary(MsgLinuxProcessFdSummary), - MsgObs(MsgObs), - MsgBasePosLLH(MsgBasePosLLH), - MsgBasePosECEF(MsgBasePosECEF), - MsgEphemerisGPSDepE(MsgEphemerisGPSDepE), - MsgEphemerisGPSDepF(MsgEphemerisGPSDepF), - MsgEphemerisGPS(MsgEphemerisGPS), - MsgEphemerisQzss(MsgEphemerisQzss), - MsgEphemerisBds(MsgEphemerisBds), - MsgEphemerisGalDepA(MsgEphemerisGalDepA), - MsgEphemerisGal(MsgEphemerisGal), - MsgEphemerisSbasDepA(MsgEphemerisSbasDepA), - MsgEphemerisGloDepA(MsgEphemerisGloDepA), - MsgEphemerisSbasDepB(MsgEphemerisSbasDepB), - MsgEphemerisSbas(MsgEphemerisSbas), - MsgEphemerisGloDepB(MsgEphemerisGloDepB), - MsgEphemerisGloDepC(MsgEphemerisGloDepC), - MsgEphemerisGloDepD(MsgEphemerisGloDepD), - MsgEphemerisGlo(MsgEphemerisGlo), + MsgTrackingStateDetailedDepA(MsgTrackingStateDetailedDepA), MsgEphemerisDepD(MsgEphemerisDepD), MsgEphemerisDepA(MsgEphemerisDepA), MsgEphemerisDepB(MsgEphemerisDepB), @@ -361,87 +380,253 @@ pub enum SBP { MsgSvConfigurationGPSDep(MsgSvConfigurationGPSDep), MsgGnssCapb(MsgGnssCapb), MsgGroupDelayDepA(MsgGroupDelayDepA), - MsgGroupDelayDepB(MsgGroupDelayDepB), - MsgGroupDelay(MsgGroupDelay), - MsgAlmanacGPSDep(MsgAlmanacGPSDep), - MsgAlmanacGPS(MsgAlmanacGPS), - MsgAlmanacGloDep(MsgAlmanacGloDep), - MsgAlmanacGlo(MsgAlmanacGlo), - MsgGloBiases(MsgGloBiases), - MsgSvAzEl(MsgSvAzEl), - MsgOsr(MsgOsr), - MsgOdometry(MsgOdometry), - MsgSettingsSave(MsgSettingsSave), - MsgSettingsWrite(MsgSettingsWrite), - MsgSettingsWriteResp(MsgSettingsWriteResp), - MsgSettingsReadReq(MsgSettingsReadReq), - MsgSettingsReadResp(MsgSettingsReadResp), - MsgSettingsReadByIndexReq(MsgSettingsReadByIndexReq), - MsgSettingsReadByIndexResp(MsgSettingsReadByIndexResp), - MsgSettingsReadByIndexDone(MsgSettingsReadByIndexDone), - MsgSettingsRegister(MsgSettingsRegister), - MsgSettingsRegisterResp(MsgSettingsRegisterResp), - MsgFileioReadReq(MsgFileioReadReq), - MsgFileioReadResp(MsgFileioReadResp), - MsgFileioReadDirReq(MsgFileioReadDirReq), - MsgFileioReadDirResp(MsgFileioReadDirResp), - MsgFileioRemove(MsgFileioRemove), - MsgFileioWriteReq(MsgFileioWriteReq), - MsgFileioWriteResp(MsgFileioWriteResp), - MsgFileioConfigReq(MsgFileioConfigReq), - MsgFileioConfigResp(MsgFileioConfigResp), + MsgEphemerisGalDepA(MsgEphemerisGalDepA), + MsgEphemerisGal(MsgEphemerisGal), + MsgEphemerisSbasDepA(MsgEphemerisSbasDepA), + MsgEphemerisGloDepA(MsgEphemerisGloDepA), + MsgEphemerisSbasDepB(MsgEphemerisSbasDepB), + MsgEphemerisSbas(MsgEphemerisSbas), + MsgEphemerisGloDepB(MsgEphemerisGloDepB), + MsgEphemerisGloDepC(MsgEphemerisGloDepC), + MsgEphemerisGloDepD(MsgEphemerisGloDepD), + MsgEphemerisGlo(MsgEphemerisGlo), } impl SBP { pub fn parse(msg_id: u16, sender_id: u16, payload: &mut &[u8]) -> Result { let x: Result = match msg_id { - 258 => { - let mut msg = MsgGPSTime::parse(payload)?; + 531 => { + let mut msg = MsgVelBody::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgGPSTime(msg)) + Ok(SBP::MsgVelBody(msg)) } - 259 => { - let mut msg = MsgUtcTime::parse(payload)?; + 528 => { + let mut msg = MsgAgeCorrections::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgUtcTime(msg)) + Ok(SBP::MsgAgeCorrections(msg)) } - 520 => { - let mut msg = MsgDops::parse(payload)?; + 256 => { + let mut msg = MsgGPSTimeDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgDops(msg)) + Ok(SBP::MsgGPSTimeDepA(msg)) } - 521 => { - let mut msg = MsgPosECEF::parse(payload)?; + 518 => { + let mut msg = MsgDopsDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPosECEF(msg)) + Ok(SBP::MsgDopsDepA(msg)) } - 532 => { - let mut msg = MsgPosECEFCov::parse(payload)?; + 512 => { + let mut msg = MsgPosECEFDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPosECEFCov(msg)) + Ok(SBP::MsgPosECEFDepA(msg)) } - 522 => { - let mut msg = MsgPosLLH::parse(payload)?; + 513 => { + let mut msg = MsgPosLLHDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPosLLH(msg)) + Ok(SBP::MsgPosLLHDepA(msg)) } - 529 => { - let mut msg = MsgPosLLHCov::parse(payload)?; + 514 => { + let mut msg = MsgBaselineECEFDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPosLLHCov(msg)) + Ok(SBP::MsgBaselineECEFDepA(msg)) } - 523 => { - let mut msg = MsgBaselineECEF::parse(payload)?; + 515 => { + let mut msg = MsgBaselineNEDDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineECEF(msg)) + Ok(SBP::MsgBaselineNEDDepA(msg)) } - 524 => { - let mut msg = MsgBaselineNED::parse(payload)?; + 516 => { + let mut msg = MsgVelECEFDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineNED(msg)) + Ok(SBP::MsgVelECEFDepA(msg)) } - 525 => { - let mut msg = MsgVelECEF::parse(payload)?; + 517 => { + let mut msg = MsgVelNEDDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgVelNEDDepA(msg)) + } + 519 => { + let mut msg = MsgBaselineHeadingDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBaselineHeadingDepA(msg)) + } + 1501 => { + let mut msg = MsgSsrOrbitClock::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrOrbitClock(msg)) + } + 1500 => { + let mut msg = MsgSsrOrbitClockDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrOrbitClockDepA(msg)) + } + 1505 => { + let mut msg = MsgSsrCodeBiases::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrCodeBiases(msg)) + } + 1510 => { + let mut msg = MsgSsrPhaseBiases::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrPhaseBiases(msg)) + } + 1515 => { + let mut msg = MsgSsrStecCorrection::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrStecCorrection(msg)) + } + 1520 => { + let mut msg = MsgSsrGriddedCorrection::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrGriddedCorrection(msg)) + } + 1525 => { + let mut msg = MsgSsrGridDefinition::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrGridDefinition(msg)) + } + 2306 => { + let mut msg = MsgMagRaw::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgMagRaw(msg)) + } + 1024 => { + let mut msg = MsgNdbEvent::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgNdbEvent(msg)) + } + 527 => { + let mut msg = MsgBaselineHeading::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBaselineHeading(msg)) + } + 544 => { + let mut msg = MsgOrientQuat::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgOrientQuat(msg)) + } + 545 => { + let mut msg = MsgOrientEuler::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgOrientEuler(msg)) + } + 546 => { + let mut msg = MsgAngularRate::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAngularRate(msg)) + } + 74 => { + let mut msg = MsgObs::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgObs(msg)) + } + 68 => { + let mut msg = MsgBasePosLLH::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBasePosLLH(msg)) + } + 72 => { + let mut msg = MsgBasePosECEF::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBasePosECEF(msg)) + } + 134 => { + let mut msg = MsgEphemerisGPSDepF::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGPSDepF(msg)) + } + 138 => { + let mut msg = MsgEphemerisGPS::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGPS(msg)) + } + 129 => { + let mut msg = MsgEphemerisGPSDepE::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGPSDepE(msg)) + } + 142 => { + let mut msg = MsgEphemerisQzss::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisQzss(msg)) + } + 137 => { + let mut msg = MsgEphemerisBds::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisBds(msg)) + } + 32516 => { + let mut msg = MsgLinuxProcessSocketQueues::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxProcessSocketQueues(msg)) + } + 32517 => { + let mut msg = MsgLinuxSocketUsage::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxSocketUsage(msg)) + } + 32518 => { + let mut msg = MsgLinuxProcessFdCount::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxProcessFdCount(msg)) + } + 32519 => { + let mut msg = MsgLinuxProcessFdSummary::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxProcessFdSummary(msg)) + } + 2048 => { + let mut msg = MsgUserData::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgUserData(msg)) + } + 258 => { + let mut msg = MsgGPSTime::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgGPSTime(msg)) + } + 259 => { + let mut msg = MsgUtcTime::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgUtcTime(msg)) + } + 520 => { + let mut msg = MsgDops::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgDops(msg)) + } + 521 => { + let mut msg = MsgPosECEF::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgPosECEF(msg)) + } + 532 => { + let mut msg = MsgPosECEFCov::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgPosECEFCov(msg)) + } + 522 => { + let mut msg = MsgPosLLH::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgPosLLH(msg)) + } + 529 => { + let mut msg = MsgPosLLHCov::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgPosLLHCov(msg)) + } + 523 => { + let mut msg = MsgBaselineECEF::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBaselineECEF(msg)) + } + 524 => { + let mut msg = MsgBaselineNED::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBaselineNED(msg)) + } + 525 => { + let mut msg = MsgVelECEF::parse(payload)?; msg.set_sender_id(sender_id); Ok(SBP::MsgVelECEF(msg)) } @@ -460,190 +645,290 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgVelNEDCov(msg)) } - 531 => { - let mut msg = MsgVelBody::parse(payload)?; + 185 => { + let mut msg = MsgCommandResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgVelBody(msg)) + Ok(SBP::MsgCommandResp(msg)) } - 528 => { - let mut msg = MsgAgeCorrections::parse(payload)?; + 188 => { + let mut msg = MsgCommandOutput::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAgeCorrections(msg)) + Ok(SBP::MsgCommandOutput(msg)) } - 256 => { - let mut msg = MsgGPSTimeDepA::parse(payload)?; + 186 => { + let mut msg = MsgNetworkStateReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgGPSTimeDepA(msg)) + Ok(SBP::MsgNetworkStateReq(msg)) } - 518 => { - let mut msg = MsgDopsDepA::parse(payload)?; + 187 => { + let mut msg = MsgNetworkStateResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgDopsDepA(msg)) + Ok(SBP::MsgNetworkStateResp(msg)) } - 512 => { - let mut msg = MsgPosECEFDepA::parse(payload)?; + 189 => { + let mut msg = MsgNetworkBandwidthUsage::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPosECEFDepA(msg)) + Ok(SBP::MsgNetworkBandwidthUsage(msg)) } - 513 => { - let mut msg = MsgPosLLHDepA::parse(payload)?; + 190 => { + let mut msg = MsgCellModemStatus::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPosLLHDepA(msg)) + Ok(SBP::MsgCellModemStatus(msg)) } - 514 => { - let mut msg = MsgBaselineECEFDepA::parse(payload)?; + 80 => { + let mut msg = MsgSpecanDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineECEFDepA(msg)) + Ok(SBP::MsgSpecanDep(msg)) } - 515 => { - let mut msg = MsgBaselineNEDDepA::parse(payload)?; + 81 => { + let mut msg = MsgSpecan::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineNEDDepA(msg)) + Ok(SBP::MsgSpecan(msg)) } - 516 => { - let mut msg = MsgVelECEFDepA::parse(payload)?; + 191 => { + let mut msg = MsgFrontEndGain::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgVelECEFDepA(msg)) + Ok(SBP::MsgFrontEndGain(msg)) } - 517 => { - let mut msg = MsgVelNEDDepA::parse(payload)?; + 65280 => { + let mut msg = MsgStartup::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgVelNEDDepA(msg)) + Ok(SBP::MsgStartup(msg)) } - 519 => { - let mut msg = MsgBaselineHeadingDepA::parse(payload)?; + 65282 => { + let mut msg = MsgDgnssStatus::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineHeadingDepA(msg)) + Ok(SBP::MsgDgnssStatus(msg)) } - 33 => { - let mut msg = MsgTrackingStateDetailedDepA::parse(payload)?; + 65535 => { + let mut msg = MsgHeartbeat::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingStateDetailedDepA(msg)) + Ok(SBP::MsgHeartbeat(msg)) } - 17 => { - let mut msg = MsgTrackingStateDetailedDep::parse(payload)?; + 65283 => { + let mut msg = MsgInsStatus::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingStateDetailedDep(msg)) + Ok(SBP::MsgInsStatus(msg)) } - 65 => { - let mut msg = MsgTrackingState::parse(payload)?; + 65284 => { + let mut msg = MsgCsacTelemetry::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingState(msg)) + Ok(SBP::MsgCsacTelemetry(msg)) } - 97 => { - let mut msg = MsgMeasurementState::parse(payload)?; + 65285 => { + let mut msg = MsgCsacTelemetryLabels::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgMeasurementState(msg)) + Ok(SBP::MsgCsacTelemetryLabels(msg)) } - 45 => { - let mut msg = MsgTrackingIq::parse(payload)?; + 179 => { + let mut msg = MsgBootloaderHandshakeReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingIq(msg)) + Ok(SBP::MsgBootloaderHandshakeReq(msg)) } - 44 => { - let mut msg = MsgTrackingIqDepB::parse(payload)?; + 180 => { + let mut msg = MsgBootloaderHandshakeResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingIqDepB(msg)) + Ok(SBP::MsgBootloaderHandshakeResp(msg)) } - 28 => { - let mut msg = MsgTrackingIqDepA::parse(payload)?; + 177 => { + let mut msg = MsgBootloaderJumpToApp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingIqDepA(msg)) + Ok(SBP::MsgBootloaderJumpToApp(msg)) } - 22 => { - let mut msg = MsgTrackingStateDepA::parse(payload)?; + 222 => { + let mut msg = MsgNapDeviceDnaReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingStateDepA(msg)) + Ok(SBP::MsgNapDeviceDnaReq(msg)) } - 19 => { - let mut msg = MsgTrackingStateDepB::parse(payload)?; + 221 => { + let mut msg = MsgNapDeviceDnaResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingStateDepB(msg)) + Ok(SBP::MsgNapDeviceDnaResp(msg)) } - 1501 => { - let mut msg = MsgSsrOrbitClock::parse(payload)?; + 176 => { + let mut msg = MsgBootloaderHandshakeDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrOrbitClock(msg)) + Ok(SBP::MsgBootloaderHandshakeDepA(msg)) } - 1500 => { - let mut msg = MsgSsrOrbitClockDepA::parse(payload)?; + 161 => { + let mut msg = MsgSettingsSave::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrOrbitClockDepA(msg)) + Ok(SBP::MsgSettingsSave(msg)) } - 1505 => { - let mut msg = MsgSsrCodeBiases::parse(payload)?; + 160 => { + let mut msg = MsgSettingsWrite::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrCodeBiases(msg)) + Ok(SBP::MsgSettingsWrite(msg)) } - 1510 => { - let mut msg = MsgSsrPhaseBiases::parse(payload)?; + 175 => { + let mut msg = MsgSettingsWriteResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrPhaseBiases(msg)) + Ok(SBP::MsgSettingsWriteResp(msg)) } - 1515 => { - let mut msg = MsgSsrStecCorrection::parse(payload)?; + 164 => { + let mut msg = MsgSettingsReadReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrStecCorrection(msg)) + Ok(SBP::MsgSettingsReadReq(msg)) } - 1520 => { - let mut msg = MsgSsrGriddedCorrection::parse(payload)?; + 165 => { + let mut msg = MsgSettingsReadResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrGriddedCorrection(msg)) + Ok(SBP::MsgSettingsReadResp(msg)) } - 1525 => { - let mut msg = MsgSsrGridDefinition::parse(payload)?; + 162 => { + let mut msg = MsgSettingsReadByIndexReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrGridDefinition(msg)) + Ok(SBP::MsgSettingsReadByIndexReq(msg)) } - 527 => { - let mut msg = MsgBaselineHeading::parse(payload)?; + 167 => { + let mut msg = MsgSettingsReadByIndexResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineHeading(msg)) + Ok(SBP::MsgSettingsReadByIndexResp(msg)) } - 544 => { - let mut msg = MsgOrientQuat::parse(payload)?; + 166 => { + let mut msg = MsgSettingsReadByIndexDone::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgOrientQuat(msg)) + Ok(SBP::MsgSettingsReadByIndexDone(msg)) } - 545 => { - let mut msg = MsgOrientEuler::parse(payload)?; + 174 => { + let mut msg = MsgSettingsRegister::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgOrientEuler(msg)) + Ok(SBP::MsgSettingsRegister(msg)) } - 546 => { - let mut msg = MsgAngularRate::parse(payload)?; + 431 => { + let mut msg = MsgSettingsRegisterResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAngularRate(msg)) + Ok(SBP::MsgSettingsRegisterResp(msg)) } - 65280 => { - let mut msg = MsgStartup::parse(payload)?; + 1025 => { + let mut msg = MsgLog::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgStartup(msg)) + Ok(SBP::MsgLog(msg)) } - 65282 => { - let mut msg = MsgDgnssStatus::parse(payload)?; + 1026 => { + let mut msg = MsgFwd::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgDgnssStatus(msg)) + Ok(SBP::MsgFwd(msg)) } - 65535 => { - let mut msg = MsgHeartbeat::parse(payload)?; + 16 => { + let mut msg = MsgPrintDep::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgPrintDep(msg)) + } + 168 => { + let mut msg = MsgFileioReadReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadReq(msg)) + } + 163 => { + let mut msg = MsgFileioReadResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadResp(msg)) + } + 169 => { + let mut msg = MsgFileioReadDirReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadDirReq(msg)) + } + 170 => { + let mut msg = MsgFileioReadDirResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadDirResp(msg)) + } + 172 => { + let mut msg = MsgFileioRemove::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioRemove(msg)) + } + 173 => { + let mut msg = MsgFileioWriteReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioWriteReq(msg)) + } + 171 => { + let mut msg = MsgFileioWriteResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioWriteResp(msg)) + } + 4097 => { + let mut msg = MsgFileioConfigReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioConfigReq(msg)) + } + 4098 => { + let mut msg = MsgFileioConfigResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioConfigResp(msg)) + } + 32512 => { + let mut msg = MsgLinuxCpuState::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxCpuState(msg)) + } + 32513 => { + let mut msg = MsgLinuxMemState::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxMemState(msg)) + } + 32514 => { + let mut msg = MsgLinuxSysState::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxSysState(msg)) + } + 32515 => { + let mut msg = MsgLinuxProcessSocketCounts::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxProcessSocketCounts(msg)) + } + 17 => { + let mut msg = MsgTrackingStateDetailedDep::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingStateDetailedDep(msg)) + } + 65 => { + let mut msg = MsgTrackingState::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingState(msg)) + } + 97 => { + let mut msg = MsgMeasurementState::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgMeasurementState(msg)) + } + 45 => { + let mut msg = MsgTrackingIq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingIq(msg)) + } + 44 => { + let mut msg = MsgTrackingIqDepB::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingIqDepB(msg)) + } + 28 => { + let mut msg = MsgTrackingIqDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingIqDepA(msg)) + } + 22 => { + let mut msg = MsgTrackingStateDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgHeartbeat(msg)) + Ok(SBP::MsgTrackingStateDepA(msg)) } - 65283 => { - let mut msg = MsgInsStatus::parse(payload)?; + 19 => { + let mut msg = MsgTrackingStateDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgInsStatus(msg)) + Ok(SBP::MsgTrackingStateDepB(msg)) } - 65284 => { - let mut msg = MsgCsacTelemetry::parse(payload)?; + 257 => { + let mut msg = MsgExtEvent::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCsacTelemetry(msg)) + Ok(SBP::MsgExtEvent(msg)) } - 65285 => { - let mut msg = MsgCsacTelemetryLabels::parse(payload)?; + 30583 => { + let mut msg = MsgSbasRaw::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCsacTelemetryLabels(msg)) + Ok(SBP::MsgSbasRaw(msg)) } 47 => { let mut msg = MsgAcqResult::parse(payload)?; @@ -675,6 +960,11 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgAcqSvProfileDep(msg)) } + 2307 => { + let mut msg = MsgOdometry::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgOdometry(msg)) + } 105 => { let mut msg = MsgAlmanac::parse(payload)?; msg.set_sender_id(sender_id); @@ -755,310 +1045,115 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgCommandReq(msg)) } - 185 => { - let mut msg = MsgCommandResp::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgCommandResp(msg)) - } - 188 => { - let mut msg = MsgCommandOutput::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgCommandOutput(msg)) - } - 186 => { - let mut msg = MsgNetworkStateReq::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgNetworkStateReq(msg)) - } - 187 => { - let mut msg = MsgNetworkStateResp::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgNetworkStateResp(msg)) - } - 189 => { - let mut msg = MsgNetworkBandwidthUsage::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgNetworkBandwidthUsage(msg)) - } - 190 => { - let mut msg = MsgCellModemStatus::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgCellModemStatus(msg)) - } - 80 => { - let mut msg = MsgSpecanDep::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSpecanDep(msg)) - } - 81 => { - let mut msg = MsgSpecan::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSpecan(msg)) - } - 191 => { - let mut msg = MsgFrontEndGain::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgFrontEndGain(msg)) - } - 2304 => { - let mut msg = MsgImuRaw::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgImuRaw(msg)) - } - 2305 => { - let mut msg = MsgImuAux::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgImuAux(msg)) - } - 179 => { - let mut msg = MsgBootloaderHandshakeReq::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgBootloaderHandshakeReq(msg)) - } - 180 => { - let mut msg = MsgBootloaderHandshakeResp::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgBootloaderHandshakeResp(msg)) - } - 177 => { - let mut msg = MsgBootloaderJumpToApp::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgBootloaderJumpToApp(msg)) - } - 222 => { - let mut msg = MsgNapDeviceDnaReq::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgNapDeviceDnaReq(msg)) - } - 221 => { - let mut msg = MsgNapDeviceDnaResp::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgNapDeviceDnaResp(msg)) - } - 176 => { - let mut msg = MsgBootloaderHandshakeDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgBootloaderHandshakeDepA(msg)) - } - 230 => { - let mut msg = MsgFlashProgram::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgFlashProgram(msg)) - } - 224 => { - let mut msg = MsgFlashDone::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgFlashDone(msg)) - } - 231 => { - let mut msg = MsgFlashReadReq::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgFlashReadReq(msg)) - } - 225 => { - let mut msg = MsgFlashReadResp::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgFlashReadResp(msg)) - } - 226 => { - let mut msg = MsgFlashErase::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgFlashErase(msg)) - } - 227 => { - let mut msg = MsgStmFlashLockSector::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgStmFlashLockSector(msg)) - } - 228 => { - let mut msg = MsgStmFlashUnlockSector::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgStmFlashUnlockSector(msg)) - } - 232 => { - let mut msg = MsgStmUniqueIdReq::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgStmUniqueIdReq(msg)) - } - 229 => { - let mut msg = MsgStmUniqueIdResp::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgStmUniqueIdResp(msg)) - } - 243 => { - let mut msg = MsgM25FlashWriteStatus::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgM25FlashWriteStatus(msg)) - } - 1025 => { - let mut msg = MsgLog::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgLog(msg)) - } - 1026 => { - let mut msg = MsgFwd::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgFwd(msg)) - } - 16 => { - let mut msg = MsgPrintDep::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgPrintDep(msg)) - } - 257 => { - let mut msg = MsgExtEvent::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgExtEvent(msg)) - } - 30583 => { - let mut msg = MsgSbasRaw::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSbasRaw(msg)) - } - 2048 => { - let mut msg = MsgUserData::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgUserData(msg)) - } - 2306 => { - let mut msg = MsgMagRaw::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgMagRaw(msg)) - } - 1024 => { - let mut msg = MsgNdbEvent::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgNdbEvent(msg)) - } - 32512 => { - let mut msg = MsgLinuxCpuState::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxCpuState(msg)) - } - 32513 => { - let mut msg = MsgLinuxMemState::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxMemState(msg)) - } - 32514 => { - let mut msg = MsgLinuxSysState::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxSysState(msg)) - } - 32515 => { - let mut msg = MsgLinuxProcessSocketCounts::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxProcessSocketCounts(msg)) - } - 32516 => { - let mut msg = MsgLinuxProcessSocketQueues::parse(payload)?; + 147 => { + let mut msg = MsgGroupDelayDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxProcessSocketQueues(msg)) + Ok(SBP::MsgGroupDelayDepB(msg)) } - 32517 => { - let mut msg = MsgLinuxSocketUsage::parse(payload)?; + 148 => { + let mut msg = MsgGroupDelay::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxSocketUsage(msg)) + Ok(SBP::MsgGroupDelay(msg)) } - 32518 => { - let mut msg = MsgLinuxProcessFdCount::parse(payload)?; + 112 => { + let mut msg = MsgAlmanacGPSDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxProcessFdCount(msg)) + Ok(SBP::MsgAlmanacGPSDep(msg)) } - 32519 => { - let mut msg = MsgLinuxProcessFdSummary::parse(payload)?; + 114 => { + let mut msg = MsgAlmanacGPS::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxProcessFdSummary(msg)) + Ok(SBP::MsgAlmanacGPS(msg)) } - 74 => { - let mut msg = MsgObs::parse(payload)?; + 113 => { + let mut msg = MsgAlmanacGloDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgObs(msg)) - } - 68 => { - let mut msg = MsgBasePosLLH::parse(payload)?; + Ok(SBP::MsgAlmanacGloDep(msg)) + } + 115 => { + let mut msg = MsgAlmanacGlo::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBasePosLLH(msg)) + Ok(SBP::MsgAlmanacGlo(msg)) } - 72 => { - let mut msg = MsgBasePosECEF::parse(payload)?; + 117 => { + let mut msg = MsgGloBiases::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBasePosECEF(msg)) + Ok(SBP::MsgGloBiases(msg)) } - 129 => { - let mut msg = MsgEphemerisGPSDepE::parse(payload)?; + 151 => { + let mut msg = MsgSvAzEl::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGPSDepE(msg)) + Ok(SBP::MsgSvAzEl(msg)) } - 134 => { - let mut msg = MsgEphemerisGPSDepF::parse(payload)?; + 1600 => { + let mut msg = MsgOsr::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGPSDepF(msg)) + Ok(SBP::MsgOsr(msg)) } - 138 => { - let mut msg = MsgEphemerisGPS::parse(payload)?; + 2304 => { + let mut msg = MsgImuRaw::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGPS(msg)) + Ok(SBP::MsgImuRaw(msg)) } - 142 => { - let mut msg = MsgEphemerisQzss::parse(payload)?; + 2305 => { + let mut msg = MsgImuAux::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisQzss(msg)) + Ok(SBP::MsgImuAux(msg)) } - 137 => { - let mut msg = MsgEphemerisBds::parse(payload)?; + 230 => { + let mut msg = MsgFlashProgram::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisBds(msg)) + Ok(SBP::MsgFlashProgram(msg)) } - 149 => { - let mut msg = MsgEphemerisGalDepA::parse(payload)?; + 224 => { + let mut msg = MsgFlashDone::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGalDepA(msg)) + Ok(SBP::MsgFlashDone(msg)) } - 141 => { - let mut msg = MsgEphemerisGal::parse(payload)?; + 231 => { + let mut msg = MsgFlashReadReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGal(msg)) + Ok(SBP::MsgFlashReadReq(msg)) } - 130 => { - let mut msg = MsgEphemerisSbasDepA::parse(payload)?; + 225 => { + let mut msg = MsgFlashReadResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisSbasDepA(msg)) + Ok(SBP::MsgFlashReadResp(msg)) } - 131 => { - let mut msg = MsgEphemerisGloDepA::parse(payload)?; + 226 => { + let mut msg = MsgFlashErase::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGloDepA(msg)) + Ok(SBP::MsgFlashErase(msg)) } - 132 => { - let mut msg = MsgEphemerisSbasDepB::parse(payload)?; + 227 => { + let mut msg = MsgStmFlashLockSector::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisSbasDepB(msg)) + Ok(SBP::MsgStmFlashLockSector(msg)) } - 140 => { - let mut msg = MsgEphemerisSbas::parse(payload)?; + 228 => { + let mut msg = MsgStmFlashUnlockSector::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisSbas(msg)) + Ok(SBP::MsgStmFlashUnlockSector(msg)) } - 133 => { - let mut msg = MsgEphemerisGloDepB::parse(payload)?; + 232 => { + let mut msg = MsgStmUniqueIdReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGloDepB(msg)) + Ok(SBP::MsgStmUniqueIdReq(msg)) } - 135 => { - let mut msg = MsgEphemerisGloDepC::parse(payload)?; + 229 => { + let mut msg = MsgStmUniqueIdResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGloDepC(msg)) + Ok(SBP::MsgStmUniqueIdResp(msg)) } - 136 => { - let mut msg = MsgEphemerisGloDepD::parse(payload)?; + 243 => { + let mut msg = MsgM25FlashWriteStatus::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGloDepD(msg)) + Ok(SBP::MsgM25FlashWriteStatus(msg)) } - 139 => { - let mut msg = MsgEphemerisGlo::parse(payload)?; + 33 => { + let mut msg = MsgTrackingStateDetailedDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGlo(msg)) + Ok(SBP::MsgTrackingStateDetailedDepA(msg)) } 128 => { let mut msg = MsgEphemerisDepD::parse(payload)?; @@ -1115,150 +1210,55 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgGroupDelayDepA(msg)) } - 147 => { - let mut msg = MsgGroupDelayDepB::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgGroupDelayDepB(msg)) - } - 148 => { - let mut msg = MsgGroupDelay::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgGroupDelay(msg)) - } - 112 => { - let mut msg = MsgAlmanacGPSDep::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanacGPSDep(msg)) - } - 114 => { - let mut msg = MsgAlmanacGPS::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanacGPS(msg)) - } - 113 => { - let mut msg = MsgAlmanacGloDep::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanacGloDep(msg)) - } - 115 => { - let mut msg = MsgAlmanacGlo::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanacGlo(msg)) - } - 117 => { - let mut msg = MsgGloBiases::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgGloBiases(msg)) - } - 151 => { - let mut msg = MsgSvAzEl::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSvAzEl(msg)) - } - 1600 => { - let mut msg = MsgOsr::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgOsr(msg)) - } - 2307 => { - let mut msg = MsgOdometry::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgOdometry(msg)) - } - 161 => { - let mut msg = MsgSettingsSave::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsSave(msg)) - } - 160 => { - let mut msg = MsgSettingsWrite::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsWrite(msg)) - } - 175 => { - let mut msg = MsgSettingsWriteResp::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsWriteResp(msg)) - } - 164 => { - let mut msg = MsgSettingsReadReq::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsReadReq(msg)) - } - 165 => { - let mut msg = MsgSettingsReadResp::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsReadResp(msg)) - } - 162 => { - let mut msg = MsgSettingsReadByIndexReq::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsReadByIndexReq(msg)) - } - 167 => { - let mut msg = MsgSettingsReadByIndexResp::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsReadByIndexResp(msg)) - } - 166 => { - let mut msg = MsgSettingsReadByIndexDone::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsReadByIndexDone(msg)) - } - 174 => { - let mut msg = MsgSettingsRegister::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsRegister(msg)) - } - 431 => { - let mut msg = MsgSettingsRegisterResp::parse(payload)?; + 149 => { + let mut msg = MsgEphemerisGalDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsRegisterResp(msg)) + Ok(SBP::MsgEphemerisGalDepA(msg)) } - 168 => { - let mut msg = MsgFileioReadReq::parse(payload)?; + 141 => { + let mut msg = MsgEphemerisGal::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioReadReq(msg)) + Ok(SBP::MsgEphemerisGal(msg)) } - 163 => { - let mut msg = MsgFileioReadResp::parse(payload)?; + 130 => { + let mut msg = MsgEphemerisSbasDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioReadResp(msg)) + Ok(SBP::MsgEphemerisSbasDepA(msg)) } - 169 => { - let mut msg = MsgFileioReadDirReq::parse(payload)?; + 131 => { + let mut msg = MsgEphemerisGloDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioReadDirReq(msg)) + Ok(SBP::MsgEphemerisGloDepA(msg)) } - 170 => { - let mut msg = MsgFileioReadDirResp::parse(payload)?; + 132 => { + let mut msg = MsgEphemerisSbasDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioReadDirResp(msg)) + Ok(SBP::MsgEphemerisSbasDepB(msg)) } - 172 => { - let mut msg = MsgFileioRemove::parse(payload)?; + 140 => { + let mut msg = MsgEphemerisSbas::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioRemove(msg)) + Ok(SBP::MsgEphemerisSbas(msg)) } - 173 => { - let mut msg = MsgFileioWriteReq::parse(payload)?; + 133 => { + let mut msg = MsgEphemerisGloDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioWriteReq(msg)) + Ok(SBP::MsgEphemerisGloDepB(msg)) } - 171 => { - let mut msg = MsgFileioWriteResp::parse(payload)?; + 135 => { + let mut msg = MsgEphemerisGloDepC::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioWriteResp(msg)) + Ok(SBP::MsgEphemerisGloDepC(msg)) } - 4097 => { - let mut msg = MsgFileioConfigReq::parse(payload)?; + 136 => { + let mut msg = MsgEphemerisGloDepD::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioConfigReq(msg)) + Ok(SBP::MsgEphemerisGloDepD(msg)) } - 4098 => { - let mut msg = MsgFileioConfigResp::parse(payload)?; + 139 => { + let mut msg = MsgEphemerisGlo::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioConfigResp(msg)) + Ok(SBP::MsgEphemerisGlo(msg)) } _ => Ok(SBP::Unknown { msg_id: msg_id, diff --git a/rust/sbp/src/messages/navigation.rs b/rust/sbp/src/messages/navigation.rs index 31bbc46593..7f9419e644 100644 --- a/rust/sbp/src/messages/navigation.rs +++ b/rust/sbp/src/messages/navigation.rs @@ -12,57 +12,57 @@ // Automatically generated from yaml/swiftnav/sbp/navigation.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Geodetic navigation messages reporting GPS time, position, velocity, -// and baseline position solutions. For position solutions, these -// messages define several different position solutions: single-point -// (SPP), RTK, and pseudo-absolute position solutions. -// -// The SPP is the standalone, absolute GPS position solution using only -// a single receiver. The RTK solution is the differential GPS -// solution, which can use either a fixed/integer or floating carrier -// phase ambiguity. The pseudo-absolute position solution uses a -// user-provided, well-surveyed base station position (if available) -// and the RTK solution in tandem. -// -// When the inertial navigation mode indicates that the IMU is used, -// all messages are reported in the vehicle body frame as defined by -// device settings. By default, the vehicle body frame is configured to be -// coincident with the antenna phase center. When there is no inertial -// navigation, the solution will be reported at the phase center of the antenna. -// There is no inertial navigation capability on Piksi Multi or Duro. +/// Geodetic navigation messages reporting GPS time, position, velocity, +/// and baseline position solutions. For position solutions, these +/// messages define several different position solutions: single-point +/// (SPP), RTK, and pseudo-absolute position solutions. +/// +/// The SPP is the standalone, absolute GPS position solution using only +/// a single receiver. The RTK solution is the differential GPS +/// solution, which can use either a fixed/integer or floating carrier +/// phase ambiguity. The pseudo-absolute position solution uses a +/// user-provided, well-surveyed base station position (if available) +/// and the RTK solution in tandem. +/// +/// When the inertial navigation mode indicates that the IMU is used, +/// all messages are reported in the vehicle body frame as defined by +/// device settings. By default, the vehicle body frame is configured to be +/// coincident with the antenna phase center. When there is no inertial +/// navigation, the solution will be reported at the phase center of the antenna. +/// There is no inertial navigation capability on Piksi Multi or Duro. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; -// GPS Time -// -// This message reports the GPS time, representing the time since -// the GPS epoch began on midnight January 6, 1980 UTC. GPS time -// counts the weeks and seconds of the week. The weeks begin at the -// Saturday/Sunday transition. GPS week 0 began at the beginning of -// the GPS time scale. -// -// Within each week number, the GPS time of the week is between -// between 0 and 604800 seconds (=60*60*24*7). Note that GPS time -// does not accumulate leap seconds, and as of now, has a small -// offset from UTC. In a message stream, this message precedes a -// set of other navigation messages referenced to the same time -// (but lacking the ns field) and indicates a more precise time of -// these messages. -// +/// GPS Time +/// +/// This message reports the GPS time, representing the time since +/// the GPS epoch began on midnight January 6, 1980 UTC. GPS time +/// counts the weeks and seconds of the week. The weeks begin at the +/// Saturday/Sunday transition. GPS week 0 began at the beginning of +/// the GPS time scale. +/// +/// Within each week number, the GPS time of the week is between +/// between 0 and 604800 seconds (=60*60*24*7). Note that GPS time +/// does not accumulate leap seconds, and as of now, has a small +/// offset from UTC. In a message stream, this message precedes a +/// set of other navigation messages referenced to the same time +/// (but lacking the ns field) and indicates a more precise time of +/// these messages. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgGPSTime { pub sender_id: Option, + /// GPS week number pub wn: u16, - // ^ GPS week number + /// GPS time of week rounded to the nearest millisecond pub tow: u32, - // ^ GPS time of week rounded to the nearest millisecond + /// Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to + /// 500000) pub ns_residual: i32, - // ^ Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to - // 500000) + /// Status flags (reserved) pub flags: u8, - // ^ Status flags (reserved) } impl MsgGPSTime { @@ -88,33 +88,33 @@ impl super::SBPMessage for MsgGPSTime { } } -// UTC Time -// -// This message reports the Universal Coordinated Time (UTC). Note the flags -// which indicate the source of the UTC offset value and source of the time fix. -// +/// UTC Time +/// +/// This message reports the Universal Coordinated Time (UTC). Note the flags +/// which indicate the source of the UTC offset value and source of the time fix. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgUtcTime { pub sender_id: Option, + /// Indicates source and time validity pub flags: u8, - // ^ Indicates source and time validity + /// GPS time of week rounded to the nearest millisecond pub tow: u32, - // ^ GPS time of week rounded to the nearest millisecond + /// Year pub year: u16, - // ^ Year + /// Month (range 1 .. 12) pub month: u8, - // ^ Month (range 1 .. 12) + /// days in the month (range 1-31) pub day: u8, - // ^ days in the month (range 1-31) + /// hours of day (range 0-23) pub hours: u8, - // ^ hours of day (range 0-23) + /// minutes of hour (range 0-59) pub minutes: u8, - // ^ minutes of hour (range 0-59) + /// seconds of minute (range 0-60) rounded down pub seconds: u8, - // ^ seconds of minute (range 0-60) rounded down + /// nanoseconds of second (range 0-999999999) pub ns: u32, - // ^ nanoseconds of second (range 0-999999999) } impl MsgUtcTime { @@ -145,31 +145,31 @@ impl super::SBPMessage for MsgUtcTime { } } -// Dilution of Precision -// -// This dilution of precision (DOP) message describes the effect of -// navigation satellite geometry on positional measurement -// precision. The flags field indicated whether the DOP reported -// corresponds to differential or SPP solution. -// +/// Dilution of Precision +/// +/// This dilution of precision (DOP) message describes the effect of +/// navigation satellite geometry on positional measurement +/// precision. The flags field indicated whether the DOP reported +/// corresponds to differential or SPP solution. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgDops { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Geometric Dilution of Precision pub gdop: u16, - // ^ Geometric Dilution of Precision + /// Position Dilution of Precision pub pdop: u16, - // ^ Position Dilution of Precision + /// Time Dilution of Precision pub tdop: u16, - // ^ Time Dilution of Precision + /// Horizontal Dilution of Precision pub hdop: u16, - // ^ Horizontal Dilution of Precision + /// Vertical Dilution of Precision pub vdop: u16, - // ^ Vertical Dilution of Precision + /// Indicates the position solution with which the DOPS message corresponds pub flags: u8, - // ^ Indicates the position solution with which the DOPS message corresponds } impl MsgDops { @@ -198,35 +198,35 @@ impl super::SBPMessage for MsgDops { } } -// Single-point position in ECEF -// -// The position solution message reports absolute Earth Centered -// Earth Fixed (ECEF) coordinates and the status (single point vs -// pseudo-absolute RTK) of the position solution. If the rover -// receiver knows the surveyed position of the base station and has -// an RTK solution, this reports a pseudo-absolute position -// solution using the base station position and the rover's RTK -// baseline vector. The full GPS time is given by the preceding -// MSG_GPS_TIME with the matching time-of-week (tow). -// +/// Single-point position in ECEF +/// +/// The position solution message reports absolute Earth Centered +/// Earth Fixed (ECEF) coordinates and the status (single point vs +/// pseudo-absolute RTK) of the position solution. If the rover +/// receiver knows the surveyed position of the base station and has +/// an RTK solution, this reports a pseudo-absolute position +/// solution using the base station position and the rover's RTK +/// baseline vector. The full GPS time is given by the preceding +/// MSG_GPS_TIME with the matching time-of-week (tow). +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgPosECEF { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// ECEF X coordinate pub x: f64, - // ^ ECEF X coordinate + /// ECEF Y coordinate pub y: f64, - // ^ ECEF Y coordinate + /// ECEF Z coordinate pub z: f64, - // ^ ECEF Z coordinate + /// Position estimated standard deviation pub accuracy: u16, - // ^ Position estimated standard deviation + /// Number of satellites used in solution pub n_sats: u8, - // ^ Number of satellites used in solution + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgPosECEF { @@ -255,46 +255,46 @@ impl super::SBPMessage for MsgPosECEF { } } -// Single-point position in ECEF -// -// The position solution message reports absolute Earth Centered -// Earth Fixed (ECEF) coordinates and the status (single point vs -// pseudo-absolute RTK) of the position solution. The message also -// reports the upper triangular portion of the 3x3 covariance matrix. -// If the receiver knows the surveyed position of the base station and has -// an RTK solution, this reports a pseudo-absolute position -// solution using the base station position and the rover's RTK -// baseline vector. The full GPS time is given by the preceding -// MSG_GPS_TIME with the matching time-of-week (tow). -// +/// Single-point position in ECEF +/// +/// The position solution message reports absolute Earth Centered +/// Earth Fixed (ECEF) coordinates and the status (single point vs +/// pseudo-absolute RTK) of the position solution. The message also +/// reports the upper triangular portion of the 3x3 covariance matrix. +/// If the receiver knows the surveyed position of the base station and has +/// an RTK solution, this reports a pseudo-absolute position +/// solution using the base station position and the rover's RTK +/// baseline vector. The full GPS time is given by the preceding +/// MSG_GPS_TIME with the matching time-of-week (tow). +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgPosECEFCov { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// ECEF X coordinate pub x: f64, - // ^ ECEF X coordinate + /// ECEF Y coordinate pub y: f64, - // ^ ECEF Y coordinate + /// ECEF Z coordinate pub z: f64, - // ^ ECEF Z coordinate + /// Estimated variance of x pub cov_x_x: f32, - // ^ Estimated variance of x + /// Estimated covariance of x and y pub cov_x_y: f32, - // ^ Estimated covariance of x and y + /// Estimated covariance of x and z pub cov_x_z: f32, - // ^ Estimated covariance of x and z + /// Estimated variance of y pub cov_y_y: f32, - // ^ Estimated variance of y + /// Estimated covariance of y and z pub cov_y_z: f32, - // ^ Estimated covariance of y and z + /// Estimated variance of z pub cov_z_z: f32, - // ^ Estimated variance of z + /// Number of satellites used in solution pub n_sats: u8, - // ^ Number of satellites used in solution + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgPosECEFCov { @@ -328,37 +328,37 @@ impl super::SBPMessage for MsgPosECEFCov { } } -// Geodetic Position -// -// This position solution message reports the absolute geodetic -// coordinates and the status (single point vs pseudo-absolute RTK) -// of the position solution. If the rover receiver knows the -// surveyed position of the base station and has an RTK solution, -// this reports a pseudo-absolute position solution using the base -// station position and the rover's RTK baseline vector. The full -// GPS time is given by the preceding MSG_GPS_TIME with the -// matching time-of-week (tow). -// +/// Geodetic Position +/// +/// This position solution message reports the absolute geodetic +/// coordinates and the status (single point vs pseudo-absolute RTK) +/// of the position solution. If the rover receiver knows the +/// surveyed position of the base station and has an RTK solution, +/// this reports a pseudo-absolute position solution using the base +/// station position and the rover's RTK baseline vector. The full +/// GPS time is given by the preceding MSG_GPS_TIME with the +/// matching time-of-week (tow). +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgPosLLH { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Latitude pub lat: f64, - // ^ Latitude + /// Longitude pub lon: f64, - // ^ Longitude + /// Height above WGS84 ellipsoid pub height: f64, - // ^ Height above WGS84 ellipsoid + /// Horizontal position estimated standard deviation pub h_accuracy: u16, - // ^ Horizontal position estimated standard deviation + /// Vertical position estimated standard deviation pub v_accuracy: u16, - // ^ Vertical position estimated standard deviation + /// Number of satellites used in solution. pub n_sats: u8, - // ^ Number of satellites used in solution. + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgPosLLH { @@ -388,45 +388,45 @@ impl super::SBPMessage for MsgPosLLH { } } -// Geodetic Position -// -// This position solution message reports the absolute geodetic -// coordinates and the status (single point vs pseudo-absolute RTK) -// of the position solution as well as the upper triangle of the 3x3 -// covariance matrix. The position information and Fix Mode flags should -// follow the MSG_POS_LLH message. Since the covariance matrix is computed -// in the local-level North, East, Down frame, the covariance terms follow -// with that convention. Thus, covariances are reported against the "downward" -// measurement and care should be taken with the sign convention. -// +/// Geodetic Position +/// +/// This position solution message reports the absolute geodetic +/// coordinates and the status (single point vs pseudo-absolute RTK) +/// of the position solution as well as the upper triangle of the 3x3 +/// covariance matrix. The position information and Fix Mode flags should +/// follow the MSG_POS_LLH message. Since the covariance matrix is computed +/// in the local-level North, East, Down frame, the covariance terms follow +/// with that convention. Thus, covariances are reported against the "downward" +/// measurement and care should be taken with the sign convention. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgPosLLHCov { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Latitude pub lat: f64, - // ^ Latitude + /// Longitude pub lon: f64, - // ^ Longitude + /// Height above WGS84 ellipsoid pub height: f64, - // ^ Height above WGS84 ellipsoid + /// Estimated variance of northing pub cov_n_n: f32, - // ^ Estimated variance of northing + /// Covariance of northing and easting pub cov_n_e: f32, - // ^ Covariance of northing and easting + /// Covariance of northing and downward measurement pub cov_n_d: f32, - // ^ Covariance of northing and downward measurement + /// Estimated variance of easting pub cov_e_e: f32, - // ^ Estimated variance of easting + /// Covariance of easting and downward measurement pub cov_e_d: f32, - // ^ Covariance of easting and downward measurement + /// Estimated variance of downward measurement pub cov_d_d: f32, - // ^ Estimated variance of downward measurement + /// Number of satellites used in solution. pub n_sats: u8, - // ^ Number of satellites used in solution. + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgPosLLHCov { @@ -460,32 +460,32 @@ impl super::SBPMessage for MsgPosLLHCov { } } -// Baseline Position in ECEF -// -// This message reports the baseline solution in Earth Centered -// Earth Fixed (ECEF) coordinates. This baseline is the relative -// vector distance from the base station to the rover receiver. The -// full GPS time is given by the preceding MSG_GPS_TIME with the -// matching time-of-week (tow). -// +/// Baseline Position in ECEF +/// +/// This message reports the baseline solution in Earth Centered +/// Earth Fixed (ECEF) coordinates. This baseline is the relative +/// vector distance from the base station to the rover receiver. The +/// full GPS time is given by the preceding MSG_GPS_TIME with the +/// matching time-of-week (tow). +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBaselineECEF { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Baseline ECEF X coordinate pub x: i32, - // ^ Baseline ECEF X coordinate + /// Baseline ECEF Y coordinate pub y: i32, - // ^ Baseline ECEF Y coordinate + /// Baseline ECEF Z coordinate pub z: i32, - // ^ Baseline ECEF Z coordinate + /// Position estimated standard deviation pub accuracy: u16, - // ^ Position estimated standard deviation + /// Number of satellites used in solution pub n_sats: u8, - // ^ Number of satellites used in solution + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgBaselineECEF { @@ -514,35 +514,35 @@ impl super::SBPMessage for MsgBaselineECEF { } } -// Baseline in NED -// -// This message reports the baseline solution in North East Down -// (NED) coordinates. This baseline is the relative vector distance -// from the base station to the rover receiver, and NED coordinate -// system is defined at the local WGS84 tangent plane centered at the -// base station position. The full GPS time is given by the -// preceding MSG_GPS_TIME with the matching time-of-week (tow). -// +/// Baseline in NED +/// +/// This message reports the baseline solution in North East Down +/// (NED) coordinates. This baseline is the relative vector distance +/// from the base station to the rover receiver, and NED coordinate +/// system is defined at the local WGS84 tangent plane centered at the +/// base station position. The full GPS time is given by the +/// preceding MSG_GPS_TIME with the matching time-of-week (tow). +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBaselineNED { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Baseline North coordinate pub n: i32, - // ^ Baseline North coordinate + /// Baseline East coordinate pub e: i32, - // ^ Baseline East coordinate + /// Baseline Down coordinate pub d: i32, - // ^ Baseline Down coordinate + /// Horizontal position estimated standard deviation pub h_accuracy: u16, - // ^ Horizontal position estimated standard deviation + /// Vertical position estimated standard deviation pub v_accuracy: u16, - // ^ Vertical position estimated standard deviation + /// Number of satellites used in solution pub n_sats: u8, - // ^ Number of satellites used in solution + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgBaselineNED { @@ -572,30 +572,30 @@ impl super::SBPMessage for MsgBaselineNED { } } -// Velocity in ECEF -// -// This message reports the velocity in Earth Centered Earth Fixed -// (ECEF) coordinates. The full GPS time is given by the preceding -// MSG_GPS_TIME with the matching time-of-week (tow). -// +/// Velocity in ECEF +/// +/// This message reports the velocity in Earth Centered Earth Fixed +/// (ECEF) coordinates. The full GPS time is given by the preceding +/// MSG_GPS_TIME with the matching time-of-week (tow). +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgVelECEF { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Velocity ECEF X coordinate pub x: i32, - // ^ Velocity ECEF X coordinate + /// Velocity ECEF Y coordinate pub y: i32, - // ^ Velocity ECEF Y coordinate + /// Velocity ECEF Z coordinate pub z: i32, - // ^ Velocity ECEF Z coordinate + /// Velocity estimated standard deviation pub accuracy: u16, - // ^ Velocity estimated standard deviation + /// Number of satellites used in solution pub n_sats: u8, - // ^ Number of satellites used in solution + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgVelECEF { @@ -624,40 +624,40 @@ impl super::SBPMessage for MsgVelECEF { } } -// Velocity in ECEF -// -// This message reports the velocity in Earth Centered Earth Fixed -// (ECEF) coordinates. The full GPS time is given by the preceding -// MSG_GPS_TIME with the matching time-of-week (tow). -// +/// Velocity in ECEF +/// +/// This message reports the velocity in Earth Centered Earth Fixed +/// (ECEF) coordinates. The full GPS time is given by the preceding +/// MSG_GPS_TIME with the matching time-of-week (tow). +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgVelECEFCov { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Velocity ECEF X coordinate pub x: i32, - // ^ Velocity ECEF X coordinate + /// Velocity ECEF Y coordinate pub y: i32, - // ^ Velocity ECEF Y coordinate + /// Velocity ECEF Z coordinate pub z: i32, - // ^ Velocity ECEF Z coordinate + /// Estimated variance of x pub cov_x_x: f32, - // ^ Estimated variance of x + /// Estimated covariance of x and y pub cov_x_y: f32, - // ^ Estimated covariance of x and y + /// Estimated covariance of x and z pub cov_x_z: f32, - // ^ Estimated covariance of x and z + /// Estimated variance of y pub cov_y_y: f32, - // ^ Estimated variance of y + /// Estimated covariance of y and z pub cov_y_z: f32, - // ^ Estimated covariance of y and z + /// Estimated variance of z pub cov_z_z: f32, - // ^ Estimated variance of z + /// Number of satellites used in solution pub n_sats: u8, - // ^ Number of satellites used in solution + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgVelECEFCov { @@ -691,33 +691,33 @@ impl super::SBPMessage for MsgVelECEFCov { } } -// Velocity in NED -// -// This message reports the velocity in local North East Down (NED) -// coordinates. The NED coordinate system is defined as the local WGS84 -// tangent plane centered at the current position. The full GPS time is -// given by the preceding MSG_GPS_TIME with the matching time-of-week (tow). -// +/// Velocity in NED +/// +/// This message reports the velocity in local North East Down (NED) +/// coordinates. The NED coordinate system is defined as the local WGS84 +/// tangent plane centered at the current position. The full GPS time is +/// given by the preceding MSG_GPS_TIME with the matching time-of-week (tow). +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgVelNED { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Velocity North coordinate pub n: i32, - // ^ Velocity North coordinate + /// Velocity East coordinate pub e: i32, - // ^ Velocity East coordinate + /// Velocity Down coordinate pub d: i32, - // ^ Velocity Down coordinate + /// Horizontal velocity estimated standard deviation pub h_accuracy: u16, - // ^ Horizontal velocity estimated standard deviation + /// Vertical velocity estimated standard deviation pub v_accuracy: u16, - // ^ Vertical velocity estimated standard deviation + /// Number of satellites used in solution pub n_sats: u8, - // ^ Number of satellites used in solution + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgVelNED { @@ -747,43 +747,43 @@ impl super::SBPMessage for MsgVelNED { } } -// Velocity in NED -// -// This message reports the velocity in local North East Down (NED) -// coordinates. The NED coordinate system is defined as the local WGS84 -// tangent plane centered at the current position. The full GPS time is -// given by the preceding MSG_GPS_TIME with the matching time-of-week (tow). -// This message is similar to the MSG_VEL_NED, but it includes the upper triangular -// portion of the 3x3 covariance matrix. -// +/// Velocity in NED +/// +/// This message reports the velocity in local North East Down (NED) +/// coordinates. The NED coordinate system is defined as the local WGS84 +/// tangent plane centered at the current position. The full GPS time is +/// given by the preceding MSG_GPS_TIME with the matching time-of-week (tow). +/// This message is similar to the MSG_VEL_NED, but it includes the upper triangular +/// portion of the 3x3 covariance matrix. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgVelNEDCov { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Velocity North coordinate pub n: i32, - // ^ Velocity North coordinate + /// Velocity East coordinate pub e: i32, - // ^ Velocity East coordinate + /// Velocity Down coordinate pub d: i32, - // ^ Velocity Down coordinate + /// Estimated variance of northward measurement pub cov_n_n: f32, - // ^ Estimated variance of northward measurement + /// Covariance of northward and eastward measurement pub cov_n_e: f32, - // ^ Covariance of northward and eastward measurement + /// Covariance of northward and downward measurement pub cov_n_d: f32, - // ^ Covariance of northward and downward measurement + /// Estimated variance of eastward measurement pub cov_e_e: f32, - // ^ Estimated variance of eastward measurement + /// Covariance of eastward and downward measurement pub cov_e_d: f32, - // ^ Covariance of eastward and downward measurement + /// Estimated variance of downward measurement pub cov_d_d: f32, - // ^ Estimated variance of downward measurement + /// Number of satellites used in solution pub n_sats: u8, - // ^ Number of satellites used in solution + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgVelNEDCov { @@ -817,45 +817,45 @@ impl super::SBPMessage for MsgVelNEDCov { } } -// Velocity in User Frame -// -// This message reports the velocity in the Vehicle Body Frame. By convention, -// the x-axis should point out the nose of the vehicle and represent the forward -// direction, while as the y-axis should point out the right hand side of the vehicle. -// Since this is a right handed system, z should point out the bottom of the vehicle. -// The orientation and origin of the Vehicle Body Frame are specified via the device settings. -// The full GPS time is given by the preceding MSG_GPS_TIME with the -// matching time-of-week (tow). This message is only produced by inertial versions of Swift -// products and is not available from Piksi Multi or Duro. -// +/// Velocity in User Frame +/// +/// This message reports the velocity in the Vehicle Body Frame. By convention, +/// the x-axis should point out the nose of the vehicle and represent the forward +/// direction, while as the y-axis should point out the right hand side of the vehicle. +/// Since this is a right handed system, z should point out the bottom of the vehicle. +/// The orientation and origin of the Vehicle Body Frame are specified via the device settings. +/// The full GPS time is given by the preceding MSG_GPS_TIME with the +/// matching time-of-week (tow). This message is only produced by inertial versions of Swift +/// products and is not available from Piksi Multi or Duro. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgVelBody { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Velocity in x direction pub x: i32, - // ^ Velocity in x direction + /// Velocity in y direction pub y: i32, - // ^ Velocity in y direction + /// Velocity in z direction pub z: i32, - // ^ Velocity in z direction + /// Estimated variance of x pub cov_x_x: f32, - // ^ Estimated variance of x + /// Covariance of x and y pub cov_x_y: f32, - // ^ Covariance of x and y + /// Covariance of x and z pub cov_x_z: f32, - // ^ Covariance of x and z + /// Estimated variance of y pub cov_y_y: f32, - // ^ Estimated variance of y + /// Covariance of y and z pub cov_y_z: f32, - // ^ Covariance of y and z + /// Estimated variance of z pub cov_z_z: f32, - // ^ Estimated variance of z + /// Number of satellites used in solution pub n_sats: u8, - // ^ Number of satellites used in solution + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgVelBody { @@ -889,19 +889,19 @@ impl super::SBPMessage for MsgVelBody { } } -// Age of corrections -// -// This message reports the Age of the corrections used for the current -// Differential solution -// +/// Age of corrections +/// +/// This message reports the Age of the corrections used for the current +/// Differential solution +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAgeCorrections { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Age of the corrections (0xFFFF indicates invalid) pub age: u16, - // ^ Age of the corrections (0xFFFF indicates invalid) } impl MsgAgeCorrections { @@ -925,35 +925,35 @@ impl super::SBPMessage for MsgAgeCorrections { } } -// GPS Time (v1.0) -// -// This message reports the GPS time, representing the time since -// the GPS epoch began on midnight January 6, 1980 UTC. GPS time -// counts the weeks and seconds of the week. The weeks begin at the -// Saturday/Sunday transition. GPS week 0 began at the beginning of -// the GPS time scale. -// -// Within each week number, the GPS time of the week is between -// between 0 and 604800 seconds (=60*60*24*7). Note that GPS time -// does not accumulate leap seconds, and as of now, has a small -// offset from UTC. In a message stream, this message precedes a -// set of other navigation messages referenced to the same time -// (but lacking the ns field) and indicates a more precise time of -// these messages. -// +/// GPS Time (v1.0) +/// +/// This message reports the GPS time, representing the time since +/// the GPS epoch began on midnight January 6, 1980 UTC. GPS time +/// counts the weeks and seconds of the week. The weeks begin at the +/// Saturday/Sunday transition. GPS week 0 began at the beginning of +/// the GPS time scale. +/// +/// Within each week number, the GPS time of the week is between +/// between 0 and 604800 seconds (=60*60*24*7). Note that GPS time +/// does not accumulate leap seconds, and as of now, has a small +/// offset from UTC. In a message stream, this message precedes a +/// set of other navigation messages referenced to the same time +/// (but lacking the ns field) and indicates a more precise time of +/// these messages. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgGPSTimeDepA { pub sender_id: Option, + /// GPS week number pub wn: u16, - // ^ GPS week number + /// GPS time of week rounded to the nearest millisecond pub tow: u32, - // ^ GPS time of week rounded to the nearest millisecond + /// Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to + /// 500000) pub ns_residual: i32, - // ^ Nanosecond residual of millisecond-rounded TOW (ranges from -500000 to - // 500000) + /// Status flags (reserved) pub flags: u8, - // ^ Status flags (reserved) } impl MsgGPSTimeDepA { @@ -979,28 +979,28 @@ impl super::SBPMessage for MsgGPSTimeDepA { } } -// Dilution of Precision -// -// This dilution of precision (DOP) message describes the effect of -// navigation satellite geometry on positional measurement -// precision. -// +/// Dilution of Precision +/// +/// This dilution of precision (DOP) message describes the effect of +/// navigation satellite geometry on positional measurement +/// precision. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgDopsDepA { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Geometric Dilution of Precision pub gdop: u16, - // ^ Geometric Dilution of Precision + /// Position Dilution of Precision pub pdop: u16, - // ^ Position Dilution of Precision + /// Time Dilution of Precision pub tdop: u16, - // ^ Time Dilution of Precision + /// Horizontal Dilution of Precision pub hdop: u16, - // ^ Horizontal Dilution of Precision + /// Vertical Dilution of Precision pub vdop: u16, - // ^ Vertical Dilution of Precision } impl MsgDopsDepA { @@ -1028,35 +1028,35 @@ impl super::SBPMessage for MsgDopsDepA { } } -// Single-point position in ECEF -// -// The position solution message reports absolute Earth Centered -// Earth Fixed (ECEF) coordinates and the status (single point vs -// pseudo-absolute RTK) of the position solution. If the rover -// receiver knows the surveyed position of the base station and has -// an RTK solution, this reports a pseudo-absolute position -// solution using the base station position and the rover's RTK -// baseline vector. The full GPS time is given by the preceding -// MSG_GPS_TIME with the matching time-of-week (tow). -// +/// Single-point position in ECEF +/// +/// The position solution message reports absolute Earth Centered +/// Earth Fixed (ECEF) coordinates and the status (single point vs +/// pseudo-absolute RTK) of the position solution. If the rover +/// receiver knows the surveyed position of the base station and has +/// an RTK solution, this reports a pseudo-absolute position +/// solution using the base station position and the rover's RTK +/// baseline vector. The full GPS time is given by the preceding +/// MSG_GPS_TIME with the matching time-of-week (tow). +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgPosECEFDepA { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// ECEF X coordinate pub x: f64, - // ^ ECEF X coordinate + /// ECEF Y coordinate pub y: f64, - // ^ ECEF Y coordinate + /// ECEF Z coordinate pub z: f64, - // ^ ECEF Z coordinate + /// Position accuracy estimate (not implemented). Defaults to 0. pub accuracy: u16, - // ^ Position accuracy estimate (not implemented). Defaults to 0. + /// Number of satellites used in solution pub n_sats: u8, - // ^ Number of satellites used in solution + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgPosECEFDepA { @@ -1085,37 +1085,37 @@ impl super::SBPMessage for MsgPosECEFDepA { } } -// Geodetic Position -// -// This position solution message reports the absolute geodetic -// coordinates and the status (single point vs pseudo-absolute RTK) -// of the position solution. If the rover receiver knows the -// surveyed position of the base station and has an RTK solution, -// this reports a pseudo-absolute position solution using the base -// station position and the rover's RTK baseline vector. The full -// GPS time is given by the preceding MSG_GPS_TIME with the -// matching time-of-week (tow). -// +/// Geodetic Position +/// +/// This position solution message reports the absolute geodetic +/// coordinates and the status (single point vs pseudo-absolute RTK) +/// of the position solution. If the rover receiver knows the +/// surveyed position of the base station and has an RTK solution, +/// this reports a pseudo-absolute position solution using the base +/// station position and the rover's RTK baseline vector. The full +/// GPS time is given by the preceding MSG_GPS_TIME with the +/// matching time-of-week (tow). +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgPosLLHDepA { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Latitude pub lat: f64, - // ^ Latitude + /// Longitude pub lon: f64, - // ^ Longitude + /// Height pub height: f64, - // ^ Height + /// Horizontal position accuracy estimate (not implemented). Defaults to 0. pub h_accuracy: u16, - // ^ Horizontal position accuracy estimate (not implemented). Defaults to 0. + /// Vertical position accuracy estimate (not implemented). Defaults to 0. pub v_accuracy: u16, - // ^ Vertical position accuracy estimate (not implemented). Defaults to 0. + /// Number of satellites used in solution. pub n_sats: u8, - // ^ Number of satellites used in solution. + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgPosLLHDepA { @@ -1145,32 +1145,32 @@ impl super::SBPMessage for MsgPosLLHDepA { } } -// Baseline Position in ECEF -// -// This message reports the baseline solution in Earth Centered -// Earth Fixed (ECEF) coordinates. This baseline is the relative -// vector distance from the base station to the rover receiver. The -// full GPS time is given by the preceding MSG_GPS_TIME with the -// matching time-of-week (tow). -// +/// Baseline Position in ECEF +/// +/// This message reports the baseline solution in Earth Centered +/// Earth Fixed (ECEF) coordinates. This baseline is the relative +/// vector distance from the base station to the rover receiver. The +/// full GPS time is given by the preceding MSG_GPS_TIME with the +/// matching time-of-week (tow). +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBaselineECEFDepA { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Baseline ECEF X coordinate pub x: i32, - // ^ Baseline ECEF X coordinate + /// Baseline ECEF Y coordinate pub y: i32, - // ^ Baseline ECEF Y coordinate + /// Baseline ECEF Z coordinate pub z: i32, - // ^ Baseline ECEF Z coordinate + /// Position accuracy estimate pub accuracy: u16, - // ^ Position accuracy estimate + /// Number of satellites used in solution pub n_sats: u8, - // ^ Number of satellites used in solution + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgBaselineECEFDepA { @@ -1199,35 +1199,35 @@ impl super::SBPMessage for MsgBaselineECEFDepA { } } -// Baseline in NED -// -// This message reports the baseline solution in North East Down -// (NED) coordinates. This baseline is the relative vector distance -// from the base station to the rover receiver, and NED coordinate -// system is defined at the local WGS84 tangent plane centered at the -// base station position. The full GPS time is given by the -// preceding MSG_GPS_TIME with the matching time-of-week (tow). -// +/// Baseline in NED +/// +/// This message reports the baseline solution in North East Down +/// (NED) coordinates. This baseline is the relative vector distance +/// from the base station to the rover receiver, and NED coordinate +/// system is defined at the local WGS84 tangent plane centered at the +/// base station position. The full GPS time is given by the +/// preceding MSG_GPS_TIME with the matching time-of-week (tow). +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBaselineNEDDepA { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Baseline North coordinate pub n: i32, - // ^ Baseline North coordinate + /// Baseline East coordinate pub e: i32, - // ^ Baseline East coordinate + /// Baseline Down coordinate pub d: i32, - // ^ Baseline Down coordinate + /// Horizontal position accuracy estimate (not implemented). Defaults to 0. pub h_accuracy: u16, - // ^ Horizontal position accuracy estimate (not implemented). Defaults to 0. + /// Vertical position accuracy estimate (not implemented). Defaults to 0. pub v_accuracy: u16, - // ^ Vertical position accuracy estimate (not implemented). Defaults to 0. + /// Number of satellites used in solution pub n_sats: u8, - // ^ Number of satellites used in solution + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgBaselineNEDDepA { @@ -1257,30 +1257,30 @@ impl super::SBPMessage for MsgBaselineNEDDepA { } } -// Velocity in ECEF -// -// This message reports the velocity in Earth Centered Earth Fixed -// (ECEF) coordinates. The full GPS time is given by the preceding -// MSG_GPS_TIME with the matching time-of-week (tow). -// +/// Velocity in ECEF +/// +/// This message reports the velocity in Earth Centered Earth Fixed +/// (ECEF) coordinates. The full GPS time is given by the preceding +/// MSG_GPS_TIME with the matching time-of-week (tow). +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgVelECEFDepA { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Velocity ECEF X coordinate pub x: i32, - // ^ Velocity ECEF X coordinate + /// Velocity ECEF Y coordinate pub y: i32, - // ^ Velocity ECEF Y coordinate + /// Velocity ECEF Z coordinate pub z: i32, - // ^ Velocity ECEF Z coordinate + /// Velocity accuracy estimate (not implemented). Defaults to 0. pub accuracy: u16, - // ^ Velocity accuracy estimate (not implemented). Defaults to 0. + /// Number of satellites used in solution pub n_sats: u8, - // ^ Number of satellites used in solution + /// Status flags (reserved) pub flags: u8, - // ^ Status flags (reserved) } impl MsgVelECEFDepA { @@ -1309,33 +1309,33 @@ impl super::SBPMessage for MsgVelECEFDepA { } } -// Velocity in NED -// -// This message reports the velocity in local North East Down (NED) -// coordinates. The NED coordinate system is defined as the local WGS84 -// tangent plane centered at the current position. The full GPS time is -// given by the preceding MSG_GPS_TIME with the matching time-of-week (tow). -// +/// Velocity in NED +/// +/// This message reports the velocity in local North East Down (NED) +/// coordinates. The NED coordinate system is defined as the local WGS84 +/// tangent plane centered at the current position. The full GPS time is +/// given by the preceding MSG_GPS_TIME with the matching time-of-week (tow). +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgVelNEDDepA { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Velocity North coordinate pub n: i32, - // ^ Velocity North coordinate + /// Velocity East coordinate pub e: i32, - // ^ Velocity East coordinate + /// Velocity Down coordinate pub d: i32, - // ^ Velocity Down coordinate + /// Horizontal velocity accuracy estimate (not implemented). Defaults to 0. pub h_accuracy: u16, - // ^ Horizontal velocity accuracy estimate (not implemented). Defaults to 0. + /// Vertical velocity accuracy estimate (not implemented). Defaults to 0. pub v_accuracy: u16, - // ^ Vertical velocity accuracy estimate (not implemented). Defaults to 0. + /// Number of satellites used in solution pub n_sats: u8, - // ^ Number of satellites used in solution + /// Status flags (reserved) pub flags: u8, - // ^ Status flags (reserved) } impl MsgVelNEDDepA { @@ -1365,24 +1365,24 @@ impl super::SBPMessage for MsgVelNEDDepA { } } -// Heading relative to True North -// -// This message reports the baseline heading pointing from the base station -// to the rover relative to True North. The full GPS time is given by the -// preceding MSG_GPS_TIME with the matching time-of-week (tow). -// +/// Heading relative to True North +/// +/// This message reports the baseline heading pointing from the base station +/// to the rover relative to True North. The full GPS time is given by the +/// preceding MSG_GPS_TIME with the matching time-of-week (tow). +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBaselineHeadingDepA { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Heading pub heading: u32, - // ^ Heading + /// Number of satellites used in solution pub n_sats: u8, - // ^ Number of satellites used in solution + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgBaselineHeadingDepA { diff --git a/rust/sbp/src/messages/ndb.rs b/rust/sbp/src/messages/ndb.rs index 2081f12e50..77e3af7602 100644 --- a/rust/sbp/src/messages/ndb.rs +++ b/rust/sbp/src/messages/ndb.rs @@ -12,43 +12,43 @@ // Automatically generated from yaml/swiftnav/sbp/ndb.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Messages for logging NDB events. +/// Messages for logging NDB events. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; use super::gnss::*; -// Navigation DataBase Event -// -// This message is sent out when an object is stored into NDB. If needed -// message could also be sent out when fetching an object from NDB. -// +/// Navigation DataBase Event +/// +/// This message is sent out when an object is stored into NDB. If needed +/// message could also be sent out when fetching an object from NDB. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgNdbEvent { pub sender_id: Option, + /// HW time in milliseconds. pub recv_time: u64, - // ^ HW time in milliseconds. + /// Event type. pub event: u8, - // ^ Event type. + /// Event object type. pub object_type: u8, - // ^ Event object type. + /// Event result. pub result: u8, - // ^ Event result. + /// Data source for STORE event, reserved for other events. pub data_source: u8, - // ^ Data source for STORE event, reserved for other events. + /// GNSS signal identifier, If object_type is Ephemeris OR Almanac, sid + /// indicates for which signal the object belongs to. Reserved in other + /// cases. pub object_sid: GnssSignal, - // ^ GNSS signal identifier, If object_type is Ephemeris OR Almanac, sid - // indicates for which signal the object belongs to. Reserved in other - // cases. + /// GNSS signal identifier, If object_type is Almanac, Almanac WN, Iono OR + /// L2C capabilities AND data_source is NDB_DS_RECEIVER sid indicates from + /// which SV data was decoded. Reserved in other cases. pub src_sid: GnssSignal, - // ^ GNSS signal identifier, If object_type is Almanac, Almanac WN, Iono OR - // L2C capabilities AND data_source is NDB_DS_RECEIVER sid indicates from - // which SV data was decoded. Reserved in other cases. + /// A unique identifier of the sending hardware. For v1.0, set to the 2 + /// least significant bytes of the device serial number, valid only if + /// data_source is NDB_DS_SBP. Reserved in case of other data_source. pub original_sender: u16, - // ^ A unique identifier of the sending hardware. For v1.0, set to the 2 - // least significant bytes of the device serial number, valid only if - // data_source is NDB_DS_SBP. Reserved in case of other data_source. } impl MsgNdbEvent { diff --git a/rust/sbp/src/messages/observation.rs b/rust/sbp/src/messages/observation.rs index b6fca30f5e..74771649ef 100644 --- a/rust/sbp/src/messages/observation.rs +++ b/rust/sbp/src/messages/observation.rs @@ -12,24 +12,24 @@ // Automatically generated from yaml/swiftnav/sbp/observation.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Satellite observation messages from the device. +/// Satellite observation messages from the device. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; use super::gnss::*; -// Header for observation message. -// -// Header of a GNSS observation message. -// +/// Header for observation message. +/// +/// Header of a GNSS observation message. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct ObservationHeader { + /// GNSS time of this observation pub t: GPSTime, - // ^ GNSS time of this observation + /// Total number of observations. First nibble is the size of the sequence + /// (n), second nibble is the zero-indexed counter (ith packet of n) pub n_obs: u8, - // ^ Total number of observations. First nibble is the size of the sequence - // (n), second nibble is the zero-indexed counter (ith packet of n) } impl ObservationHeader { @@ -59,20 +59,20 @@ impl ObservationHeader { } } -// GNSS doppler measurement. -// -// Doppler measurement in Hz represented as a 24-bit -// fixed point number with Q16.8 layout, i.e. 16-bits of whole -// doppler and 8-bits of fractional doppler. This doppler is defined -// as positive for approaching satellites. -// +/// GNSS doppler measurement. +/// +/// Doppler measurement in Hz represented as a 24-bit +/// fixed point number with Q16.8 layout, i.e. 16-bits of whole +/// doppler and 8-bits of fractional doppler. This doppler is defined +/// as positive for approaching satellites. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct Doppler { + /// Doppler whole Hz pub i: i16, - // ^ Doppler whole Hz + /// Doppler fractional part pub f: u8, - // ^ Doppler fractional part } impl Doppler { @@ -102,40 +102,40 @@ impl Doppler { } } -// GNSS observations for a particular satellite signal. -// -// Pseudorange and carrier phase observation for a satellite being tracked. -// The observations are interoperable with 3rd party receivers and conform with -// typical RTCM 3.1 message GPS/GLO observations. -// -// Carrier phase observations are not guaranteed to be aligned to the RINEX 3 -// or RTCM 3.3 MSM reference signal and no 1/4 cycle adjustments are currently -// peformed. -// +/// GNSS observations for a particular satellite signal. +/// +/// Pseudorange and carrier phase observation for a satellite being tracked. +/// The observations are interoperable with 3rd party receivers and conform with +/// typical RTCM 3.1 message GPS/GLO observations. +/// +/// Carrier phase observations are not guaranteed to be aligned to the RINEX 3 +/// or RTCM 3.3 MSM reference signal and no 1/4 cycle adjustments are currently +/// peformed. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct PackedObsContent { + /// Pseudorange observation pub P: u32, - // ^ Pseudorange observation + /// Carrier phase observation with typical sign convention. pub L: CarrierPhase, - // ^ Carrier phase observation with typical sign convention. + /// Doppler observation with typical sign convention. pub D: Doppler, - // ^ Doppler observation with typical sign convention. + /// Carrier-to-Noise density. Zero implies invalid cn0. pub cn0: u8, - // ^ Carrier-to-Noise density. Zero implies invalid cn0. + /// Lock timer. This value gives an indication of the time for which a + /// signal has maintained continuous phase lock. Whenever a signal has lost + /// and regained lock, this value is reset to zero. It is encoded according + /// to DF402 from the RTCM 10403.2 Amendment 2 specification. Valid values + /// range from 0 to 15 and the most significant nibble is reserved for + /// future use. pub lock: u8, - // ^ Lock timer. This value gives an indication of the time for which a - // signal has maintained continuous phase lock. Whenever a signal has lost - // and regained lock, this value is reset to zero. It is encoded according - // to DF402 from the RTCM 10403.2 Amendment 2 specification. Valid values - // range from 0 to 15 and the most significant nibble is reserved for - // future use. + /// Measurement status flags. A bit field of flags providing the status of + /// this observation. If this field is 0 it means only the Cn0 estimate for + /// the signal is valid. pub flags: u8, - // ^ Measurement status flags. A bit field of flags providing the status of - // this observation. If this field is 0 it means only the Cn0 estimate for - // the signal is valid. + /// GNSS signal identifier (16 bit) pub sid: GnssSignal, - // ^ GNSS signal identifier (16 bit) } impl PackedObsContent { @@ -170,34 +170,34 @@ impl PackedObsContent { } } -// Network correction for a particular satellite signal. -// -// Pseudorange and carrier phase network corrections for a satellite signal. -// +/// Network correction for a particular satellite signal. +/// +/// Pseudorange and carrier phase network corrections for a satellite signal. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct PackedOsrContent { + /// Pseudorange observation pub P: u32, - // ^ Pseudorange observation + /// Carrier phase observation with typical sign convention. pub L: CarrierPhase, - // ^ Carrier phase observation with typical sign convention. + /// Lock timer. This value gives an indication of the time for which a + /// signal has maintained continuous phase lock. Whenever a signal has lost + /// and regained lock, this value is reset to zero. It is encoded according + /// to DF402 from the RTCM 10403.2 Amendment 2 specification. Valid values + /// range from 0 to 15 and the most significant nibble is reserved for + /// future use. pub lock: u8, - // ^ Lock timer. This value gives an indication of the time for which a - // signal has maintained continuous phase lock. Whenever a signal has lost - // and regained lock, this value is reset to zero. It is encoded according - // to DF402 from the RTCM 10403.2 Amendment 2 specification. Valid values - // range from 0 to 15 and the most significant nibble is reserved for - // future use. + /// Correction flags. pub flags: u8, - // ^ Correction flags. + /// GNSS signal identifier (16 bit) pub sid: GnssSignal, - // ^ GNSS signal identifier (16 bit) + /// Slant ionospheric correction standard deviation pub iono_std: u16, - // ^ Slant ionospheric correction standard deviation + /// Slant tropospheric correction standard deviation pub tropo_std: u16, - // ^ Slant tropospheric correction standard deviation + /// Orbit/clock/bias correction projected on range standard deviation pub range_std: u16, - // ^ Orbit/clock/bias correction projected on range standard deviation } impl PackedOsrContent { @@ -233,24 +233,24 @@ impl PackedOsrContent { } } -// GPS satellite observations -// -// The GPS observations message reports all the raw pseudorange and -// carrier phase observations for the satellites being tracked by -// the device. Carrier phase observation here is represented as a -// 40-bit fixed point number with Q32.8 layout (i.e. 32-bits of -// whole cycles and 8-bits of fractional cycles). The observations -// are be interoperable with 3rd party receivers and conform -// with typical RTCMv3 GNSS observations. -// +/// GPS satellite observations +/// +/// The GPS observations message reports all the raw pseudorange and +/// carrier phase observations for the satellites being tracked by +/// the device. Carrier phase observation here is represented as a +/// 40-bit fixed point number with Q32.8 layout (i.e. 32-bits of +/// whole cycles and 8-bits of fractional cycles). The observations +/// are be interoperable with 3rd party receivers and conform +/// with typical RTCMv3 GNSS observations. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgObs { pub sender_id: Option, + /// Header of a GPS observation message pub header: ObservationHeader, - // ^ Header of a GPS observation message + /// Pseudorange and carrier phase observation for a satellite being tracked. pub obs: Vec, - // ^ Pseudorange and carrier phase observation for a satellite being tracked. } impl MsgObs { @@ -274,24 +274,24 @@ impl super::SBPMessage for MsgObs { } } -// Base station position -// -// The base station position message is the position reported by -// the base station itself. It is used for pseudo-absolute RTK -// positioning, and is required to be a high-accuracy surveyed -// location of the base station. Any error here will result in an -// error in the pseudo-absolute position output. -// +/// Base station position +/// +/// The base station position message is the position reported by +/// the base station itself. It is used for pseudo-absolute RTK +/// positioning, and is required to be a high-accuracy surveyed +/// location of the base station. Any error here will result in an +/// error in the pseudo-absolute position output. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBasePosLLH { pub sender_id: Option, + /// Latitude pub lat: f64, - // ^ Latitude + /// Longitude pub lon: f64, - // ^ Longitude + /// Height pub height: f64, - // ^ Height } impl MsgBasePosLLH { @@ -316,25 +316,25 @@ impl super::SBPMessage for MsgBasePosLLH { } } -// Base station position in ECEF -// -// The base station position message is the position reported by -// the base station itself in absolute Earth Centered Earth Fixed -// coordinates. It is used for pseudo-absolute RTK positioning, and -// is required to be a high-accuracy surveyed location of the base -// station. Any error here will result in an error in the -// pseudo-absolute position output. -// +/// Base station position in ECEF +/// +/// The base station position message is the position reported by +/// the base station itself in absolute Earth Centered Earth Fixed +/// coordinates. It is used for pseudo-absolute RTK positioning, and +/// is required to be a high-accuracy surveyed location of the base +/// station. Any error here will result in an error in the +/// pseudo-absolute position output. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBasePosECEF { pub sender_id: Option, + /// ECEF X coodinate pub x: f64, - // ^ ECEF X coodinate + /// ECEF Y coordinate pub y: f64, - // ^ ECEF Y coordinate + /// ECEF Z coordinate pub z: f64, - // ^ ECEF Z coordinate } impl MsgBasePosECEF { @@ -362,19 +362,19 @@ impl super::SBPMessage for MsgBasePosECEF { #[derive(Debug)] #[allow(non_snake_case)] pub struct EphemerisCommonContent { + /// GNSS signal identifier (16 bit) pub sid: GnssSignal, - // ^ GNSS signal identifier (16 bit) + /// Time of Ephemerides pub toe: GPSTimeSec, - // ^ Time of Ephemerides + /// User Range Accuracy pub ura: f32, - // ^ User Range Accuracy + /// Curve fit interval pub fit_interval: u32, - // ^ Curve fit interval + /// Status of ephemeris, 1 = valid, 0 = invalid pub valid: u8, - // ^ Status of ephemeris, 1 = valid, 0 = invalid + /// Satellite health status. GPS: ICD-GPS-200, chapter 20.3.3.3.1.4 SBAS: 0 + /// = valid, non-zero = invalid GLO: 0 = valid, non-zero = invalid pub health_bits: u8, - // ^ Satellite health status. GPS: ICD-GPS-200, chapter 20.3.3.3.1.4 SBAS: 0 - // = valid, non-zero = invalid GLO: 0 = valid, non-zero = invalid } impl EphemerisCommonContent { @@ -413,19 +413,19 @@ impl EphemerisCommonContent { #[derive(Debug)] #[allow(non_snake_case)] pub struct EphemerisCommonContentDepB { + /// GNSS signal identifier (16 bit) pub sid: GnssSignal, - // ^ GNSS signal identifier (16 bit) + /// Time of Ephemerides pub toe: GPSTimeSec, - // ^ Time of Ephemerides + /// User Range Accuracy pub ura: f64, - // ^ User Range Accuracy + /// Curve fit interval pub fit_interval: u32, - // ^ Curve fit interval + /// Status of ephemeris, 1 = valid, 0 = invalid pub valid: u8, - // ^ Status of ephemeris, 1 = valid, 0 = invalid + /// Satellite health status. GPS: ICD-GPS-200, chapter 20.3.3.3.1.4 Others: + /// 0 = valid, non-zero = invalid pub health_bits: u8, - // ^ Satellite health status. GPS: ICD-GPS-200, chapter 20.3.3.3.1.4 Others: - // 0 = valid, non-zero = invalid } impl EphemerisCommonContentDepB { @@ -464,19 +464,19 @@ impl EphemerisCommonContentDepB { #[derive(Debug)] #[allow(non_snake_case)] pub struct EphemerisCommonContentDepA { + /// GNSS signal identifier pub sid: GnssSignalDep, - // ^ GNSS signal identifier + /// Time of Ephemerides pub toe: GPSTimeDep, - // ^ Time of Ephemerides + /// User Range Accuracy pub ura: f64, - // ^ User Range Accuracy + /// Curve fit interval pub fit_interval: u32, - // ^ Curve fit interval + /// Status of ephemeris, 1 = valid, 0 = invalid pub valid: u8, - // ^ Status of ephemeris, 1 = valid, 0 = invalid + /// Satellite health status. GPS: ICD-GPS-200, chapter 20.3.3.3.1.4 SBAS: 0 + /// = valid, non-zero = invalid GLO: 0 = valid, non-zero = invalid pub health_bits: u8, - // ^ Satellite health status. GPS: ICD-GPS-200, chapter 20.3.3.3.1.4 SBAS: 0 - // = valid, non-zero = invalid GLO: 0 = valid, non-zero = invalid } impl EphemerisCommonContentDepA { @@ -512,68 +512,68 @@ impl EphemerisCommonContentDepA { } } -// Satellite broadcast ephemeris for GPS -// -// The ephemeris message returns a set of satellite orbit -// parameters that is used to calculate GPS satellite position, -// velocity, and clock offset. Please see the Navstar GPS -// Space Segment/Navigation user interfaces (ICD-GPS-200, Table -// 20-III) for more details. -// +/// Satellite broadcast ephemeris for GPS +/// +/// The ephemeris message returns a set of satellite orbit +/// parameters that is used to calculate GPS satellite position, +/// velocity, and clock offset. Please see the Navstar GPS +/// Space Segment/Navigation user interfaces (ICD-GPS-200, Table +/// 20-III) for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGPSDepE { pub sender_id: Option, + /// Values common for all ephemeris types pub common: EphemerisCommonContentDepA, - // ^ Values common for all ephemeris types + /// Group delay differential between L1 and L2 pub tgd: f64, - // ^ Group delay differential between L1 and L2 + /// Amplitude of the sine harmonic correction term to the orbit radius pub c_rs: f64, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the orbit radius pub c_rc: f64, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the argument of + /// latitude pub c_uc: f64, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + /// Amplitude of the sine harmonic correction term to the argument of + /// latitude pub c_us: f64, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + /// Amplitude of the cosine harmonic correction term to the angle of + /// inclination pub c_ic: f64, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + /// Amplitude of the sine harmonic correction term to the angle of + /// inclination pub c_is: f64, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + /// Mean motion difference pub dn: f64, - // ^ Mean motion difference + /// Mean anomaly at reference time pub m0: f64, - // ^ Mean anomaly at reference time + /// Eccentricity of satellite orbit pub ecc: f64, - // ^ Eccentricity of satellite orbit + /// Square root of the semi-major axis of orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + /// Longitude of ascending node of orbit plane at weekly epoch pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + /// Rate of right ascension pub omegadot: f64, - // ^ Rate of right ascension + /// Argument of perigee pub w: f64, - // ^ Argument of perigee + /// Inclination pub inc: f64, - // ^ Inclination + /// Inclination first derivative pub inc_dot: f64, - // ^ Inclination first derivative + /// Polynomial clock correction coefficient (clock bias) pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + /// Polynomial clock correction coefficient (clock drift) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) + /// Polynomial clock correction coefficient (rate of clock drift) pub af2: f64, - // ^ Polynomial clock correction coefficient (rate of clock drift) + /// Clock reference pub toc: GPSTimeDep, - // ^ Clock reference + /// Issue of ephemeris data pub iode: u8, - // ^ Issue of ephemeris data + /// Issue of clock data pub iodc: u16, - // ^ Issue of clock data } impl MsgEphemerisGPSDepE { @@ -618,65 +618,65 @@ impl super::SBPMessage for MsgEphemerisGPSDepE { } } -// Deprecated -// -// This observation message has been deprecated in favor of -// ephemeris message using floats for size reduction. -// +/// Deprecated +/// +/// This observation message has been deprecated in favor of +/// ephemeris message using floats for size reduction. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGPSDepF { pub sender_id: Option, + /// Values common for all ephemeris types pub common: EphemerisCommonContentDepB, - // ^ Values common for all ephemeris types + /// Group delay differential between L1 and L2 pub tgd: f64, - // ^ Group delay differential between L1 and L2 + /// Amplitude of the sine harmonic correction term to the orbit radius pub c_rs: f64, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the orbit radius pub c_rc: f64, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the argument of + /// latitude pub c_uc: f64, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + /// Amplitude of the sine harmonic correction term to the argument of + /// latitude pub c_us: f64, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + /// Amplitude of the cosine harmonic correction term to the angle of + /// inclination pub c_ic: f64, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + /// Amplitude of the sine harmonic correction term to the angle of + /// inclination pub c_is: f64, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + /// Mean motion difference pub dn: f64, - // ^ Mean motion difference + /// Mean anomaly at reference time pub m0: f64, - // ^ Mean anomaly at reference time + /// Eccentricity of satellite orbit pub ecc: f64, - // ^ Eccentricity of satellite orbit + /// Square root of the semi-major axis of orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + /// Longitude of ascending node of orbit plane at weekly epoch pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + /// Rate of right ascension pub omegadot: f64, - // ^ Rate of right ascension + /// Argument of perigee pub w: f64, - // ^ Argument of perigee + /// Inclination pub inc: f64, - // ^ Inclination + /// Inclination first derivative pub inc_dot: f64, - // ^ Inclination first derivative + /// Polynomial clock correction coefficient (clock bias) pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + /// Polynomial clock correction coefficient (clock drift) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) + /// Polynomial clock correction coefficient (rate of clock drift) pub af2: f64, - // ^ Polynomial clock correction coefficient (rate of clock drift) + /// Clock reference pub toc: GPSTimeSec, - // ^ Clock reference + /// Issue of ephemeris data pub iode: u8, - // ^ Issue of ephemeris data + /// Issue of clock data pub iodc: u16, - // ^ Issue of clock data } impl MsgEphemerisGPSDepF { @@ -721,68 +721,68 @@ impl super::SBPMessage for MsgEphemerisGPSDepF { } } -// Satellite broadcast ephemeris for GPS -// -// The ephemeris message returns a set of satellite orbit -// parameters that is used to calculate GPS satellite position, -// velocity, and clock offset. Please see the Navstar GPS -// Space Segment/Navigation user interfaces (ICD-GPS-200, Table -// 20-III) for more details. -// +/// Satellite broadcast ephemeris for GPS +/// +/// The ephemeris message returns a set of satellite orbit +/// parameters that is used to calculate GPS satellite position, +/// velocity, and clock offset. Please see the Navstar GPS +/// Space Segment/Navigation user interfaces (ICD-GPS-200, Table +/// 20-III) for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGPS { pub sender_id: Option, + /// Values common for all ephemeris types pub common: EphemerisCommonContent, - // ^ Values common for all ephemeris types + /// Group delay differential between L1 and L2 pub tgd: f32, - // ^ Group delay differential between L1 and L2 + /// Amplitude of the sine harmonic correction term to the orbit radius pub c_rs: f32, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the orbit radius pub c_rc: f32, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the argument of + /// latitude pub c_uc: f32, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + /// Amplitude of the sine harmonic correction term to the argument of + /// latitude pub c_us: f32, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + /// Amplitude of the cosine harmonic correction term to the angle of + /// inclination pub c_ic: f32, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + /// Amplitude of the sine harmonic correction term to the angle of + /// inclination pub c_is: f32, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + /// Mean motion difference pub dn: f64, - // ^ Mean motion difference + /// Mean anomaly at reference time pub m0: f64, - // ^ Mean anomaly at reference time + /// Eccentricity of satellite orbit pub ecc: f64, - // ^ Eccentricity of satellite orbit + /// Square root of the semi-major axis of orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + /// Longitude of ascending node of orbit plane at weekly epoch pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + /// Rate of right ascension pub omegadot: f64, - // ^ Rate of right ascension + /// Argument of perigee pub w: f64, - // ^ Argument of perigee + /// Inclination pub inc: f64, - // ^ Inclination + /// Inclination first derivative pub inc_dot: f64, - // ^ Inclination first derivative + /// Polynomial clock correction coefficient (clock bias) pub af0: f32, - // ^ Polynomial clock correction coefficient (clock bias) + /// Polynomial clock correction coefficient (clock drift) pub af1: f32, - // ^ Polynomial clock correction coefficient (clock drift) + /// Polynomial clock correction coefficient (rate of clock drift) pub af2: f32, - // ^ Polynomial clock correction coefficient (rate of clock drift) + /// Clock reference pub toc: GPSTimeSec, - // ^ Clock reference + /// Issue of ephemeris data pub iode: u8, - // ^ Issue of ephemeris data + /// Issue of clock data pub iodc: u16, - // ^ Issue of clock data } impl MsgEphemerisGPS { @@ -827,66 +827,66 @@ impl super::SBPMessage for MsgEphemerisGPS { } } -// Satellite broadcast ephemeris for QZSS -// -// The ephemeris message returns a set of satellite orbit -// parameters that is used to calculate QZSS satellite position, -// velocity, and clock offset. -// +/// Satellite broadcast ephemeris for QZSS +/// +/// The ephemeris message returns a set of satellite orbit +/// parameters that is used to calculate QZSS satellite position, +/// velocity, and clock offset. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisQzss { pub sender_id: Option, + /// Values common for all ephemeris types pub common: EphemerisCommonContent, - // ^ Values common for all ephemeris types + /// Group delay differential between L1 and L2 pub tgd: f32, - // ^ Group delay differential between L1 and L2 + /// Amplitude of the sine harmonic correction term to the orbit radius pub c_rs: f32, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the orbit radius pub c_rc: f32, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the argument of + /// latitude pub c_uc: f32, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + /// Amplitude of the sine harmonic correction term to the argument of + /// latitude pub c_us: f32, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + /// Amplitude of the cosine harmonic correction term to the angle of + /// inclination pub c_ic: f32, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + /// Amplitude of the sine harmonic correction term to the angle of + /// inclination pub c_is: f32, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + /// Mean motion difference pub dn: f64, - // ^ Mean motion difference + /// Mean anomaly at reference time pub m0: f64, - // ^ Mean anomaly at reference time + /// Eccentricity of satellite orbit pub ecc: f64, - // ^ Eccentricity of satellite orbit + /// Square root of the semi-major axis of orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + /// Longitude of ascending node of orbit plane at weekly epoch pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + /// Rate of right ascension pub omegadot: f64, - // ^ Rate of right ascension + /// Argument of perigee pub w: f64, - // ^ Argument of perigee + /// Inclination pub inc: f64, - // ^ Inclination + /// Inclination first derivative pub inc_dot: f64, - // ^ Inclination first derivative + /// Polynomial clock correction coefficient (clock bias) pub af0: f32, - // ^ Polynomial clock correction coefficient (clock bias) + /// Polynomial clock correction coefficient (clock drift) pub af1: f32, - // ^ Polynomial clock correction coefficient (clock drift) + /// Polynomial clock correction coefficient (rate of clock drift) pub af2: f32, - // ^ Polynomial clock correction coefficient (rate of clock drift) + /// Clock reference pub toc: GPSTimeSec, - // ^ Clock reference + /// Issue of ephemeris data pub iode: u8, - // ^ Issue of ephemeris data + /// Issue of clock data pub iodc: u16, - // ^ Issue of clock data } impl MsgEphemerisQzss { @@ -931,69 +931,69 @@ impl super::SBPMessage for MsgEphemerisQzss { } } -// Satellite broadcast ephemeris for BDS -// -// The ephemeris message returns a set of satellite orbit -// parameters that is used to calculate BDS satellite position, -// velocity, and clock offset. Please see the BeiDou Navigation -// Satellite System SIS-ICD Version 2.1, Table 5-9 for more details. -// +/// Satellite broadcast ephemeris for BDS +/// +/// The ephemeris message returns a set of satellite orbit +/// parameters that is used to calculate BDS satellite position, +/// velocity, and clock offset. Please see the BeiDou Navigation +/// Satellite System SIS-ICD Version 2.1, Table 5-9 for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisBds { pub sender_id: Option, + /// Values common for all ephemeris types pub common: EphemerisCommonContent, - // ^ Values common for all ephemeris types + /// Group delay differential for B1 pub tgd1: f32, - // ^ Group delay differential for B1 + /// Group delay differential for B2 pub tgd2: f32, - // ^ Group delay differential for B2 + /// Amplitude of the sine harmonic correction term to the orbit radius pub c_rs: f32, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the orbit radius pub c_rc: f32, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the argument of + /// latitude pub c_uc: f32, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + /// Amplitude of the sine harmonic correction term to the argument of + /// latitude pub c_us: f32, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + /// Amplitude of the cosine harmonic correction term to the angle of + /// inclination pub c_ic: f32, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + /// Amplitude of the sine harmonic correction term to the angle of + /// inclination pub c_is: f32, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + /// Mean motion difference pub dn: f64, - // ^ Mean motion difference + /// Mean anomaly at reference time pub m0: f64, - // ^ Mean anomaly at reference time + /// Eccentricity of satellite orbit pub ecc: f64, - // ^ Eccentricity of satellite orbit + /// Square root of the semi-major axis of orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + /// Longitude of ascending node of orbit plane at weekly epoch pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + /// Rate of right ascension pub omegadot: f64, - // ^ Rate of right ascension + /// Argument of perigee pub w: f64, - // ^ Argument of perigee + /// Inclination pub inc: f64, - // ^ Inclination + /// Inclination first derivative pub inc_dot: f64, - // ^ Inclination first derivative + /// Polynomial clock correction coefficient (clock bias) pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + /// Polynomial clock correction coefficient (clock drift) pub af1: f32, - // ^ Polynomial clock correction coefficient (clock drift) + /// Polynomial clock correction coefficient (rate of clock drift) pub af2: f32, - // ^ Polynomial clock correction coefficient (rate of clock drift) + /// Clock reference pub toc: GPSTimeSec, - // ^ Clock reference + /// Issue of ephemeris data pub iode: u8, - // ^ Issue of ephemeris data + /// Issue of clock data pub iodc: u16, - // ^ Issue of clock data } impl MsgEphemerisBds { @@ -1039,67 +1039,67 @@ impl super::SBPMessage for MsgEphemerisBds { } } -// Deprecated -// -// This observation message has been deprecated in favor of -// an ephemeris message with explicit source of NAV data. -// +/// Deprecated +/// +/// This observation message has been deprecated in favor of +/// an ephemeris message with explicit source of NAV data. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGalDepA { pub sender_id: Option, + /// Values common for all ephemeris types pub common: EphemerisCommonContent, - // ^ Values common for all ephemeris types + /// E1-E5a Broadcast Group Delay pub bgd_e1e5a: f32, - // ^ E1-E5a Broadcast Group Delay + /// E1-E5b Broadcast Group Delay pub bgd_e1e5b: f32, - // ^ E1-E5b Broadcast Group Delay + /// Amplitude of the sine harmonic correction term to the orbit radius pub c_rs: f32, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the orbit radius pub c_rc: f32, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the argument of + /// latitude pub c_uc: f32, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + /// Amplitude of the sine harmonic correction term to the argument of + /// latitude pub c_us: f32, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + /// Amplitude of the cosine harmonic correction term to the angle of + /// inclination pub c_ic: f32, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + /// Amplitude of the sine harmonic correction term to the angle of + /// inclination pub c_is: f32, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + /// Mean motion difference pub dn: f64, - // ^ Mean motion difference + /// Mean anomaly at reference time pub m0: f64, - // ^ Mean anomaly at reference time + /// Eccentricity of satellite orbit pub ecc: f64, - // ^ Eccentricity of satellite orbit + /// Square root of the semi-major axis of orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + /// Longitude of ascending node of orbit plane at weekly epoch pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + /// Rate of right ascension pub omegadot: f64, - // ^ Rate of right ascension + /// Argument of perigee pub w: f64, - // ^ Argument of perigee + /// Inclination pub inc: f64, - // ^ Inclination + /// Inclination first derivative pub inc_dot: f64, - // ^ Inclination first derivative + /// Polynomial clock correction coefficient (clock bias) pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + /// Polynomial clock correction coefficient (clock drift) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) + /// Polynomial clock correction coefficient (rate of clock drift) pub af2: f32, - // ^ Polynomial clock correction coefficient (rate of clock drift) + /// Clock reference pub toc: GPSTimeSec, - // ^ Clock reference + /// Issue of ephemeris data pub iode: u16, - // ^ Issue of ephemeris data + /// Issue of clock data pub iodc: u16, - // ^ Issue of clock data } impl MsgEphemerisGalDepA { @@ -1145,71 +1145,71 @@ impl super::SBPMessage for MsgEphemerisGalDepA { } } -// Satellite broadcast ephemeris for Galileo -// -// The ephemeris message returns a set of satellite orbit -// parameters that is used to calculate Galileo satellite position, -// velocity, and clock offset. Please see the Signal In Space ICD -// OS SIS ICD, Issue 1.3, December 2016 for more details. -// +/// Satellite broadcast ephemeris for Galileo +/// +/// The ephemeris message returns a set of satellite orbit +/// parameters that is used to calculate Galileo satellite position, +/// velocity, and clock offset. Please see the Signal In Space ICD +/// OS SIS ICD, Issue 1.3, December 2016 for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGal { pub sender_id: Option, + /// Values common for all ephemeris types pub common: EphemerisCommonContent, - // ^ Values common for all ephemeris types + /// E1-E5a Broadcast Group Delay pub bgd_e1e5a: f32, - // ^ E1-E5a Broadcast Group Delay + /// E1-E5b Broadcast Group Delay pub bgd_e1e5b: f32, - // ^ E1-E5b Broadcast Group Delay + /// Amplitude of the sine harmonic correction term to the orbit radius pub c_rs: f32, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the orbit radius pub c_rc: f32, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the argument of + /// latitude pub c_uc: f32, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + /// Amplitude of the sine harmonic correction term to the argument of + /// latitude pub c_us: f32, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + /// Amplitude of the cosine harmonic correction term to the angle of + /// inclination pub c_ic: f32, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + /// Amplitude of the sine harmonic correction term to the angle of + /// inclination pub c_is: f32, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + /// Mean motion difference pub dn: f64, - // ^ Mean motion difference + /// Mean anomaly at reference time pub m0: f64, - // ^ Mean anomaly at reference time + /// Eccentricity of satellite orbit pub ecc: f64, - // ^ Eccentricity of satellite orbit + /// Square root of the semi-major axis of orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + /// Longitude of ascending node of orbit plane at weekly epoch pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + /// Rate of right ascension pub omegadot: f64, - // ^ Rate of right ascension + /// Argument of perigee pub w: f64, - // ^ Argument of perigee + /// Inclination pub inc: f64, - // ^ Inclination + /// Inclination first derivative pub inc_dot: f64, - // ^ Inclination first derivative + /// Polynomial clock correction coefficient (clock bias) pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + /// Polynomial clock correction coefficient (clock drift) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) + /// Polynomial clock correction coefficient (rate of clock drift) pub af2: f32, - // ^ Polynomial clock correction coefficient (rate of clock drift) + /// Clock reference pub toc: GPSTimeSec, - // ^ Clock reference + /// Issue of ephemeris data pub iode: u16, - // ^ Issue of ephemeris data + /// Issue of clock data pub iodc: u16, - // ^ Issue of clock data + /// 0=I/NAV, 1=F/NAV, ... pub source: u8, - // ^ 0=I/NAV, 1=F/NAV, ... } impl MsgEphemerisGal { @@ -1260,18 +1260,18 @@ impl super::SBPMessage for MsgEphemerisGal { #[allow(non_snake_case)] pub struct MsgEphemerisSbasDepA { pub sender_id: Option, + /// Values common for all ephemeris types pub common: EphemerisCommonContentDepA, - // ^ Values common for all ephemeris types + /// Position of the GEO at time toe pub pos: Vec, - // ^ Position of the GEO at time toe + /// Velocity of the GEO at time toe pub vel: Vec, - // ^ Velocity of the GEO at time toe + /// Acceleration of the GEO at time toe pub acc: Vec, - // ^ Acceleration of the GEO at time toe + /// Time offset of the GEO clock w.r.t. SBAS Network Time pub a_gf0: f64, - // ^ Time offset of the GEO clock w.r.t. SBAS Network Time + /// Drift of the GEO clock w.r.t. SBAS Network Time pub a_gf1: f64, - // ^ Drift of the GEO clock w.r.t. SBAS Network Time } impl MsgEphemerisSbasDepA { @@ -1299,30 +1299,30 @@ impl super::SBPMessage for MsgEphemerisSbasDepA { } } -// Satellite broadcast ephemeris for GLO -// -// The ephemeris message returns a set of satellite orbit -// parameters that is used to calculate GLO satellite position, -// velocity, and clock offset. Please see the GLO ICD 5.1 "Table 4.5 -// Characteristics of words of immediate information (ephemeris parameters)" -// for more details. -// +/// Satellite broadcast ephemeris for GLO +/// +/// The ephemeris message returns a set of satellite orbit +/// parameters that is used to calculate GLO satellite position, +/// velocity, and clock offset. Please see the GLO ICD 5.1 "Table 4.5 +/// Characteristics of words of immediate information (ephemeris parameters)" +/// for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGloDepA { pub sender_id: Option, + /// Values common for all ephemeris types pub common: EphemerisCommonContentDepA, - // ^ Values common for all ephemeris types + /// Relative deviation of predicted carrier frequency from nominal pub gamma: f64, - // ^ Relative deviation of predicted carrier frequency from nominal + /// Correction to the SV time pub tau: f64, - // ^ Correction to the SV time + /// Position of the SV at tb in PZ-90.02 coordinates system pub pos: Vec, - // ^ Position of the SV at tb in PZ-90.02 coordinates system + /// Velocity vector of the SV at tb in PZ-90.02 coordinates system pub vel: Vec, - // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system + /// Acceleration vector of the SV at tb in PZ-90.02 coordinates sys pub acc: Vec, - // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys } impl MsgEphemerisGloDepA { @@ -1350,27 +1350,27 @@ impl super::SBPMessage for MsgEphemerisGloDepA { } } -// Deprecated -// -// This observation message has been deprecated in favor of -// ephemeris message using floats for size reduction. -// +/// Deprecated +/// +/// This observation message has been deprecated in favor of +/// ephemeris message using floats for size reduction. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisSbasDepB { pub sender_id: Option, + /// Values common for all ephemeris types pub common: EphemerisCommonContentDepB, - // ^ Values common for all ephemeris types + /// Position of the GEO at time toe pub pos: Vec, - // ^ Position of the GEO at time toe + /// Velocity of the GEO at time toe pub vel: Vec, - // ^ Velocity of the GEO at time toe + /// Acceleration of the GEO at time toe pub acc: Vec, - // ^ Acceleration of the GEO at time toe + /// Time offset of the GEO clock w.r.t. SBAS Network Time pub a_gf0: f64, - // ^ Time offset of the GEO clock w.r.t. SBAS Network Time + /// Drift of the GEO clock w.r.t. SBAS Network Time pub a_gf1: f64, - // ^ Drift of the GEO clock w.r.t. SBAS Network Time } impl MsgEphemerisSbasDepB { @@ -1402,18 +1402,18 @@ impl super::SBPMessage for MsgEphemerisSbasDepB { #[allow(non_snake_case)] pub struct MsgEphemerisSbas { pub sender_id: Option, + /// Values common for all ephemeris types pub common: EphemerisCommonContent, - // ^ Values common for all ephemeris types + /// Position of the GEO at time toe pub pos: Vec, - // ^ Position of the GEO at time toe + /// Velocity of the GEO at time toe pub vel: Vec, - // ^ Velocity of the GEO at time toe + /// Acceleration of the GEO at time toe pub acc: Vec, - // ^ Acceleration of the GEO at time toe + /// Time offset of the GEO clock w.r.t. SBAS Network Time pub a_gf0: f32, - // ^ Time offset of the GEO clock w.r.t. SBAS Network Time + /// Drift of the GEO clock w.r.t. SBAS Network Time pub a_gf1: f32, - // ^ Drift of the GEO clock w.r.t. SBAS Network Time } impl MsgEphemerisSbas { @@ -1441,30 +1441,30 @@ impl super::SBPMessage for MsgEphemerisSbas { } } -// Satellite broadcast ephemeris for GLO -// -// The ephemeris message returns a set of satellite orbit -// parameters that is used to calculate GLO satellite position, -// velocity, and clock offset. Please see the GLO ICD 5.1 "Table 4.5 -// Characteristics of words of immediate information (ephemeris parameters)" -// for more details. -// +/// Satellite broadcast ephemeris for GLO +/// +/// The ephemeris message returns a set of satellite orbit +/// parameters that is used to calculate GLO satellite position, +/// velocity, and clock offset. Please see the GLO ICD 5.1 "Table 4.5 +/// Characteristics of words of immediate information (ephemeris parameters)" +/// for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGloDepB { pub sender_id: Option, + /// Values common for all ephemeris types pub common: EphemerisCommonContentDepB, - // ^ Values common for all ephemeris types + /// Relative deviation of predicted carrier frequency from nominal pub gamma: f64, - // ^ Relative deviation of predicted carrier frequency from nominal + /// Correction to the SV time pub tau: f64, - // ^ Correction to the SV time + /// Position of the SV at tb in PZ-90.02 coordinates system pub pos: Vec, - // ^ Position of the SV at tb in PZ-90.02 coordinates system + /// Velocity vector of the SV at tb in PZ-90.02 coordinates system pub vel: Vec, - // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system + /// Acceleration vector of the SV at tb in PZ-90.02 coordinates sys pub acc: Vec, - // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys } impl MsgEphemerisGloDepB { @@ -1492,34 +1492,34 @@ impl super::SBPMessage for MsgEphemerisGloDepB { } } -// Satellite broadcast ephemeris for GLO -// -// The ephemeris message returns a set of satellite orbit -// parameters that is used to calculate GLO satellite position, -// velocity, and clock offset. Please see the GLO ICD 5.1 "Table 4.5 -// Characteristics of words of immediate information (ephemeris parameters)" -// for more details. -// +/// Satellite broadcast ephemeris for GLO +/// +/// The ephemeris message returns a set of satellite orbit +/// parameters that is used to calculate GLO satellite position, +/// velocity, and clock offset. Please see the GLO ICD 5.1 "Table 4.5 +/// Characteristics of words of immediate information (ephemeris parameters)" +/// for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGloDepC { pub sender_id: Option, + /// Values common for all ephemeris types pub common: EphemerisCommonContentDepB, - // ^ Values common for all ephemeris types + /// Relative deviation of predicted carrier frequency from nominal pub gamma: f64, - // ^ Relative deviation of predicted carrier frequency from nominal + /// Correction to the SV time pub tau: f64, - // ^ Correction to the SV time + /// Equipment delay between L1 and L2 pub d_tau: f64, - // ^ Equipment delay between L1 and L2 + /// Position of the SV at tb in PZ-90.02 coordinates system pub pos: Vec, - // ^ Position of the SV at tb in PZ-90.02 coordinates system + /// Velocity vector of the SV at tb in PZ-90.02 coordinates system pub vel: Vec, - // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system + /// Acceleration vector of the SV at tb in PZ-90.02 coordinates sys pub acc: Vec, - // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys + /// Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for invalid pub fcn: u8, - // ^ Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for invalid } impl MsgEphemerisGloDepC { @@ -1549,33 +1549,33 @@ impl super::SBPMessage for MsgEphemerisGloDepC { } } -// Deprecated -// -// This observation message has been deprecated in favor of -// ephemeris message using floats for size reduction. -// +/// Deprecated +/// +/// This observation message has been deprecated in favor of +/// ephemeris message using floats for size reduction. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGloDepD { pub sender_id: Option, + /// Values common for all ephemeris types pub common: EphemerisCommonContentDepB, - // ^ Values common for all ephemeris types + /// Relative deviation of predicted carrier frequency from nominal pub gamma: f64, - // ^ Relative deviation of predicted carrier frequency from nominal + /// Correction to the SV time pub tau: f64, - // ^ Correction to the SV time + /// Equipment delay between L1 and L2 pub d_tau: f64, - // ^ Equipment delay between L1 and L2 + /// Position of the SV at tb in PZ-90.02 coordinates system pub pos: Vec, - // ^ Position of the SV at tb in PZ-90.02 coordinates system + /// Velocity vector of the SV at tb in PZ-90.02 coordinates system pub vel: Vec, - // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system + /// Acceleration vector of the SV at tb in PZ-90.02 coordinates sys pub acc: Vec, - // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys + /// Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for invalid pub fcn: u8, - // ^ Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for invalid + /// Issue of ephemeris data pub iod: u8, - // ^ Issue of ephemeris data } impl MsgEphemerisGloDepD { @@ -1606,36 +1606,36 @@ impl super::SBPMessage for MsgEphemerisGloDepD { } } -// Satellite broadcast ephemeris for GLO -// -// The ephemeris message returns a set of satellite orbit -// parameters that is used to calculate GLO satellite position, -// velocity, and clock offset. Please see the GLO ICD 5.1 "Table 4.5 -// Characteristics of words of immediate information (ephemeris parameters)" -// for more details. -// +/// Satellite broadcast ephemeris for GLO +/// +/// The ephemeris message returns a set of satellite orbit +/// parameters that is used to calculate GLO satellite position, +/// velocity, and clock offset. Please see the GLO ICD 5.1 "Table 4.5 +/// Characteristics of words of immediate information (ephemeris parameters)" +/// for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisGlo { pub sender_id: Option, + /// Values common for all ephemeris types pub common: EphemerisCommonContent, - // ^ Values common for all ephemeris types + /// Relative deviation of predicted carrier frequency from nominal pub gamma: f32, - // ^ Relative deviation of predicted carrier frequency from nominal + /// Correction to the SV time pub tau: f32, - // ^ Correction to the SV time + /// Equipment delay between L1 and L2 pub d_tau: f32, - // ^ Equipment delay between L1 and L2 + /// Position of the SV at tb in PZ-90.02 coordinates system pub pos: Vec, - // ^ Position of the SV at tb in PZ-90.02 coordinates system + /// Velocity vector of the SV at tb in PZ-90.02 coordinates system pub vel: Vec, - // ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system + /// Acceleration vector of the SV at tb in PZ-90.02 coordinates sys pub acc: Vec, - // ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys + /// Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for invalid pub fcn: u8, - // ^ Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for invalid + /// Issue of ephemeris data pub iod: u8, - // ^ Issue of ephemeris data } impl MsgEphemerisGlo { @@ -1666,80 +1666,80 @@ impl super::SBPMessage for MsgEphemerisGlo { } } -// Satellite broadcast ephemeris -// -// The ephemeris message returns a set of satellite orbit -// parameters that is used to calculate GPS satellite position, -// velocity, and clock offset. Please see the Navstar GPS -// Space Segment/Navigation user interfaces (ICD-GPS-200, Table -// 20-III) for more details. -// +/// Satellite broadcast ephemeris +/// +/// The ephemeris message returns a set of satellite orbit +/// parameters that is used to calculate GPS satellite position, +/// velocity, and clock offset. Please see the Navstar GPS +/// Space Segment/Navigation user interfaces (ICD-GPS-200, Table +/// 20-III) for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisDepD { pub sender_id: Option, + /// Group delay differential between L1 and L2 pub tgd: f64, - // ^ Group delay differential between L1 and L2 + /// Amplitude of the sine harmonic correction term to the orbit radius pub c_rs: f64, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the orbit radius pub c_rc: f64, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the argument of + /// latitude pub c_uc: f64, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + /// Amplitude of the sine harmonic correction term to the argument of + /// latitude pub c_us: f64, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + /// Amplitude of the cosine harmonic correction term to the angle of + /// inclination pub c_ic: f64, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + /// Amplitude of the sine harmonic correction term to the angle of + /// inclination pub c_is: f64, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + /// Mean motion difference pub dn: f64, - // ^ Mean motion difference + /// Mean anomaly at reference time pub m0: f64, - // ^ Mean anomaly at reference time + /// Eccentricity of satellite orbit pub ecc: f64, - // ^ Eccentricity of satellite orbit + /// Square root of the semi-major axis of orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + /// Longitude of ascending node of orbit plane at weekly epoch pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + /// Rate of right ascension pub omegadot: f64, - // ^ Rate of right ascension + /// Argument of perigee pub w: f64, - // ^ Argument of perigee + /// Inclination pub inc: f64, - // ^ Inclination + /// Inclination first derivative pub inc_dot: f64, - // ^ Inclination first derivative + /// Polynomial clock correction coefficient (clock bias) pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + /// Polynomial clock correction coefficient (clock drift) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) + /// Polynomial clock correction coefficient (rate of clock drift) pub af2: f64, - // ^ Polynomial clock correction coefficient (rate of clock drift) + /// Time of week pub toe_tow: f64, - // ^ Time of week + /// Week number pub toe_wn: u16, - // ^ Week number + /// Clock reference time of week pub toc_tow: f64, - // ^ Clock reference time of week + /// Clock reference week number pub toc_wn: u16, - // ^ Clock reference week number + /// Is valid? pub valid: u8, - // ^ Is valid? + /// Satellite is healthy? pub healthy: u8, - // ^ Satellite is healthy? + /// GNSS signal identifier pub sid: GnssSignalDep, - // ^ GNSS signal identifier + /// Issue of ephemeris data pub iode: u8, - // ^ Issue of ephemeris data + /// Issue of clock data pub iodc: u16, - // ^ Issue of clock data + /// Reserved field pub reserved: u32, - // ^ Reserved field } impl MsgEphemerisDepD { @@ -1790,70 +1790,70 @@ impl super::SBPMessage for MsgEphemerisDepD { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisDepA { pub sender_id: Option, + /// Group delay differential between L1 and L2 pub tgd: f64, - // ^ Group delay differential between L1 and L2 + /// Amplitude of the sine harmonic correction term to the orbit radius pub c_rs: f64, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the orbit radius pub c_rc: f64, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the argument of + /// latitude pub c_uc: f64, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + /// Amplitude of the sine harmonic correction term to the argument of + /// latitude pub c_us: f64, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + /// Amplitude of the cosine harmonic correction term to the angle of + /// inclination pub c_ic: f64, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + /// Amplitude of the sine harmonic correction term to the angle of + /// inclination pub c_is: f64, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + /// Mean motion difference pub dn: f64, - // ^ Mean motion difference + /// Mean anomaly at reference time pub m0: f64, - // ^ Mean anomaly at reference time + /// Eccentricity of satellite orbit pub ecc: f64, - // ^ Eccentricity of satellite orbit + /// Square root of the semi-major axis of orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + /// Longitude of ascending node of orbit plane at weekly epoch pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + /// Rate of right ascension pub omegadot: f64, - // ^ Rate of right ascension + /// Argument of perigee pub w: f64, - // ^ Argument of perigee + /// Inclination pub inc: f64, - // ^ Inclination + /// Inclination first derivative pub inc_dot: f64, - // ^ Inclination first derivative + /// Polynomial clock correction coefficient (clock bias) pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + /// Polynomial clock correction coefficient (clock drift) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) + /// Polynomial clock correction coefficient (rate of clock drift) pub af2: f64, - // ^ Polynomial clock correction coefficient (rate of clock drift) + /// Time of week pub toe_tow: f64, - // ^ Time of week + /// Week number pub toe_wn: u16, - // ^ Week number + /// Clock reference time of week pub toc_tow: f64, - // ^ Clock reference time of week + /// Clock reference week number pub toc_wn: u16, - // ^ Clock reference week number + /// Is valid? pub valid: u8, - // ^ Is valid? + /// Satellite is healthy? pub healthy: u8, - // ^ Satellite is healthy? + /// PRN being tracked pub prn: u8, - // ^ PRN being tracked } impl MsgEphemerisDepA { @@ -1901,72 +1901,72 @@ impl super::SBPMessage for MsgEphemerisDepA { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisDepB { pub sender_id: Option, + /// Group delay differential between L1 and L2 pub tgd: f64, - // ^ Group delay differential between L1 and L2 + /// Amplitude of the sine harmonic correction term to the orbit radius pub c_rs: f64, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the orbit radius pub c_rc: f64, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the argument of + /// latitude pub c_uc: f64, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + /// Amplitude of the sine harmonic correction term to the argument of + /// latitude pub c_us: f64, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + /// Amplitude of the cosine harmonic correction term to the angle of + /// inclination pub c_ic: f64, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + /// Amplitude of the sine harmonic correction term to the angle of + /// inclination pub c_is: f64, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + /// Mean motion difference pub dn: f64, - // ^ Mean motion difference + /// Mean anomaly at reference time pub m0: f64, - // ^ Mean anomaly at reference time + /// Eccentricity of satellite orbit pub ecc: f64, - // ^ Eccentricity of satellite orbit + /// Square root of the semi-major axis of orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + /// Longitude of ascending node of orbit plane at weekly epoch pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + /// Rate of right ascension pub omegadot: f64, - // ^ Rate of right ascension + /// Argument of perigee pub w: f64, - // ^ Argument of perigee + /// Inclination pub inc: f64, - // ^ Inclination + /// Inclination first derivative pub inc_dot: f64, - // ^ Inclination first derivative + /// Polynomial clock correction coefficient (clock bias) pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + /// Polynomial clock correction coefficient (clock drift) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) + /// Polynomial clock correction coefficient (rate of clock drift) pub af2: f64, - // ^ Polynomial clock correction coefficient (rate of clock drift) + /// Time of week pub toe_tow: f64, - // ^ Time of week + /// Week number pub toe_wn: u16, - // ^ Week number + /// Clock reference time of week pub toc_tow: f64, - // ^ Clock reference time of week + /// Clock reference week number pub toc_wn: u16, - // ^ Clock reference week number + /// Is valid? pub valid: u8, - // ^ Is valid? + /// Satellite is healthy? pub healthy: u8, - // ^ Satellite is healthy? + /// PRN being tracked pub prn: u8, - // ^ PRN being tracked + /// Issue of ephemeris data pub iode: u8, - // ^ Issue of ephemeris data } impl MsgEphemerisDepB { @@ -2015,80 +2015,80 @@ impl super::SBPMessage for MsgEphemerisDepB { } } -// Satellite broadcast ephemeris -// -// The ephemeris message returns a set of satellite orbit -// parameters that is used to calculate GPS satellite position, -// velocity, and clock offset. Please see the Navstar GPS -// Space Segment/Navigation user interfaces (ICD-GPS-200, Table -// 20-III) for more details. -// +/// Satellite broadcast ephemeris +/// +/// The ephemeris message returns a set of satellite orbit +/// parameters that is used to calculate GPS satellite position, +/// velocity, and clock offset. Please see the Navstar GPS +/// Space Segment/Navigation user interfaces (ICD-GPS-200, Table +/// 20-III) for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgEphemerisDepC { pub sender_id: Option, + /// Group delay differential between L1 and L2 pub tgd: f64, - // ^ Group delay differential between L1 and L2 + /// Amplitude of the sine harmonic correction term to the orbit radius pub c_rs: f64, - // ^ Amplitude of the sine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the orbit radius pub c_rc: f64, - // ^ Amplitude of the cosine harmonic correction term to the orbit radius + /// Amplitude of the cosine harmonic correction term to the argument of + /// latitude pub c_uc: f64, - // ^ Amplitude of the cosine harmonic correction term to the argument of - // latitude + /// Amplitude of the sine harmonic correction term to the argument of + /// latitude pub c_us: f64, - // ^ Amplitude of the sine harmonic correction term to the argument of - // latitude + /// Amplitude of the cosine harmonic correction term to the angle of + /// inclination pub c_ic: f64, - // ^ Amplitude of the cosine harmonic correction term to the angle of - // inclination + /// Amplitude of the sine harmonic correction term to the angle of + /// inclination pub c_is: f64, - // ^ Amplitude of the sine harmonic correction term to the angle of - // inclination + /// Mean motion difference pub dn: f64, - // ^ Mean motion difference + /// Mean anomaly at reference time pub m0: f64, - // ^ Mean anomaly at reference time + /// Eccentricity of satellite orbit pub ecc: f64, - // ^ Eccentricity of satellite orbit + /// Square root of the semi-major axis of orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + /// Longitude of ascending node of orbit plane at weekly epoch pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + /// Rate of right ascension pub omegadot: f64, - // ^ Rate of right ascension + /// Argument of perigee pub w: f64, - // ^ Argument of perigee + /// Inclination pub inc: f64, - // ^ Inclination + /// Inclination first derivative pub inc_dot: f64, - // ^ Inclination first derivative + /// Polynomial clock correction coefficient (clock bias) pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + /// Polynomial clock correction coefficient (clock drift) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) + /// Polynomial clock correction coefficient (rate of clock drift) pub af2: f64, - // ^ Polynomial clock correction coefficient (rate of clock drift) + /// Time of week pub toe_tow: f64, - // ^ Time of week + /// Week number pub toe_wn: u16, - // ^ Week number + /// Clock reference time of week pub toc_tow: f64, - // ^ Clock reference time of week + /// Clock reference week number pub toc_wn: u16, - // ^ Clock reference week number + /// Is valid? pub valid: u8, - // ^ Is valid? + /// Satellite is healthy? pub healthy: u8, - // ^ Satellite is healthy? + /// GNSS signal identifier pub sid: GnssSignalDep, - // ^ GNSS signal identifier + /// Issue of ephemeris data pub iode: u8, - // ^ Issue of ephemeris data + /// Issue of clock data pub iodc: u16, - // ^ Issue of clock data + /// Reserved field pub reserved: u32, - // ^ Reserved field } impl MsgEphemerisDepC { @@ -2139,18 +2139,18 @@ impl super::SBPMessage for MsgEphemerisDepC { } } -// Header for observation message. -// -// Header of a GPS observation message. -// +/// Header for observation message. +/// +/// Header of a GPS observation message. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct ObservationHeaderDep { + /// GPS time of this observation pub t: GPSTimeDep, - // ^ GPS time of this observation + /// Total number of observations. First nibble is the size of the sequence + /// (n), second nibble is the zero-indexed counter (ith packet of n) pub n_obs: u8, - // ^ Total number of observations. First nibble is the size of the sequence - // (n), second nibble is the zero-indexed counter (ith packet of n) } impl ObservationHeaderDep { @@ -2182,21 +2182,21 @@ impl ObservationHeaderDep { } } -// GPS carrier phase measurement. -// -// Carrier phase measurement in cycles represented as a 40-bit -// fixed point number with Q32.8 layout, i.e. 32-bits of whole -// cycles and 8-bits of fractional cycles. This has the opposite -// sign convention than a typical GPS receiver and the phase has -// the opposite sign as the pseudorange. -// +/// GPS carrier phase measurement. +/// +/// Carrier phase measurement in cycles represented as a 40-bit +/// fixed point number with Q32.8 layout, i.e. 32-bits of whole +/// cycles and 8-bits of fractional cycles. This has the opposite +/// sign convention than a typical GPS receiver and the phase has +/// the opposite sign as the pseudorange. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct CarrierPhaseDepA { + /// Carrier phase whole cycles pub i: i32, - // ^ Carrier phase whole cycles + /// Carrier phase fractional part pub f: u8, - // ^ Carrier phase fractional part } impl CarrierPhaseDepA { @@ -2226,25 +2226,25 @@ impl CarrierPhaseDepA { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct PackedObsContentDepA { + /// Pseudorange observation pub P: u32, - // ^ Pseudorange observation + /// Carrier phase observation with opposite sign from typical convention pub L: CarrierPhaseDepA, - // ^ Carrier phase observation with opposite sign from typical convention + /// Carrier-to-Noise density pub cn0: u8, - // ^ Carrier-to-Noise density + /// Lock indicator. This value changes whenever a satellite signal has lost + /// and regained lock, indicating that the carrier phase ambiguity may have + /// changed. pub lock: u16, - // ^ Lock indicator. This value changes whenever a satellite signal has lost - // and regained lock, indicating that the carrier phase ambiguity may have - // changed. + /// PRN-1 identifier of the satellite signal pub prn: u8, - // ^ PRN-1 identifier of the satellite signal } impl PackedObsContentDepA { @@ -2279,26 +2279,26 @@ impl PackedObsContentDepA { } } -// GPS observations for a particular satellite signal. -// -// Pseudorange and carrier phase observation for a satellite being -// tracked. Pseudoranges are referenced to a nominal pseudorange. -// +/// GPS observations for a particular satellite signal. +/// +/// Pseudorange and carrier phase observation for a satellite being +/// tracked. Pseudoranges are referenced to a nominal pseudorange. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct PackedObsContentDepB { + /// Pseudorange observation pub P: u32, - // ^ Pseudorange observation + /// Carrier phase observation with opposite sign from typical convention. pub L: CarrierPhaseDepA, - // ^ Carrier phase observation with opposite sign from typical convention. + /// Carrier-to-Noise density pub cn0: u8, - // ^ Carrier-to-Noise density + /// Lock indicator. This value changes whenever a satellite signal has lost + /// and regained lock, indicating that the carrier phase ambiguity may have + /// changed. pub lock: u16, - // ^ Lock indicator. This value changes whenever a satellite signal has lost - // and regained lock, indicating that the carrier phase ambiguity may have - // changed. + /// GNSS signal identifier pub sid: GnssSignalDep, - // ^ GNSS signal identifier } impl PackedObsContentDepB { @@ -2333,27 +2333,27 @@ impl PackedObsContentDepB { } } -// GPS observations for a particular satellite signal. -// -// Pseudorange and carrier phase observation for a satellite being -// tracked. The observations are be interoperable with 3rd party -// receivers and conform with typical RTCMv3 GNSS observations. -// +/// GPS observations for a particular satellite signal. +/// +/// Pseudorange and carrier phase observation for a satellite being +/// tracked. The observations are be interoperable with 3rd party +/// receivers and conform with typical RTCMv3 GNSS observations. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct PackedObsContentDepC { + /// Pseudorange observation pub P: u32, - // ^ Pseudorange observation + /// Carrier phase observation with typical sign convention. pub L: CarrierPhase, - // ^ Carrier phase observation with typical sign convention. + /// Carrier-to-Noise density pub cn0: u8, - // ^ Carrier-to-Noise density + /// Lock indicator. This value changes whenever a satellite signal has lost + /// and regained lock, indicating that the carrier phase ambiguity may have + /// changed. pub lock: u16, - // ^ Lock indicator. This value changes whenever a satellite signal has lost - // and regained lock, indicating that the carrier phase ambiguity may have - // changed. + /// GNSS signal identifier pub sid: GnssSignalDep, - // ^ GNSS signal identifier } impl PackedObsContentDepC { @@ -2388,18 +2388,18 @@ impl PackedObsContentDepC { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgObsDepA { pub sender_id: Option, + /// Header of a GPS observation message pub header: ObservationHeaderDep, - // ^ Header of a GPS observation message + /// Pseudorange and carrier phase observation for a satellite being tracked. pub obs: Vec, - // ^ Pseudorange and carrier phase observation for a satellite being tracked. } impl MsgObsDepA { @@ -2423,23 +2423,23 @@ impl super::SBPMessage for MsgObsDepA { } } -// Deprecated -// -// This observation message has been deprecated in favor of -// observations that are more interoperable. This message -// should be used for observations referenced to -// a nominal pseudorange which are not interoperable with -// most 3rd party GNSS receievers or typical RTCMv3 -// observations. -// +/// Deprecated +/// +/// This observation message has been deprecated in favor of +/// observations that are more interoperable. This message +/// should be used for observations referenced to +/// a nominal pseudorange which are not interoperable with +/// most 3rd party GNSS receievers or typical RTCMv3 +/// observations. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgObsDepB { pub sender_id: Option, + /// Header of a GPS observation message pub header: ObservationHeaderDep, - // ^ Header of a GPS observation message + /// Pseudorange and carrier phase observation for a satellite being tracked. pub obs: Vec, - // ^ Pseudorange and carrier phase observation for a satellite being tracked. } impl MsgObsDepB { @@ -2463,24 +2463,24 @@ impl super::SBPMessage for MsgObsDepB { } } -// Deprecated -// -// The GPS observations message reports all the raw pseudorange and -// carrier phase observations for the satellites being tracked by -// the device. Carrier phase observation here is represented as a -// 40-bit fixed point number with Q32.8 layout (i.e. 32-bits of -// whole cycles and 8-bits of fractional cycles). The observations -// are interoperable with 3rd party receivers and conform -// with typical RTCMv3 GNSS observations. -// +/// Deprecated +/// +/// The GPS observations message reports all the raw pseudorange and +/// carrier phase observations for the satellites being tracked by +/// the device. Carrier phase observation here is represented as a +/// 40-bit fixed point number with Q32.8 layout (i.e. 32-bits of +/// whole cycles and 8-bits of fractional cycles). The observations +/// are interoperable with 3rd party receivers and conform +/// with typical RTCMv3 GNSS observations. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgObsDepC { pub sender_id: Option, + /// Header of a GPS observation message pub header: ObservationHeaderDep, - // ^ Header of a GPS observation message + /// Pseudorange and carrier phase observation for a satellite being tracked. pub obs: Vec, - // ^ Pseudorange and carrier phase observation for a satellite being tracked. } impl MsgObsDepC { @@ -2504,18 +2504,18 @@ impl super::SBPMessage for MsgObsDepC { } } -// Iono corrections -// -// The ionospheric parameters which allow the "L1 only" or "L2 only" user to -// utilize the ionospheric model for computation of the ionospheric delay. -// Please see ICD-GPS-200 (Chapter 20.3.3.5.1.7) for more details. -// +/// Iono corrections +/// +/// The ionospheric parameters which allow the "L1 only" or "L2 only" user to +/// utilize the ionospheric model for computation of the ionospheric delay. +/// Please see ICD-GPS-200 (Chapter 20.3.3.5.1.7) for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgIono { pub sender_id: Option, + /// Navigation Message Correction Table Valitidy Time pub t_nmct: GPSTimeSec, - // ^ Navigation Message Correction Table Valitidy Time pub a0: f64, pub a1: f64, pub a2: f64, @@ -2554,18 +2554,18 @@ impl super::SBPMessage for MsgIono { } } -// L2C capability mask -// -// Please see ICD-GPS-200 (Chapter 20.3.3.5.1.4) for more details. -// +/// L2C capability mask +/// +/// Please see ICD-GPS-200 (Chapter 20.3.3.5.1.4) for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSvConfigurationGPSDep { pub sender_id: Option, + /// Navigation Message Correction Table Valitidy Time pub t_nmct: GPSTimeSec, - // ^ Navigation Message Correction Table Valitidy Time + /// L2C capability mask, SV32 bit being MSB, SV1 bit being LSB pub l2c_mask: u32, - // ^ L2C capability mask, SV32 bit being MSB, SV1 bit being LSB } impl MsgSvConfigurationGPSDep { @@ -2592,38 +2592,38 @@ impl super::SBPMessage for MsgSvConfigurationGPSDep { #[derive(Debug)] #[allow(non_snake_case)] pub struct GnssCapb { + /// GPS SV active mask pub gps_active: u64, - // ^ GPS SV active mask + /// GPS L2C active mask pub gps_l2c: u64, - // ^ GPS L2C active mask + /// GPS L5 active mask pub gps_l5: u64, - // ^ GPS L5 active mask + /// GLO active mask pub glo_active: u32, - // ^ GLO active mask + /// GLO L2OF active mask pub glo_l2of: u32, - // ^ GLO L2OF active mask + /// GLO L3 active mask pub glo_l3: u32, - // ^ GLO L3 active mask + /// SBAS active mask (PRNs 120..158, AN 7/62.2.2-18/18 Table B-23, + /// https://www.caat.or.th/wp-content/uploads/2018/03/SL-2018.18.E-1.pdf) pub sbas_active: u64, - // ^ SBAS active mask (PRNs 120..158, AN 7/62.2.2-18/18 Table B-23, - // https://www.caat.or.th/wp-content/uploads/2018/03/SL-2018.18.E-1.pdf) + /// SBAS L5 active mask (PRNs 120..158, AN 7/62.2.2-18/18 Table B-23, + /// https://www.caat.or.th/wp-content/uploads/2018/03/SL-2018.18.E-1.pdf) pub sbas_l5: u64, - // ^ SBAS L5 active mask (PRNs 120..158, AN 7/62.2.2-18/18 Table B-23, - // https://www.caat.or.th/wp-content/uploads/2018/03/SL-2018.18.E-1.pdf) + /// BDS active mask pub bds_active: u64, - // ^ BDS active mask + /// BDS D2NAV active mask pub bds_d2nav: u64, - // ^ BDS D2NAV active mask + /// BDS B2 active mask pub bds_b2: u64, - // ^ BDS B2 active mask + /// BDS B2A active mask pub bds_b2a: u64, - // ^ BDS B2A active mask + /// QZSS active mask pub qzss_active: u32, - // ^ QZSS active mask + /// GAL active mask pub gal_active: u64, - // ^ GAL active mask + /// GAL E5 active mask pub gal_e5: u64, - // ^ GAL E5 active mask } impl GnssCapb { @@ -2670,10 +2670,10 @@ impl GnssCapb { #[allow(non_snake_case)] pub struct MsgGnssCapb { pub sender_id: Option, + /// Navigation Message Correction Table Validity Time pub t_nmct: GPSTimeSec, - // ^ Navigation Message Correction Table Validity Time + /// GNSS capabilities masks pub gc: GnssCapb, - // ^ GNSS capabilities masks } impl MsgGnssCapb { @@ -2697,21 +2697,21 @@ impl super::SBPMessage for MsgGnssCapb { } } -// Group Delay -// -// Please see ICD-GPS-200 (30.3.3.3.1.1) for more details. -// +/// Group Delay +/// +/// Please see ICD-GPS-200 (30.3.3.3.1.1) for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgGroupDelayDepA { pub sender_id: Option, + /// Data Predict Time of Week pub t_op: GPSTimeDep, - // ^ Data Predict Time of Week + /// Satellite number pub prn: u8, - // ^ Satellite number + /// bit-field indicating validity of the values, LSB indicating tgd validity + /// etc. 1 = value is valid, 0 = value is not valid. pub valid: u8, - // ^ bit-field indicating validity of the values, LSB indicating tgd validity - // etc. 1 = value is valid, 0 = value is not valid. pub tgd: i16, pub isc_l1ca: i16, pub isc_l2c: i16, @@ -2742,21 +2742,21 @@ impl super::SBPMessage for MsgGroupDelayDepA { } } -// Group Delay -// -// Please see ICD-GPS-200 (30.3.3.3.1.1) for more details. -// +/// Group Delay +/// +/// Please see ICD-GPS-200 (30.3.3.3.1.1) for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgGroupDelayDepB { pub sender_id: Option, + /// Data Predict Time of Week pub t_op: GPSTimeSec, - // ^ Data Predict Time of Week + /// GNSS signal identifier pub sid: GnssSignalDep, - // ^ GNSS signal identifier + /// bit-field indicating validity of the values, LSB indicating tgd validity + /// etc. 1 = value is valid, 0 = value is not valid. pub valid: u8, - // ^ bit-field indicating validity of the values, LSB indicating tgd validity - // etc. 1 = value is valid, 0 = value is not valid. pub tgd: i16, pub isc_l1ca: i16, pub isc_l2c: i16, @@ -2787,21 +2787,21 @@ impl super::SBPMessage for MsgGroupDelayDepB { } } -// Group Delay -// -// Please see ICD-GPS-200 (30.3.3.3.1.1) for more details. -// +/// Group Delay +/// +/// Please see ICD-GPS-200 (30.3.3.3.1.1) for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgGroupDelay { pub sender_id: Option, + /// Data Predict Time of Week pub t_op: GPSTimeSec, - // ^ Data Predict Time of Week + /// GNSS signal identifier pub sid: GnssSignal, - // ^ GNSS signal identifier + /// bit-field indicating validity of the values, LSB indicating tgd validity + /// etc. 1 = value is valid, 0 = value is not valid. pub valid: u8, - // ^ bit-field indicating validity of the values, LSB indicating tgd validity - // etc. 1 = value is valid, 0 = value is not valid. pub tgd: i16, pub isc_l1ca: i16, pub isc_l2c: i16, @@ -2835,27 +2835,27 @@ impl super::SBPMessage for MsgGroupDelay { #[derive(Debug)] #[allow(non_snake_case)] pub struct AlmanacCommonContent { + /// GNSS signal identifier pub sid: GnssSignal, - // ^ GNSS signal identifier + /// Reference time of almanac pub toa: GPSTimeSec, - // ^ Reference time of almanac + /// User Range Accuracy pub ura: f64, - // ^ User Range Accuracy + /// Curve fit interval pub fit_interval: u32, - // ^ Curve fit interval + /// Status of almanac, 1 = valid, 0 = invalid pub valid: u8, - // ^ Status of almanac, 1 = valid, 0 = invalid + /// Satellite health status for GPS: - bits 5-7: NAV data health status. + /// See IS-GPS-200H Table 20-VII: NAV Data Health Indications. - bits + /// 0-4: Signal health status. See IS-GPS-200H Table 20-VIII. Codes for + /// Health of SV Signal Components. Satellite health status for GLO: + /// See GLO ICD 5.1 table 5.1 for details - bit 0: C(n), "unhealthy" flag + /// that is transmitted within non-immediate data and indicates overall + /// constellation status at the moment of almanac uploading. '0' + /// indicates malfunction of n-satellite. '1' indicates that n-satellite + /// is operational. - bit 1: Bn(ln), '0' indicates the satellite is + /// operational and suitable for navigation. pub health_bits: u8, - // ^ Satellite health status for GPS: - bits 5-7: NAV data health status. - // See IS-GPS-200H Table 20-VII: NAV Data Health Indications. - bits - // 0-4: Signal health status. See IS-GPS-200H Table 20-VIII. Codes for - // Health of SV Signal Components. Satellite health status for GLO: - // See GLO ICD 5.1 table 5.1 for details - bit 0: C(n), "unhealthy" flag - // that is transmitted within non-immediate data and indicates overall - // constellation status at the moment of almanac uploading. '0' - // indicates malfunction of n-satellite. '1' indicates that n-satellite - // is operational. - bit 1: Bn(ln), '0' indicates the satellite is - // operational and suitable for navigation. } impl AlmanacCommonContent { @@ -2894,27 +2894,27 @@ impl AlmanacCommonContent { #[derive(Debug)] #[allow(non_snake_case)] pub struct AlmanacCommonContentDep { + /// GNSS signal identifier pub sid: GnssSignalDep, - // ^ GNSS signal identifier + /// Reference time of almanac pub toa: GPSTimeSec, - // ^ Reference time of almanac + /// User Range Accuracy pub ura: f64, - // ^ User Range Accuracy + /// Curve fit interval pub fit_interval: u32, - // ^ Curve fit interval + /// Status of almanac, 1 = valid, 0 = invalid pub valid: u8, - // ^ Status of almanac, 1 = valid, 0 = invalid + /// Satellite health status for GPS: - bits 5-7: NAV data health status. + /// See IS-GPS-200H Table 20-VII: NAV Data Health Indications. - bits + /// 0-4: Signal health status. See IS-GPS-200H Table 20-VIII. Codes for + /// Health of SV Signal Components. Satellite health status for GLO: + /// See GLO ICD 5.1 table 5.1 for details - bit 0: C(n), "unhealthy" flag + /// that is transmitted within non-immediate data and indicates overall + /// constellation status at the moment of almanac uploading. '0' + /// indicates malfunction of n-satellite. '1' indicates that n-satellite + /// is operational. - bit 1: Bn(ln), '0' indicates the satellite is + /// operational and suitable for navigation. pub health_bits: u8, - // ^ Satellite health status for GPS: - bits 5-7: NAV data health status. - // See IS-GPS-200H Table 20-VII: NAV Data Health Indications. - bits - // 0-4: Signal health status. See IS-GPS-200H Table 20-VIII. Codes for - // Health of SV Signal Components. Satellite health status for GLO: - // See GLO ICD 5.1 table 5.1 for details - bit 0: C(n), "unhealthy" flag - // that is transmitted within non-immediate data and indicates overall - // constellation status at the moment of almanac uploading. '0' - // indicates malfunction of n-satellite. '1' indicates that n-satellite - // is operational. - bit 1: Bn(ln), '0' indicates the satellite is - // operational and suitable for navigation. } impl AlmanacCommonContentDep { @@ -2950,37 +2950,37 @@ impl AlmanacCommonContentDep { } } -// Satellite broadcast ephemeris for GPS -// -// The almanac message returns a set of satellite orbit parameters. Almanac -// data is not very precise and is considered valid for up to several months. -// Please see the Navstar GPS Space Segment/Navigation user interfaces -// (ICD-GPS-200, Chapter 20.3.3.5.1.2 Almanac Data) for more details. -// +/// Satellite broadcast ephemeris for GPS +/// +/// The almanac message returns a set of satellite orbit parameters. Almanac +/// data is not very precise and is considered valid for up to several months. +/// Please see the Navstar GPS Space Segment/Navigation user interfaces +/// (ICD-GPS-200, Chapter 20.3.3.5.1.2 Almanac Data) for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAlmanacGPSDep { pub sender_id: Option, + /// Values common for all almanac types pub common: AlmanacCommonContentDep, - // ^ Values common for all almanac types + /// Mean anomaly at reference time pub m0: f64, - // ^ Mean anomaly at reference time + /// Eccentricity of satellite orbit pub ecc: f64, - // ^ Eccentricity of satellite orbit + /// Square root of the semi-major axis of orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + /// Longitude of ascending node of orbit plane at weekly epoch pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + /// Rate of right ascension pub omegadot: f64, - // ^ Rate of right ascension + /// Argument of perigee pub w: f64, - // ^ Argument of perigee + /// Inclination pub inc: f64, - // ^ Inclination + /// Polynomial clock correction coefficient (clock bias) pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + /// Polynomial clock correction coefficient (clock drift) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) } impl MsgAlmanacGPSDep { @@ -3012,37 +3012,37 @@ impl super::SBPMessage for MsgAlmanacGPSDep { } } -// Satellite broadcast ephemeris for GPS -// -// The almanac message returns a set of satellite orbit parameters. Almanac -// data is not very precise and is considered valid for up to several months. -// Please see the Navstar GPS Space Segment/Navigation user interfaces -// (ICD-GPS-200, Chapter 20.3.3.5.1.2 Almanac Data) for more details. -// +/// Satellite broadcast ephemeris for GPS +/// +/// The almanac message returns a set of satellite orbit parameters. Almanac +/// data is not very precise and is considered valid for up to several months. +/// Please see the Navstar GPS Space Segment/Navigation user interfaces +/// (ICD-GPS-200, Chapter 20.3.3.5.1.2 Almanac Data) for more details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAlmanacGPS { pub sender_id: Option, + /// Values common for all almanac types pub common: AlmanacCommonContent, - // ^ Values common for all almanac types + /// Mean anomaly at reference time pub m0: f64, - // ^ Mean anomaly at reference time + /// Eccentricity of satellite orbit pub ecc: f64, - // ^ Eccentricity of satellite orbit + /// Square root of the semi-major axis of orbit pub sqrta: f64, - // ^ Square root of the semi-major axis of orbit + /// Longitude of ascending node of orbit plane at weekly epoch pub omega0: f64, - // ^ Longitude of ascending node of orbit plane at weekly epoch + /// Rate of right ascension pub omegadot: f64, - // ^ Rate of right ascension + /// Argument of perigee pub w: f64, - // ^ Argument of perigee + /// Inclination pub inc: f64, - // ^ Inclination + /// Polynomial clock correction coefficient (clock bias) pub af0: f64, - // ^ Polynomial clock correction coefficient (clock bias) + /// Polynomial clock correction coefficient (clock drift) pub af1: f64, - // ^ Polynomial clock correction coefficient (clock drift) } impl MsgAlmanacGPS { @@ -3074,34 +3074,34 @@ impl super::SBPMessage for MsgAlmanacGPS { } } -// Satellite broadcast ephemeris for GLO -// -// The almanac message returns a set of satellite orbit parameters. Almanac -// data is not very precise and is considered valid for up to several months. -// Please see the GLO ICD 5.1 "Chapter 4.5 Non-immediate information and -// almanac" for details. -// +/// Satellite broadcast ephemeris for GLO +/// +/// The almanac message returns a set of satellite orbit parameters. Almanac +/// data is not very precise and is considered valid for up to several months. +/// Please see the GLO ICD 5.1 "Chapter 4.5 Non-immediate information and +/// almanac" for details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAlmanacGloDep { pub sender_id: Option, + /// Values common for all almanac types pub common: AlmanacCommonContentDep, - // ^ Values common for all almanac types + /// Longitude of the first ascending node of the orbit in PZ-90.02 + /// coordinate system pub lambda_na: f64, - // ^ Longitude of the first ascending node of the orbit in PZ-90.02 - // coordinate system + /// Time of the first ascending node passage pub t_lambda_na: f64, - // ^ Time of the first ascending node passage + /// Value of inclination at instant of t_lambda pub i: f64, - // ^ Value of inclination at instant of t_lambda + /// Value of Draconian period at instant of t_lambda pub t: f64, - // ^ Value of Draconian period at instant of t_lambda + /// Rate of change of the Draconian period pub t_dot: f64, - // ^ Rate of change of the Draconian period + /// Eccentricity at instant of t_lambda pub epsilon: f64, - // ^ Eccentricity at instant of t_lambda + /// Argument of perigee at instant of t_lambda pub omega: f64, - // ^ Argument of perigee at instant of t_lambda } impl MsgAlmanacGloDep { @@ -3131,34 +3131,34 @@ impl super::SBPMessage for MsgAlmanacGloDep { } } -// Satellite broadcast ephemeris for GLO -// -// The almanac message returns a set of satellite orbit parameters. Almanac -// data is not very precise and is considered valid for up to several months. -// Please see the GLO ICD 5.1 "Chapter 4.5 Non-immediate information and -// almanac" for details. -// +/// Satellite broadcast ephemeris for GLO +/// +/// The almanac message returns a set of satellite orbit parameters. Almanac +/// data is not very precise and is considered valid for up to several months. +/// Please see the GLO ICD 5.1 "Chapter 4.5 Non-immediate information and +/// almanac" for details. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAlmanacGlo { pub sender_id: Option, + /// Values common for all almanac types pub common: AlmanacCommonContent, - // ^ Values common for all almanac types + /// Longitude of the first ascending node of the orbit in PZ-90.02 + /// coordinate system pub lambda_na: f64, - // ^ Longitude of the first ascending node of the orbit in PZ-90.02 - // coordinate system + /// Time of the first ascending node passage pub t_lambda_na: f64, - // ^ Time of the first ascending node passage + /// Value of inclination at instant of t_lambda pub i: f64, - // ^ Value of inclination at instant of t_lambda + /// Value of Draconian period at instant of t_lambda pub t: f64, - // ^ Value of Draconian period at instant of t_lambda + /// Rate of change of the Draconian period pub t_dot: f64, - // ^ Rate of change of the Draconian period + /// Eccentricity at instant of t_lambda pub epsilon: f64, - // ^ Eccentricity at instant of t_lambda + /// Argument of perigee at instant of t_lambda pub omega: f64, - // ^ Argument of perigee at instant of t_lambda } impl MsgAlmanacGlo { @@ -3188,27 +3188,27 @@ impl super::SBPMessage for MsgAlmanacGlo { } } -// GLONASS L1/L2 Code-Phase biases -// -// The GLONASS L1/L2 Code-Phase biases allows to perform -// GPS+GLONASS integer ambiguity resolution for baselines -// with mixed receiver types (e.g. receiver of different -// manufacturers) -// +/// GLONASS L1/L2 Code-Phase biases +/// +/// The GLONASS L1/L2 Code-Phase biases allows to perform +/// GPS+GLONASS integer ambiguity resolution for baselines +/// with mixed receiver types (e.g. receiver of different +/// manufacturers) +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgGloBiases { pub sender_id: Option, + /// GLONASS FDMA signals mask pub mask: u8, - // ^ GLONASS FDMA signals mask + /// GLONASS L1 C/A Code-Phase Bias pub l1ca_bias: i16, - // ^ GLONASS L1 C/A Code-Phase Bias + /// GLONASS L1 P Code-Phase Bias pub l1p_bias: i16, - // ^ GLONASS L1 P Code-Phase Bias + /// GLONASS L2 C/A Code-Phase Bias pub l2ca_bias: i16, - // ^ GLONASS L2 C/A Code-Phase Bias + /// GLONASS L2 P Code-Phase Bias pub l2p_bias: i16, - // ^ GLONASS L2 P Code-Phase Bias } impl MsgGloBiases { @@ -3235,19 +3235,19 @@ impl super::SBPMessage for MsgGloBiases { } } -// Satellite azimuth and elevation. -// -// Satellite azimuth and elevation. -// +/// Satellite azimuth and elevation. +/// +/// Satellite azimuth and elevation. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct SvAzEl { + /// GNSS signal identifier pub sid: GnssSignal, - // ^ GNSS signal identifier + /// Azimuth angle (range 0..179) pub az: u8, - // ^ Azimuth angle (range 0..179) + /// Elevation angle (range -90..90) pub el: i8, - // ^ Elevation angle (range -90..90) } impl SvAzEl { @@ -3278,17 +3278,17 @@ impl SvAzEl { } } -// Satellite azimuths and elevations -// -// Azimuth and elevation angles of all the visible satellites -// that the device does have ephemeris or almanac for. -// +/// Satellite azimuths and elevations +/// +/// Azimuth and elevation angles of all the visible satellites +/// that the device does have ephemeris or almanac for. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSvAzEl { pub sender_id: Option, + /// Azimuth and elevation per satellite pub azel: Vec, - // ^ Azimuth and elevation per satellite } impl MsgSvAzEl { @@ -3311,18 +3311,18 @@ impl super::SBPMessage for MsgSvAzEl { } } -// OSR corrections -// -// The OSR message contains network corrections in an observation-like format -// +/// OSR corrections +/// +/// The OSR message contains network corrections in an observation-like format +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgOsr { pub sender_id: Option, + /// Header of a GPS observation message pub header: ObservationHeader, - // ^ Header of a GPS observation message + /// Network correction for a satellite signal. pub obs: Vec, - // ^ Network correction for a satellite signal. } impl MsgOsr { diff --git a/rust/sbp/src/messages/orientation.rs b/rust/sbp/src/messages/orientation.rs index 472811d5cb..ba386cba78 100644 --- a/rust/sbp/src/messages/orientation.rs +++ b/rust/sbp/src/messages/orientation.rs @@ -12,30 +12,30 @@ // Automatically generated from yaml/swiftnav/sbp/orientation.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Orientation Messages +/// Orientation Messages extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; -// Heading relative to True North -// -// This message reports the baseline heading pointing from the base station -// to the rover relative to True North. The full GPS time is given by the -// preceding MSG_GPS_TIME with the matching time-of-week (tow). It is intended -// that time-matched RTK mode is used when the base station is moving. -// +/// Heading relative to True North +/// +/// This message reports the baseline heading pointing from the base station +/// to the rover relative to True North. The full GPS time is given by the +/// preceding MSG_GPS_TIME with the matching time-of-week (tow). It is intended +/// that time-matched RTK mode is used when the base station is moving. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgBaselineHeading { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Heading pub heading: u32, - // ^ Heading + /// Number of satellites used in solution pub n_sats: u8, - // ^ Number of satellites used in solution + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgBaselineHeading { @@ -61,38 +61,38 @@ impl super::SBPMessage for MsgBaselineHeading { } } -// Quaternion 4 component vector -// -// This message reports the quaternion vector describing the vehicle body frame's orientation -// with respect to a local-level NED frame. The components of the vector should sum to a unit -// vector assuming that the LSB of each component as a value of 2^-31. This message will only -// be available in future INS versions of Swift Products and is not produced by Piksi Multi -// or Duro. -// +/// Quaternion 4 component vector +/// +/// This message reports the quaternion vector describing the vehicle body frame's orientation +/// with respect to a local-level NED frame. The components of the vector should sum to a unit +/// vector assuming that the LSB of each component as a value of 2^-31. This message will only +/// be available in future INS versions of Swift Products and is not produced by Piksi Multi +/// or Duro. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgOrientQuat { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// Real component pub w: i32, - // ^ Real component + /// 1st imaginary component pub x: i32, - // ^ 1st imaginary component + /// 2nd imaginary component pub y: i32, - // ^ 2nd imaginary component + /// 3rd imaginary component pub z: i32, - // ^ 3rd imaginary component + /// Estimated standard deviation of w pub w_accuracy: f32, - // ^ Estimated standard deviation of w + /// Estimated standard deviation of x pub x_accuracy: f32, - // ^ Estimated standard deviation of x + /// Estimated standard deviation of y pub y_accuracy: f32, - // ^ Estimated standard deviation of y + /// Estimated standard deviation of z pub z_accuracy: f32, - // ^ Estimated standard deviation of z + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgOrientQuat { @@ -124,34 +124,34 @@ impl super::SBPMessage for MsgOrientQuat { } } -// Euler angles -// -// This message reports the yaw, pitch, and roll angles of the vehicle body frame. -// The rotations should applied intrinsically in the order yaw, pitch, and roll -// in order to rotate the from a frame aligned with the local-level NED frame -// to the vehicle body frame. This message will only be available in future -// INS versions of Swift Products and is not produced by Piksi Multi or Duro. -// +/// Euler angles +/// +/// This message reports the yaw, pitch, and roll angles of the vehicle body frame. +/// The rotations should applied intrinsically in the order yaw, pitch, and roll +/// in order to rotate the from a frame aligned with the local-level NED frame +/// to the vehicle body frame. This message will only be available in future +/// INS versions of Swift Products and is not produced by Piksi Multi or Duro. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgOrientEuler { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// rotation about the forward axis of the vehicle pub roll: i32, - // ^ rotation about the forward axis of the vehicle + /// rotation about the rightward axis of the vehicle pub pitch: i32, - // ^ rotation about the rightward axis of the vehicle + /// rotation about the downward axis of the vehicle pub yaw: i32, - // ^ rotation about the downward axis of the vehicle + /// Estimated standard deviation of roll pub roll_accuracy: f32, - // ^ Estimated standard deviation of roll + /// Estimated standard deviation of pitch pub pitch_accuracy: f32, - // ^ Estimated standard deviation of pitch + /// Estimated standard deviation of yaw pub yaw_accuracy: f32, - // ^ Estimated standard deviation of yaw + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgOrientEuler { @@ -181,32 +181,32 @@ impl super::SBPMessage for MsgOrientEuler { } } -// Vehicle Body Frame instantaneous angular rates -// -// This message reports the orientation rates in the vehicle body frame. -// The values represent the measurements a strapped down gyroscope would -// make and are not equivalent to the time derivative of the Euler angles. -// The orientation and origin of the user frame is specified via device settings. -// By convention, the vehicle x-axis is expected to be aligned with the forward -// direction, while the vehicle y-axis is expected to be aligned with the right -// direction, and the vehicle z-axis should be aligned with the down direction. -// This message will only be available in future INS versions of Swift Products -// and is not produced by Piksi Multi or Duro. -// +/// Vehicle Body Frame instantaneous angular rates +/// +/// This message reports the orientation rates in the vehicle body frame. +/// The values represent the measurements a strapped down gyroscope would +/// make and are not equivalent to the time derivative of the Euler angles. +/// The orientation and origin of the user frame is specified via device settings. +/// By convention, the vehicle x-axis is expected to be aligned with the forward +/// direction, while the vehicle y-axis is expected to be aligned with the right +/// direction, and the vehicle z-axis should be aligned with the down direction. +/// This message will only be available in future INS versions of Swift Products +/// and is not produced by Piksi Multi or Duro. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAngularRate { pub sender_id: Option, + /// GPS Time of Week pub tow: u32, - // ^ GPS Time of Week + /// angular rate about x axis pub x: i32, - // ^ angular rate about x axis + /// angular rate about y axis pub y: i32, - // ^ angular rate about y axis + /// angular rate about z axis pub z: i32, - // ^ angular rate about z axis + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgAngularRate { diff --git a/rust/sbp/src/messages/piksi.rs b/rust/sbp/src/messages/piksi.rs index 41689e0c6f..65d6d1be26 100644 --- a/rust/sbp/src/messages/piksi.rs +++ b/rust/sbp/src/messages/piksi.rs @@ -12,19 +12,19 @@ // Automatically generated from yaml/swiftnav/sbp/piksi.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// System health, configuration, and diagnostic messages specific to -// the Piksi L1 receiver, including a variety of legacy messages that -// may no longer be used. +/// System health, configuration, and diagnostic messages specific to +/// the Piksi L1 receiver, including a variety of legacy messages that +/// may no longer be used. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; use super::gnss::*; -// Legacy message to load satellite almanac (host => Piksi) -// -// This is a legacy message for sending and loading a satellite -// alamanac onto the Piksi's flash memory from the host. -// +/// Legacy message to load satellite almanac (host => Piksi) +/// +/// This is a legacy message for sending and loading a satellite +/// alamanac onto the Piksi's flash memory from the host. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgAlmanac { @@ -48,11 +48,11 @@ impl super::SBPMessage for MsgAlmanac { } } -// Send GPS time from host (host => Piksi) -// -// This message sets up timing functionality using a coarse GPS -// time estimate sent by the host. -// +/// Send GPS time from host (host => Piksi) +/// +/// This message sets up timing functionality using a coarse GPS +/// time estimate sent by the host. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSetTime { @@ -76,17 +76,17 @@ impl super::SBPMessage for MsgSetTime { } } -// Reset the device (host => Piksi) -// -// This message from the host resets the Piksi back into the -// bootloader. -// +/// Reset the device (host => Piksi) +/// +/// This message from the host resets the Piksi back into the +/// bootloader. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgReset { pub sender_id: Option, + /// Reset flags pub flags: u32, - // ^ Reset flags } impl MsgReset { @@ -109,11 +109,11 @@ impl super::SBPMessage for MsgReset { } } -// Reset the device (host => Piksi) -// -// This message from the host resets the Piksi back into the -// bootloader. -// +/// Reset the device (host => Piksi) +/// +/// This message from the host resets the Piksi back into the +/// bootloader. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgResetDep { @@ -137,12 +137,12 @@ impl super::SBPMessage for MsgResetDep { } } -// Legacy message for CW interference channel (Piksi => host) -// -// This is an unused legacy message for result reporting from the -// CW interference channel on the SwiftNAP. This message will be -// removed in a future release. -// +/// Legacy message for CW interference channel (Piksi => host) +/// +/// This is an unused legacy message for result reporting from the +/// CW interference channel on the SwiftNAP. This message will be +/// removed in a future release. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgCwResults { @@ -166,12 +166,12 @@ impl super::SBPMessage for MsgCwResults { } } -// Legacy message for CW interference channel (host => Piksi) -// -// This is an unused legacy message from the host for starting -// the CW interference channel on the SwiftNAP. This message will -// be removed in a future release. -// +/// Legacy message for CW interference channel (host => Piksi) +/// +/// This is an unused legacy message from the host for starting +/// the CW interference channel on the SwiftNAP. This message will +/// be removed in a future release. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgCwStart { @@ -195,17 +195,17 @@ impl super::SBPMessage for MsgCwStart { } } -// Reset IAR filters (host => Piksi) -// -// This message resets either the DGNSS Kalman filters or Integer -// Ambiguity Resolution (IAR) process. -// +/// Reset IAR filters (host => Piksi) +/// +/// This message resets either the DGNSS Kalman filters or Integer +/// Ambiguity Resolution (IAR) process. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgResetFilters { pub sender_id: Option, + /// Filter flags pub filter: u8, - // ^ Filter flags } impl MsgResetFilters { @@ -228,10 +228,10 @@ impl super::SBPMessage for MsgResetFilters { } } -// Deprecated -// -// Deprecated -// +/// Deprecated +/// +/// Deprecated +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgInitBaseDep { @@ -255,23 +255,23 @@ impl super::SBPMessage for MsgInitBaseDep { } } -// State of an RTOS thread -// -// The thread usage message from the device reports real-time -// operating system (RTOS) thread usage statistics for the named -// thread. The reported percentage values must be normalized. -// +/// State of an RTOS thread +/// +/// The thread usage message from the device reports real-time +/// operating system (RTOS) thread usage statistics for the named +/// thread. The reported percentage values must be normalized. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgThreadState { pub sender_id: Option, + /// Thread name (NULL terminated) pub name: String, - // ^ Thread name (NULL terminated) + /// Percentage cpu use for this thread. Values range from 0 - 1000 and needs + /// to be renormalized to 100 pub cpu: u16, - // ^ Percentage cpu use for this thread. Values range from 0 - 1000 and needs - // to be renormalized to 100 + /// Free stack space for this thread pub stack_free: u32, - // ^ Free stack space for this thread } impl MsgThreadState { @@ -296,27 +296,27 @@ impl super::SBPMessage for MsgThreadState { } } -// State of the UART channel -// -// Throughput, utilization, and error counts on the RX/TX buffers -// of this UART channel. The reported percentage values must -// be normalized. -// +/// State of the UART channel +/// +/// Throughput, utilization, and error counts on the RX/TX buffers +/// of this UART channel. The reported percentage values must +/// be normalized. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct UARTChannel { + /// UART transmit throughput pub tx_throughput: f32, - // ^ UART transmit throughput + /// UART receive throughput pub rx_throughput: f32, - // ^ UART receive throughput + /// UART CRC error count pub crc_error_count: u16, - // ^ UART CRC error count + /// UART IO error count pub io_error_count: u16, - // ^ UART IO error count + /// UART transmit buffer percentage utilization (ranges from 0 to 255) pub tx_buffer_level: u8, - // ^ UART transmit buffer percentage utilization (ranges from 0 to 255) + /// UART receive buffer percentage utilization (ranges from 0 to 255) pub rx_buffer_level: u8, - // ^ UART receive buffer percentage utilization (ranges from 0 to 255) } impl UARTChannel { @@ -350,26 +350,26 @@ impl UARTChannel { } } -// base station observation message receipt period -// -// Statistics on the period of observations received from the base -// station. As complete observation sets are received, their time -// of reception is compared with the prior set''s time of reception. -// This measurement provides a proxy for link quality as incomplete -// or missing sets will increase the period. Long periods -// can cause momentary RTK solution outages. -// +/// base station observation message receipt period +/// +/// Statistics on the period of observations received from the base +/// station. As complete observation sets are received, their time +/// of reception is compared with the prior set''s time of reception. +/// This measurement provides a proxy for link quality as incomplete +/// or missing sets will increase the period. Long periods +/// can cause momentary RTK solution outages. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct Period { + /// Average period pub avg: i32, - // ^ Average period + /// Minimum period pub pmin: i32, - // ^ Minimum period + /// Maximum period pub pmax: i32, - // ^ Maximum period + /// Smoothed estimate of the current period pub current: i32, - // ^ Smoothed estimate of the current period } impl Period { @@ -401,25 +401,25 @@ impl Period { } } -// Receiver-to-base station latency -// -// Statistics on the latency of observations received from the base -// station. As observation packets are received their GPS time is -// compared to the current GPS time calculated locally by the -// receiver to give a precise measurement of the end-to-end -// communication latency in the system. -// +/// Receiver-to-base station latency +/// +/// Statistics on the latency of observations received from the base +/// station. As observation packets are received their GPS time is +/// compared to the current GPS time calculated locally by the +/// receiver to give a precise measurement of the end-to-end +/// communication latency in the system. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct Latency { + /// Average latency pub avg: i32, - // ^ Average latency + /// Minimum latency pub lmin: i32, - // ^ Minimum latency + /// Maximum latency pub lmax: i32, - // ^ Maximum latency + /// Smoothed estimate of the current latency pub current: i32, - // ^ Smoothed estimate of the current latency } impl Latency { @@ -451,32 +451,32 @@ impl Latency { } } -// State of the UART channels -// -// The UART message reports data latency and throughput of the UART -// channels providing SBP I/O. On the default Piksi configuration, -// UARTs A and B are used for telemetry radios, but can also be -// host access ports for embedded hosts, or other interfaces in -// future. The reported percentage values must be normalized. -// Observations latency and period can be used to assess the -// health of the differential corrections link. Latency provides -// the timeliness of received base observations while the -// period indicates their likelihood of transmission. -// +/// State of the UART channels +/// +/// The UART message reports data latency and throughput of the UART +/// channels providing SBP I/O. On the default Piksi configuration, +/// UARTs A and B are used for telemetry radios, but can also be +/// host access ports for embedded hosts, or other interfaces in +/// future. The reported percentage values must be normalized. +/// Observations latency and period can be used to assess the +/// health of the differential corrections link. Latency provides +/// the timeliness of received base observations while the +/// period indicates their likelihood of transmission. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgUartState { pub sender_id: Option, + /// State of UART A pub uart_a: UARTChannel, - // ^ State of UART A + /// State of UART B pub uart_b: UARTChannel, - // ^ State of UART B + /// State of UART FTDI (USB logger) pub uart_ftdi: UARTChannel, - // ^ State of UART FTDI (USB logger) + /// UART communication latency pub latency: Latency, - // ^ UART communication latency + /// Observation receipt period pub obs_period: Period, - // ^ Observation receipt period } impl MsgUartState { @@ -503,22 +503,22 @@ impl super::SBPMessage for MsgUartState { } } -// Deprecated -// -// Deprecated -// +/// Deprecated +/// +/// Deprecated +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgUartStateDepa { pub sender_id: Option, + /// State of UART A pub uart_a: UARTChannel, - // ^ State of UART A + /// State of UART B pub uart_b: UARTChannel, - // ^ State of UART B + /// State of UART FTDI (USB logger) pub uart_ftdi: UARTChannel, - // ^ State of UART FTDI (USB logger) + /// UART communication latency pub latency: Latency, - // ^ UART communication latency } impl MsgUartStateDepa { @@ -544,19 +544,19 @@ impl super::SBPMessage for MsgUartStateDepa { } } -// State of the Integer Ambiguity Resolution (IAR) process -// -// This message reports the state of the Integer Ambiguity -// Resolution (IAR) process, which resolves unknown integer -// ambiguities from double-differenced carrier-phase measurements -// from satellite observations. -// +/// State of the Integer Ambiguity Resolution (IAR) process +/// +/// This message reports the state of the Integer Ambiguity +/// Resolution (IAR) process, which resolves unknown integer +/// ambiguities from double-differenced carrier-phase measurements +/// from satellite observations. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgIarState { pub sender_id: Option, + /// Number of integer ambiguity hypotheses remaining pub num_hyps: u32, - // ^ Number of integer ambiguity hypotheses remaining } impl MsgIarState { @@ -579,19 +579,19 @@ impl super::SBPMessage for MsgIarState { } } -// Mask a satellite from use in Piksi subsystems -// -// This message allows setting a mask to prevent a particular satellite -// from being used in various Piksi subsystems. -// +/// Mask a satellite from use in Piksi subsystems +/// +/// This message allows setting a mask to prevent a particular satellite +/// from being used in various Piksi subsystems. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgMaskSatellite { pub sender_id: Option, + /// Mask of systems that should ignore this satellite. pub mask: u8, - // ^ Mask of systems that should ignore this satellite. + /// GNSS signal for which the mask is applied pub sid: GnssSignal, - // ^ GNSS signal for which the mask is applied } impl MsgMaskSatellite { @@ -615,18 +615,18 @@ impl super::SBPMessage for MsgMaskSatellite { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgMaskSatelliteDep { pub sender_id: Option, + /// Mask of systems that should ignore this satellite. pub mask: u8, - // ^ Mask of systems that should ignore this satellite. + /// GNSS signal for which the mask is applied pub sid: GnssSignalDep, - // ^ GNSS signal for which the mask is applied } impl MsgMaskSatelliteDep { @@ -650,26 +650,26 @@ impl super::SBPMessage for MsgMaskSatelliteDep { } } -// Device temperature and voltage levels -// -// This message contains temperature and voltage level measurements from the -// processor's monitoring system and the RF frontend die temperature if -// available. -// +/// Device temperature and voltage levels +/// +/// This message contains temperature and voltage level measurements from the +/// processor's monitoring system and the RF frontend die temperature if +/// available. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgDeviceMonitor { pub sender_id: Option, + /// Device V_in pub dev_vin: i16, - // ^ Device V_in + /// Processor V_int pub cpu_vint: i16, - // ^ Processor V_int + /// Processor V_aux pub cpu_vaux: i16, - // ^ Processor V_aux + /// Processor temperature pub cpu_temperature: i16, - // ^ Processor temperature + /// Frontend temperature (if available) pub fe_temperature: i16, - // ^ Frontend temperature (if available) } impl MsgDeviceMonitor { @@ -696,20 +696,20 @@ impl super::SBPMessage for MsgDeviceMonitor { } } -// Execute a command (host => device) -// -// Request the recipient to execute an command. -// Output will be sent in MSG_LOG messages, and the exit -// code will be returned with MSG_COMMAND_RESP. -// +/// Execute a command (host => device) +/// +/// Request the recipient to execute an command. +/// Output will be sent in MSG_LOG messages, and the exit +/// code will be returned with MSG_COMMAND_RESP. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgCommandReq { pub sender_id: Option, + /// Sequence number pub sequence: u32, - // ^ Sequence number + /// Command line to execute pub command: String, - // ^ Command line to execute } impl MsgCommandReq { @@ -733,19 +733,19 @@ impl super::SBPMessage for MsgCommandReq { } } -// Exit code from executed command (device => host) -// -// The response to MSG_COMMAND_REQ with the return code of -// the command. A return code of zero indicates success. -// +/// Exit code from executed command (device => host) +/// +/// The response to MSG_COMMAND_REQ with the return code of +/// the command. A return code of zero indicates success. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgCommandResp { pub sender_id: Option, + /// Sequence number pub sequence: u32, - // ^ Sequence number + /// Exit code pub code: i32, - // ^ Exit code } impl MsgCommandResp { @@ -769,21 +769,21 @@ impl super::SBPMessage for MsgCommandResp { } } -// Command output -// -// Returns the standard output and standard error of the -// command requested by MSG_COMMAND_REQ. -// The sequence number can be used to filter for filtering -// the correct command. -// +/// Command output +/// +/// Returns the standard output and standard error of the +/// command requested by MSG_COMMAND_REQ. +/// The sequence number can be used to filter for filtering +/// the correct command. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgCommandOutput { pub sender_id: Option, + /// Sequence number pub sequence: u32, - // ^ Sequence number + /// Line of standard output or standard error pub line: String, - // ^ Line of standard output or standard error } impl MsgCommandOutput { @@ -807,11 +807,11 @@ impl super::SBPMessage for MsgCommandOutput { } } -// Request state of Piksi network interfaces -// -// Request state of Piksi network interfaces. -// Output will be sent in MSG_NETWORK_STATE_RESP messages -// +/// Request state of Piksi network interfaces +/// +/// Request state of Piksi network interfaces. +/// Output will be sent in MSG_NETWORK_STATE_RESP messages +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgNetworkStateReq { @@ -835,32 +835,32 @@ impl super::SBPMessage for MsgNetworkStateReq { } } -// State of network interface -// -// The state of a network interface on the Piksi. -// Data is made to reflect output of ifaddrs struct returned by getifaddrs -// in c. -// +/// State of network interface +/// +/// The state of a network interface on the Piksi. +/// Data is made to reflect output of ifaddrs struct returned by getifaddrs +/// in c. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgNetworkStateResp { pub sender_id: Option, + /// IPv4 address (all zero when unavailable) pub ipv4_address: Vec, - // ^ IPv4 address (all zero when unavailable) + /// IPv4 netmask CIDR notation pub ipv4_mask_size: u8, - // ^ IPv4 netmask CIDR notation + /// IPv6 address (all zero when unavailable) pub ipv6_address: Vec, - // ^ IPv6 address (all zero when unavailable) + /// IPv6 netmask CIDR notation pub ipv6_mask_size: u8, - // ^ IPv6 netmask CIDR notation + /// Number of Rx bytes pub rx_bytes: u32, - // ^ Number of Rx bytes + /// Number of Tx bytes pub tx_bytes: u32, - // ^ Number of Tx bytes + /// Interface Name pub interface_name: String, - // ^ Interface Name + /// Interface flags from SIOCGIFFLAGS pub flags: u32, - // ^ Interface flags from SIOCGIFFLAGS } impl MsgNetworkStateResp { @@ -890,28 +890,28 @@ impl super::SBPMessage for MsgNetworkStateResp { } } -// Bandwidth usage measurement for a single interface. -// -// The bandwidth usage for each interface can be reported -// within this struct and utilize multiple fields to fully -// specify the type of traffic that is being tracked. As -// either the interval of collection or the collection time -// may vary, both a timestamp and period field is provided, -// though may not necessarily be populated with a value. -// +/// Bandwidth usage measurement for a single interface. +/// +/// The bandwidth usage for each interface can be reported +/// within this struct and utilize multiple fields to fully +/// specify the type of traffic that is being tracked. As +/// either the interval of collection or the collection time +/// may vary, both a timestamp and period field is provided, +/// though may not necessarily be populated with a value. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct NetworkUsage { + /// Duration over which the measurement was collected pub duration: u64, - // ^ Duration over which the measurement was collected + /// Number of bytes handled in total within period pub total_bytes: u64, - // ^ Number of bytes handled in total within period + /// Number of bytes transmitted within period pub rx_bytes: u32, - // ^ Number of bytes transmitted within period + /// Number of bytes received within period pub tx_bytes: u32, - // ^ Number of bytes received within period + /// Interface Name pub interface_name: String, - // ^ Interface Name } impl NetworkUsage { @@ -944,16 +944,16 @@ impl NetworkUsage { } } -// Bandwidth usage reporting message -// -// The bandwidth usage, a list of usage by interface. -// +/// Bandwidth usage reporting message +/// +/// The bandwidth usage, a list of usage by interface. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgNetworkBandwidthUsage { pub sender_id: Option, + /// Usage measurement array pub interfaces: Vec, - // ^ Usage measurement array } impl MsgNetworkBandwidthUsage { @@ -976,22 +976,22 @@ impl super::SBPMessage for MsgNetworkBandwidthUsage { } } -// Cell modem information update message -// -// If a cell modem is present on a piksi device, this message -// will be send periodically to update the host on the status -// of the modem and its various parameters. -// +/// Cell modem information update message +/// +/// If a cell modem is present on a piksi device, this message +/// will be send periodically to update the host on the status +/// of the modem and its various parameters. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgCellModemStatus { pub sender_id: Option, + /// Received cell signal strength in dBm, zero translates to unknown pub signal_strength: i8, - // ^ Received cell signal strength in dBm, zero translates to unknown + /// BER as reported by the modem, zero translates to unknown pub signal_error_rate: f32, - // ^ BER as reported by the modem, zero translates to unknown + /// Unspecified data TBD for this schema pub reserved: Vec, - // ^ Unspecified data TBD for this schema } impl MsgCellModemStatus { @@ -1016,28 +1016,28 @@ impl super::SBPMessage for MsgCellModemStatus { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSpecanDep { pub sender_id: Option, + /// Channel ID pub channel_tag: u16, - // ^ Channel ID + /// Receiver time of this observation pub t: GPSTimeDep, - // ^ Receiver time of this observation + /// Reference frequency of this packet pub freq_ref: f32, - // ^ Reference frequency of this packet + /// Frequency step of points in this packet pub freq_step: f32, - // ^ Frequency step of points in this packet + /// Reference amplitude of this packet pub amplitude_ref: f32, - // ^ Reference amplitude of this packet + /// Amplitude unit value of points in this packet pub amplitude_unit: f32, - // ^ Amplitude unit value of points in this packet + /// Amplitude values (in the above units) of points in this packet pub amplitude_value: Vec, - // ^ Amplitude values (in the above units) of points in this packet } impl MsgSpecanDep { @@ -1066,28 +1066,28 @@ impl super::SBPMessage for MsgSpecanDep { } } -// Spectrum analyzer -// -// Spectrum analyzer packet. -// +/// Spectrum analyzer +/// +/// Spectrum analyzer packet. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSpecan { pub sender_id: Option, + /// Channel ID pub channel_tag: u16, - // ^ Channel ID + /// Receiver time of this observation pub t: GPSTime, - // ^ Receiver time of this observation + /// Reference frequency of this packet pub freq_ref: f32, - // ^ Reference frequency of this packet + /// Frequency step of points in this packet pub freq_step: f32, - // ^ Frequency step of points in this packet + /// Reference amplitude of this packet pub amplitude_ref: f32, - // ^ Reference amplitude of this packet + /// Amplitude unit value of points in this packet pub amplitude_unit: f32, - // ^ Amplitude unit value of points in this packet + /// Amplitude values (in the above units) of points in this packet pub amplitude_value: Vec, - // ^ Amplitude values (in the above units) of points in this packet } impl MsgSpecan { @@ -1116,23 +1116,23 @@ impl super::SBPMessage for MsgSpecan { } } -// RF AGC status -// -// This message describes the gain of each channel in the receiver frontend. Each -// gain is encoded as a non-dimensional percentage relative to the maximum range -// possible for the gain stage of the frontend. By convention, each gain array -// has 8 entries and the index of the array corresponding to the index of the rf channel -// in the frontend. A gain of 127 percent encodes that rf channel is not present in the hardware. -// A negative value implies an error for the particular gain stage as reported by the frontend. -// +/// RF AGC status +/// +/// This message describes the gain of each channel in the receiver frontend. Each +/// gain is encoded as a non-dimensional percentage relative to the maximum range +/// possible for the gain stage of the frontend. By convention, each gain array +/// has 8 entries and the index of the array corresponding to the index of the rf channel +/// in the frontend. A gain of 127 percent encodes that rf channel is not present in the hardware. +/// A negative value implies an error for the particular gain stage as reported by the frontend. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgFrontEndGain { pub sender_id: Option, + /// RF gain for each frontend channel pub rf_gain: Vec, - // ^ RF gain for each frontend channel + /// Intermediate frequency gain for each frontend channel pub if_gain: Vec, - // ^ Intermediate frequency gain for each frontend channel } impl MsgFrontEndGain { diff --git a/rust/sbp/src/messages/sbas.rs b/rust/sbp/src/messages/sbas.rs index f5689e9631..7ede007f40 100644 --- a/rust/sbp/src/messages/sbas.rs +++ b/rust/sbp/src/messages/sbas.rs @@ -12,29 +12,29 @@ // Automatically generated from yaml/swiftnav/sbp/sbas.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// SBAS data +/// SBAS data extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; use super::gnss::*; -// Raw SBAS data -// -// This message is sent once per second per SBAS satellite. ME checks the -// parity of the data block and sends only blocks that pass the check. -// +/// Raw SBAS data +/// +/// This message is sent once per second per SBAS satellite. ME checks the +/// parity of the data block and sends only blocks that pass the check. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSbasRaw { pub sender_id: Option, + /// GNSS signal identifier. pub sid: GnssSignal, - // ^ GNSS signal identifier. + /// GPS time-of-week at the start of the data block. pub tow: u32, - // ^ GPS time-of-week at the start of the data block. + /// SBAS message type (0-63) pub message_type: u8, - // ^ SBAS message type (0-63) + /// Raw SBAS data field of 212 bits (last byte padded with zeros). pub data: Vec, - // ^ Raw SBAS data field of 212 bits (last byte padded with zeros). } impl MsgSbasRaw { diff --git a/rust/sbp/src/messages/settings.rs b/rust/sbp/src/messages/settings.rs index 4f618631ef..4b1f6668b4 100644 --- a/rust/sbp/src/messages/settings.rs +++ b/rust/sbp/src/messages/settings.rs @@ -12,41 +12,41 @@ // Automatically generated from yaml/swiftnav/sbp/settings.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// -// Messages for reading, writing, and discovering device settings. Settings -// with a "string" field have multiple values in this field delimited with a -// null character (the c style null terminator). For instance, when querying -// the 'firmware_version' setting in the 'system_info' section, the following -// array of characters needs to be sent for the string field in -// MSG_SETTINGS_READ: "system_info\0firmware_version\0", where the delimiting -// null characters are specified with the escape sequence '\0' and all -// quotation marks should be omitted. -// -// -// In the message descriptions below, the generic strings SECTION_SETTING and -// SETTING are used to refer to the two strings that comprise the identifier -// of an individual setting.In firmware_version example above, SECTION_SETTING -// is the 'system_info', and the SETTING portion is 'firmware_version'. -// -// See the "Software Settings Manual" on support.swiftnav.com for detailed -// documentation about all settings and sections available for each Swift -// firmware version. Settings manuals are available for each firmware version -// at the following link: [Piksi Multi Specifications](https://support.swiftnav.com/customer/en/portal/articles/2628580-piksi-multi-specifications#settings). -// The latest settings document is also available at the following link: -// [Latest settings document](http://swiftnav.com/latest/piksi-multi-settings) . -// See lastly [settings.py](https://github.com/swift-nav/piksi_tools/blob/master/piksi_tools/settings.py) , -// the open source python command line utility for reading, writing, and -// saving settings in the piksi_tools repository on github as a helpful -// reference and example. +/// +/// Messages for reading, writing, and discovering device settings. Settings +/// with a "string" field have multiple values in this field delimited with a +/// null character (the c style null terminator). For instance, when querying +/// the 'firmware_version' setting in the 'system_info' section, the following +/// array of characters needs to be sent for the string field in +/// MSG_SETTINGS_READ: "system_info\0firmware_version\0", where the delimiting +/// null characters are specified with the escape sequence '\0' and all +/// quotation marks should be omitted. +/// +/// +/// In the message descriptions below, the generic strings SECTION_SETTING and +/// SETTING are used to refer to the two strings that comprise the identifier +/// of an individual setting.In firmware_version example above, SECTION_SETTING +/// is the 'system_info', and the SETTING portion is 'firmware_version'. +/// +/// See the "Software Settings Manual" on support.swiftnav.com for detailed +/// documentation about all settings and sections available for each Swift +/// firmware version. Settings manuals are available for each firmware version +/// at the following link: [Piksi Multi Specifications](https://support.swiftnav.com/customer/en/portal/articles/2628580-piksi-multi-specifications#settings). +/// The latest settings document is also available at the following link: +/// [Latest settings document](http://swiftnav.com/latest/piksi-multi-settings) . +/// See lastly [settings.py](https://github.com/swift-nav/piksi_tools/blob/master/piksi_tools/settings.py) , +/// the open source python command line utility for reading, writing, and +/// saving settings in the piksi_tools repository on github as a helpful +/// reference and example. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; -// Save settings to flash (host => device) -// -// The save settings message persists the device's current settings -// configuration to its onboard flash memory file system. -// +/// Save settings to flash (host => device) +/// +/// The save settings message persists the device's current settings +/// configuration to its onboard flash memory file system. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsSave { @@ -70,23 +70,23 @@ impl super::SBPMessage for MsgSettingsSave { } } -// Write device configuration settings (host => device) -// -// The setting message writes the device configuration for a particular -// setting via A NULL-terminated and NULL-delimited string with contents -// "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes -// the NULL character and where quotation marks are omitted. A device will -// only process to this message when it is received from sender ID 0x42. -// An example string that could be sent to a device is -// "solution\0soln_freq\010\0". -// +/// Write device configuration settings (host => device) +/// +/// The setting message writes the device configuration for a particular +/// setting via A NULL-terminated and NULL-delimited string with contents +/// "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes +/// the NULL character and where quotation marks are omitted. A device will +/// only process to this message when it is received from sender ID 0x42. +/// An example string that could be sent to a device is +/// "solution\0soln_freq\010\0". +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsWrite { pub sender_id: Option, + /// A NULL-terminated and NULL-delimited string with contents + /// "SECTION_SETTING\0SETTING\0VALUE\0" pub setting: String, - // ^ A NULL-terminated and NULL-delimited string with contents - // "SECTION_SETTING\0SETTING\0VALUE\0" } impl MsgSettingsWrite { @@ -109,25 +109,25 @@ impl super::SBPMessage for MsgSettingsWrite { } } -// Acknowledgement with status of MSG_SETTINGS_WRITE -// -// Return the status of a write request with the new value of the -// setting. If the requested value is rejected, the current value -// will be returned. The string field is a NULL-terminated and NULL-delimited -// string with contents "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' -// escape sequence denotes the NULL character and where quotation marks -// are omitted. An example string that could be sent from device is -// "solution\0soln_freq\010\0". -// +/// Acknowledgement with status of MSG_SETTINGS_WRITE +/// +/// Return the status of a write request with the new value of the +/// setting. If the requested value is rejected, the current value +/// will be returned. The string field is a NULL-terminated and NULL-delimited +/// string with contents "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' +/// escape sequence denotes the NULL character and where quotation marks +/// are omitted. An example string that could be sent from device is +/// "solution\0soln_freq\010\0". +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsWriteResp { pub sender_id: Option, + /// Write status pub status: u8, - // ^ Write status + /// A NULL-terminated and delimited string with contents + /// "SECTION_SETTING\0SETTING\0VALUE\0" pub setting: String, - // ^ A NULL-terminated and delimited string with contents - // "SECTION_SETTING\0SETTING\0VALUE\0" } impl MsgSettingsWriteResp { @@ -151,24 +151,24 @@ impl super::SBPMessage for MsgSettingsWriteResp { } } -// Read device configuration settings (host => device) -// -// The setting message that reads the device configuration. The string -// field is a NULL-terminated and NULL-delimited string with contents -// "SECTION_SETTING\0SETTING\0" where the '\0' escape sequence denotes the -// NULL character and where quotation marks are omitted. An example -// string that could be sent to a device is "solution\0soln_freq\0". A -// device will only respond to this message when it is received from -// sender ID 0x42. A device should respond with a MSG_SETTINGS_READ_RESP -// message (msg_id 0x00A5). -// +/// Read device configuration settings (host => device) +/// +/// The setting message that reads the device configuration. The string +/// field is a NULL-terminated and NULL-delimited string with contents +/// "SECTION_SETTING\0SETTING\0" where the '\0' escape sequence denotes the +/// NULL character and where quotation marks are omitted. An example +/// string that could be sent to a device is "solution\0soln_freq\0". A +/// device will only respond to this message when it is received from +/// sender ID 0x42. A device should respond with a MSG_SETTINGS_READ_RESP +/// message (msg_id 0x00A5). +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsReadReq { pub sender_id: Option, + /// A NULL-terminated and NULL-delimited string with contents + /// "SECTION_SETTING\0SETTING\0" pub setting: String, - // ^ A NULL-terminated and NULL-delimited string with contents - // "SECTION_SETTING\0SETTING\0" } impl MsgSettingsReadReq { @@ -191,23 +191,23 @@ impl super::SBPMessage for MsgSettingsReadReq { } } -// Read device configuration settings (host <= device) -// -// The setting message wich which the device responds after a -// MSG_SETTING_READ_REQ is sent to device. The string field is a -// NULL-terminated and NULL-delimited string with contents -// "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence -// denotes the NULL character and where quotation marks are omitted. An -// example string that could be sent from device is -// "solution\0soln_freq\010\0". -// +/// Read device configuration settings (host <= device) +/// +/// The setting message wich which the device responds after a +/// MSG_SETTING_READ_REQ is sent to device. The string field is a +/// NULL-terminated and NULL-delimited string with contents +/// "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence +/// denotes the NULL character and where quotation marks are omitted. An +/// example string that could be sent from device is +/// "solution\0soln_freq\010\0". +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsReadResp { pub sender_id: Option, + /// A NULL-terminated and NULL-delimited string with contents + /// "SECTION_SETTING\0SETTING\0VALUE\0" pub setting: String, - // ^ A NULL-terminated and NULL-delimited string with contents - // "SECTION_SETTING\0SETTING\0VALUE\0" } impl MsgSettingsReadResp { @@ -230,19 +230,19 @@ impl super::SBPMessage for MsgSettingsReadResp { } } -// Read setting by direct index (host => device) -// -// The settings message for iterating through the settings -// values. A device will respond to this message with a -// "MSG_SETTINGS_READ_BY_INDEX_RESP". -// +/// Read setting by direct index (host => device) +/// +/// The settings message for iterating through the settings +/// values. A device will respond to this message with a +/// "MSG_SETTINGS_READ_BY_INDEX_RESP". +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsReadByIndexReq { pub sender_id: Option, + /// An index into the device settings, with values ranging from 0 to + /// length(settings) pub index: u16, - // ^ An index into the device settings, with values ranging from 0 to - // length(settings) } impl MsgSettingsReadByIndexReq { @@ -265,29 +265,29 @@ impl super::SBPMessage for MsgSettingsReadByIndexReq { } } -// Read setting by direct index (host <= device) -// -// The settings message that reports the value of a setting at an index. -// -// In the string field, it reports NULL-terminated and delimited string -// with contents "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0". where -// the '\0' escape sequence denotes the NULL character and where quotation -// marks are omitted. The FORMAT_TYPE field is optional and denotes -// possible string values of the setting as a hint to the user. If -// included, the format type portion of the string has the format -// "enum:value1,value2,value3". An example string that could be sent from -// the device is "simulator\0enabled\0True\0enum:True,False\0" -// +/// Read setting by direct index (host <= device) +/// +/// The settings message that reports the value of a setting at an index. +/// +/// In the string field, it reports NULL-terminated and delimited string +/// with contents "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0". where +/// the '\0' escape sequence denotes the NULL character and where quotation +/// marks are omitted. The FORMAT_TYPE field is optional and denotes +/// possible string values of the setting as a hint to the user. If +/// included, the format type portion of the string has the format +/// "enum:value1,value2,value3". An example string that could be sent from +/// the device is "simulator\0enabled\0True\0enum:True,False\0" +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsReadByIndexResp { pub sender_id: Option, + /// An index into the device settings, with values ranging from 0 to + /// length(settings) pub index: u16, - // ^ An index into the device settings, with values ranging from 0 to - // length(settings) + /// A NULL-terminated and delimited string with contents + /// "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0" pub setting: String, - // ^ A NULL-terminated and delimited string with contents - // "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0" } impl MsgSettingsReadByIndexResp { @@ -311,10 +311,10 @@ impl super::SBPMessage for MsgSettingsReadByIndexResp { } } -// Finished reading settings (host <= device) -// -// The settings message for indicating end of the settings values. -// +/// Finished reading settings (host <= device) +/// +/// The settings message for indicating end of the settings values. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsReadByIndexDone { @@ -338,19 +338,19 @@ impl super::SBPMessage for MsgSettingsReadByIndexDone { } } -// Register setting and default value (device => host) -// -// This message registers the presence and default value of a setting -// with a settings daemon. The host should reply with MSG_SETTINGS_WRITE -// for this setting to set the initial value. -// +/// Register setting and default value (device => host) +/// +/// This message registers the presence and default value of a setting +/// with a settings daemon. The host should reply with MSG_SETTINGS_WRITE +/// for this setting to set the initial value. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsRegister { pub sender_id: Option, + /// A NULL-terminated and delimited string with contents + /// "SECTION_SETTING\0SETTING\0VALUE". pub setting: String, - // ^ A NULL-terminated and delimited string with contents - // "SECTION_SETTING\0SETTING\0VALUE". } impl MsgSettingsRegister { @@ -373,23 +373,23 @@ impl super::SBPMessage for MsgSettingsRegister { } } -// Register setting and default value (device <= host) -// -// This message responds to setting registration with the effective value. -// The effective value shall differ from the given default value if setting -// was already registered or is available in the permanent setting storage -// and had a different value. -// +/// Register setting and default value (device <= host) +/// +/// This message responds to setting registration with the effective value. +/// The effective value shall differ from the given default value if setting +/// was already registered or is available in the permanent setting storage +/// and had a different value. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSettingsRegisterResp { pub sender_id: Option, + /// Register status pub status: u8, - // ^ Register status + /// A NULL-terminated and delimited string with contents + /// "SECTION_SETTING\0SETTING\0VALUE". The meaning of value is defined + /// according to the status field. pub setting: String, - // ^ A NULL-terminated and delimited string with contents - // "SECTION_SETTING\0SETTING\0VALUE". The meaning of value is defined - // according to the status field. } impl MsgSettingsRegisterResp { diff --git a/rust/sbp/src/messages/ssr.rs b/rust/sbp/src/messages/ssr.rs index 79203defa1..29bea73a1b 100644 --- a/rust/sbp/src/messages/ssr.rs +++ b/rust/sbp/src/messages/ssr.rs @@ -12,24 +12,24 @@ // Automatically generated from yaml/swiftnav/sbp/ssr.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Precise State Space Representation (SSR) corrections format +/// Precise State Space Representation (SSR) corrections format extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; use super::gnss::*; -// SSR code biases corrections for a particular satellite. -// -// Code biases are to be added to pseudorange. -// The corrections are conform with typical RTCMv3 MT1059 and 1065. -// +/// SSR code biases corrections for a particular satellite. +/// +/// Code biases are to be added to pseudorange. +/// The corrections conform with typical RTCMv3 MT1059 and 1065. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct CodeBiasesContent { + /// Signal constellation, band and code pub code: u8, - // ^ Signal constellation, band and code + /// Code bias value pub value: i16, - // ^ Code bias value } impl CodeBiasesContent { @@ -59,25 +59,25 @@ impl CodeBiasesContent { } } -// SSR phase biases corrections for a particular satellite. -// -// Phase biases are to be added to carrier phase measurements. -// The corrections are conform with typical RTCMv3 MT1059 and 1065. -// +/// SSR phase biases corrections for a particular satellite. +/// +/// Phase biases are to be added to carrier phase measurements. +/// The corrections conform with typical RTCMv3 MT1059 and 1065. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct PhaseBiasesContent { + /// Signal constellation, band and code pub code: u8, - // ^ Signal constellation, band and code + /// Indicator for integer property pub integer_indicator: u8, - // ^ Indicator for integer property + /// Indicator for two groups of Wide-Lane(s) integer property pub widelane_integer_indicator: u8, - // ^ Indicator for two groups of Wide-Lane(s) integer property + /// Signal phase discontinuity counter. Increased for every discontinuity in + /// phase. pub discontinuity_counter: u8, - // ^ Signal phase discontinuity counter. Increased for every discontinuity in - // phase. + /// Phase bias for specified signal pub bias: i32, - // ^ Phase bias for specified signal } impl PhaseBiasesContent { @@ -110,34 +110,36 @@ impl PhaseBiasesContent { } } -// Header for MSG_SSR_STEC_CORRECTION message -// -// A full set of STEC information will likely span multiple SBP -// messages, since SBP message a limited to 255 bytes. The header -// is used to tie multiple SBP messages into a sequence. -// +/// Header for MSG_SSR_STEC_CORRECTION message +/// +/// A full set of STEC information will likely span multiple SBP +/// messages, since SBP message a limited to 255 bytes. The header +/// is used to tie multiple SBP messages into a sequence. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct STECHeader { - pub time: GPSTime, - // ^ GNSS time of the STEC data + /// GNSS reference time of the correction + pub time: GPSTimeSec, + /// Number of messages in the dataset pub num_msgs: u8, - // ^ Number of messages in the dataset + /// Position of this message in the dataset pub seq_num: u8, - // ^ Position of this message in the dataset - pub ssr_update_interval: u16, - // ^ update interval in seconds + /// Update interval between consecutive corrections. Encoded following RTCM + /// DF391 specification. + pub update_interval: u8, + /// IOD of the SSR correction. A change of Issue Of Data SSR is used to + /// indicate a change in the SSR generating configuration. pub iod_ssr: u8, - // ^ range 0 - 15 } impl STECHeader { pub fn parse(_buf: &mut &[u8]) -> Result { Ok(STECHeader { - time: GPSTime::parse(_buf)?, + time: GPSTimeSec::parse(_buf)?, num_msgs: _buf.read_u8()?, seq_num: _buf.read_u8()?, - ssr_update_interval: _buf.read_u16::()?, + update_interval: _buf.read_u8()?, iod_ssr: _buf.read_u8()?, }) } @@ -161,38 +163,41 @@ impl STECHeader { } } -// Header for MSG_SSR_GRIDDED_CORRECTION -// -// The 3GPP message contains nested variable length arrays -// which are not suppported in SBP, so each grid point will -// be identified by the index. -// +/// Header for MSG_SSR_GRIDDED_CORRECTION +/// +/// The 3GPP message contains nested variable length arrays +/// which are not suppported in SBP, so each grid point will +/// be identified by the index. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct GriddedCorrectionHeader { - pub time: GPSTime, - // ^ GNSS time of the STEC data + /// GNSS reference time of the correction + pub time: GPSTimeSec, + /// Number of messages in the dataset pub num_msgs: u16, - // ^ Number of messages in the dataset + /// Position of this message in the dataset pub seq_num: u16, - // ^ Position of this message in the dataset - pub ssr_update_interval: u16, - // ^ update interval in seconds + /// Update interval between consecutive corrections. Encoded following RTCM + /// DF391 specification. + pub update_interval: u8, + /// IOD of the SSR correction. A change of Issue Of Data SSR is used to + /// indicate a change in the SSR generating configuration. pub iod_ssr: u8, - // ^ range 0 - 15 - pub tropo_quality: u8, - // ^ troposphere quality indicator + /// Quality of the troposphere data. Encoded following RTCM DF389 + /// specifcation but as TECU instead of m. + pub tropo_quality_indicator: u8, } impl GriddedCorrectionHeader { pub fn parse(_buf: &mut &[u8]) -> Result { Ok(GriddedCorrectionHeader { - time: GPSTime::parse(_buf)?, + time: GPSTimeSec::parse(_buf)?, num_msgs: _buf.read_u16::()?, seq_num: _buf.read_u16::()?, - ssr_update_interval: _buf.read_u16::()?, + update_interval: _buf.read_u8()?, iod_ssr: _buf.read_u8()?, - tropo_quality: _buf.read_u8()?, + tropo_quality_indicator: _buf.read_u8()?, }) } pub fn parse_array( @@ -217,19 +222,20 @@ impl GriddedCorrectionHeader { } } -// None -// -// STEC for the given satellite. -// +/// None +/// +/// STEC polynomial for the given satellite. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct STECSatElement { + /// Unique space vehicle identifier pub sv_id: SvId, - // ^ Unique space vehicle identifier + /// Quality of the STEC data. Encoded following RTCM DF389 specifcation but + /// as TECU instead of m. pub stec_quality_indicator: u8, - // ^ quality of STEC data + /// Coefficents of the STEC polynomial in the order of C00, C01, C10, C11 pub stec_coeff: Vec, - // ^ coefficents of the STEC polynomial } impl STECSatElement { @@ -260,17 +266,17 @@ impl STECSatElement { } } -// troposphere delay correction -// -// Contains wet vertical and hydrostatic vertical delay -// +/// None +/// +/// Troposphere delays at the grid point. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct TroposphericDelayCorrection { + /// Hydrostatic vertical delay pub hydro: i16, - // ^ hydrostatic vertical delay + /// Wet vertical delay pub wet: i8, - // ^ wet vertical delay } impl TroposphericDelayCorrection { @@ -302,17 +308,17 @@ impl TroposphericDelayCorrection { } } -// None -// -// STEC residual -// +/// None +/// +/// STEC residual for the given satellite at the grid point. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct STECResidual { + /// space vehicle identifier pub sv_id: SvId, - // ^ space vehicle identifier + /// STEC residual pub residual: i16, - // ^ STEC residual } impl STECResidual { @@ -342,20 +348,20 @@ impl STECResidual { } } -// Grid datum for troposphere and STEC residuals -// -// Contains one tropo datum, plus STEC residuals for each space -// vehicle -// +/// Correction data for a single grid point. +/// +/// Contains one tropo delay, plus STEC residuals for each satellite at the +/// grid point. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct GridElement { + /// Index of the grid point pub index: u16, - // ^ index of the grid point + /// Wet and hydrostatic vertical delays pub tropo_delay_correction: TroposphericDelayCorrection, - // ^ Wet and Hydrostatic Vertical Delay - pub STEC_residuals: Vec, - // ^ STEC Residual for the given space vehicle + /// STEC residuals for each satellite + pub stec_residuals: Vec, } impl GridElement { @@ -363,7 +369,7 @@ impl GridElement { Ok(GridElement { index: _buf.read_u16::()?, tropo_delay_correction: TroposphericDelayCorrection::parse(_buf)?, - STEC_residuals: STECResidual::parse_array(_buf)?, + stec_residuals: STECResidual::parse_array(_buf)?, }) } pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { @@ -386,26 +392,26 @@ impl GridElement { } } -// Defines the grid for STEC and tropo grid messages -// -// Defines the grid for STEC and tropo grid messages. -// Also includes an RLE encoded validity list. -// +/// Defines the grid for MSG_SSR_GRIDDED_CORRECTION messages. +/// +/// Defines the grid for MSG_SSR_GRIDDED_CORRECTION messages. +/// Also includes an RLE encoded validity list. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct GridDefinitionHeader { + /// inverse of region size pub region_size_inverse: u8, - // ^ inverse of region size + /// area width; see spec for details pub area_width: u16, - // ^ area width; see spec for details + /// encoded latitude of the northwest corner of the grid pub lat_nw_corner_enc: u16, - // ^ encoded latitude of the northwest corner of the grid + /// encoded longitude of the northwest corner of the grid pub lon_nw_corner_enc: u16, - // ^ encoded longitude of the northwest corner of the grid + /// Number of messages in the dataset pub num_msgs: u8, - // ^ Number of messages in the dataset + /// Postion of this message in the dataset pub seq_num: u8, - // ^ Postion of this message in the dataset } impl GridDefinitionHeader { @@ -441,46 +447,47 @@ impl GridDefinitionHeader { } } -// Precise orbit and clock correction -// -// The precise orbit and clock correction message is -// to be applied as a delta correction to broadcast -// ephemeris and is typically an equivalent to the 1060 -// and 1066 RTCM message types -// +/// Precise orbit and clock correction +/// +/// The precise orbit and clock correction message is +/// to be applied as a delta correction to broadcast +/// ephemeris and is typically an equivalent to the 1060 +/// and 1066 RTCM message types +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSsrOrbitClock { pub sender_id: Option, + /// GNSS reference time of the correction pub time: GPSTimeSec, - // ^ GNSS reference time of the correction + /// GNSS signal identifier (16 bit) pub sid: GnssSignal, - // ^ GNSS signal identifier (16 bit) + /// Update interval between consecutive corrections. Encoded following RTCM + /// DF391 specification. pub update_interval: u8, - // ^ Update interval between consecutive corrections + /// IOD of the SSR correction. A change of Issue Of Data SSR is used to + /// indicate a change in the SSR generating configuration pub iod_ssr: u8, - // ^ IOD of the SSR correction. A change of Issue Of Data SSR is used to - // indicate a change in the SSR generating configuration + /// Issue of broadcast ephemeris data or IODCRC (Beidou) pub iod: u32, - // ^ Issue of broadcast ephemeris data or IODCRC (Beidou) + /// Orbit radial delta correction pub radial: i32, - // ^ Orbit radial delta correction + /// Orbit along delta correction pub along: i32, - // ^ Orbit along delta correction + /// Orbit along delta correction pub cross: i32, - // ^ Orbit along delta correction + /// Velocity of orbit radial delta correction pub dot_radial: i32, - // ^ Velocity of orbit radial delta correction + /// Velocity of orbit along delta correction pub dot_along: i32, - // ^ Velocity of orbit along delta correction + /// Velocity of orbit cross delta correction pub dot_cross: i32, - // ^ Velocity of orbit cross delta correction + /// C0 polynomial coefficient for correction of broadcast satellite clock pub c0: i32, - // ^ C0 polynomial coefficient for correction of broadcast satellite clock + /// C1 polynomial coefficient for correction of broadcast satellite clock pub c1: i32, - // ^ C1 polynomial coefficient for correction of broadcast satellite clock + /// C2 polynomial coefficient for correction of broadcast satellite clock pub c2: i32, - // ^ C2 polynomial coefficient for correction of broadcast satellite clock } impl MsgSsrOrbitClock { @@ -516,46 +523,47 @@ impl super::SBPMessage for MsgSsrOrbitClock { } } -// Precise orbit and clock correction -// -// The precise orbit and clock correction message is -// to be applied as a delta correction to broadcast -// ephemeris and is typically an equivalent to the 1060 -// and 1066 RTCM message types -// +/// Precise orbit and clock correction +/// +/// The precise orbit and clock correction message is +/// to be applied as a delta correction to broadcast +/// ephemeris and is typically an equivalent to the 1060 +/// and 1066 RTCM message types +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSsrOrbitClockDepA { pub sender_id: Option, + /// GNSS reference time of the correction pub time: GPSTimeSec, - // ^ GNSS reference time of the correction + /// GNSS signal identifier (16 bit) pub sid: GnssSignal, - // ^ GNSS signal identifier (16 bit) + /// Update interval between consecutive corrections. Encoded following RTCM + /// DF391 specification. pub update_interval: u8, - // ^ Update interval between consecutive corrections + /// IOD of the SSR correction. A change of Issue Of Data SSR is used to + /// indicate a change in the SSR generating configuration pub iod_ssr: u8, - // ^ IOD of the SSR correction. A change of Issue Of Data SSR is used to - // indicate a change in the SSR generating configuration + /// Issue of broadcast ephemeris data pub iod: u8, - // ^ Issue of broadcast ephemeris data + /// Orbit radial delta correction pub radial: i32, - // ^ Orbit radial delta correction + /// Orbit along delta correction pub along: i32, - // ^ Orbit along delta correction + /// Orbit along delta correction pub cross: i32, - // ^ Orbit along delta correction + /// Velocity of orbit radial delta correction pub dot_radial: i32, - // ^ Velocity of orbit radial delta correction + /// Velocity of orbit along delta correction pub dot_along: i32, - // ^ Velocity of orbit along delta correction + /// Velocity of orbit cross delta correction pub dot_cross: i32, - // ^ Velocity of orbit cross delta correction + /// C0 polynomial coefficient for correction of broadcast satellite clock pub c0: i32, - // ^ C0 polynomial coefficient for correction of broadcast satellite clock + /// C1 polynomial coefficient for correction of broadcast satellite clock pub c1: i32, - // ^ C1 polynomial coefficient for correction of broadcast satellite clock + /// C2 polynomial coefficient for correction of broadcast satellite clock pub c2: i32, - // ^ C2 polynomial coefficient for correction of broadcast satellite clock } impl MsgSsrOrbitClockDepA { @@ -591,28 +599,29 @@ impl super::SBPMessage for MsgSsrOrbitClockDepA { } } -// Precise code biases correction -// -// The precise code biases message is to be added -// to the pseudorange of the corresponding signal -// to get corrected pseudorange. It is typically -// an equivalent to the 1059 and 1065 RTCM message types -// +/// Precise code biases correction +/// +/// The precise code biases message is to be added +/// to the pseudorange of the corresponding signal +/// to get corrected pseudorange. It is typically +/// an equivalent to the 1059 and 1065 RTCM message types +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSsrCodeBiases { pub sender_id: Option, + /// GNSS reference time of the correction pub time: GPSTimeSec, - // ^ GNSS reference time of the correction + /// GNSS signal identifier (16 bit) pub sid: GnssSignal, - // ^ GNSS signal identifier (16 bit) + /// Update interval between consecutive corrections. Encoded following RTCM + /// DF391 specification. pub update_interval: u8, - // ^ Update interval between consecutive corrections + /// IOD of the SSR correction. A change of Issue Of Data SSR is used to + /// indicate a change in the SSR generating configuration pub iod_ssr: u8, - // ^ IOD of the SSR correction. A change of Issue Of Data SSR is used to - // indicate a change in the SSR generating configuration + /// Code biases for the different satellite signals pub biases: Vec, - // ^ Code biases for the different satellite signals } impl MsgSsrCodeBiases { @@ -639,38 +648,39 @@ impl super::SBPMessage for MsgSsrCodeBiases { } } -// Precise phase biases correction -// -// The precise phase biases message contains the biases -// to be added to the carrier phase of the corresponding -// signal to get corrected carrier phase measurement, as -// well as the satellite yaw angle to be applied to compute -// the phase wind-up correction. -// It is typically an equivalent to the 1265 RTCM message types -// +/// Precise phase biases correction +/// +/// The precise phase biases message contains the biases +/// to be added to the carrier phase of the corresponding +/// signal to get corrected carrier phase measurement, as +/// well as the satellite yaw angle to be applied to compute +/// the phase wind-up correction. +/// It is typically an equivalent to the 1265 RTCM message types +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSsrPhaseBiases { pub sender_id: Option, + /// GNSS reference time of the correction pub time: GPSTimeSec, - // ^ GNSS reference time of the correction + /// GNSS signal identifier (16 bit) pub sid: GnssSignal, - // ^ GNSS signal identifier (16 bit) + /// Update interval between consecutive corrections. Encoded following RTCM + /// DF391 specification. pub update_interval: u8, - // ^ Update interval between consecutive corrections + /// IOD of the SSR correction. A change of Issue Of Data SSR is used to + /// indicate a change in the SSR generating configuration pub iod_ssr: u8, - // ^ IOD of the SSR correction. A change of Issue Of Data SSR is used to - // indicate a change in the SSR generating configuration + /// Indicator for the dispersive phase biases property. pub dispersive_bias: u8, - // ^ Indicator for the dispersive phase biases property. + /// Consistency indicator for Melbourne-Wubbena linear combinations pub mw_consistency: u8, - // ^ Consistency indicator for Melbourne-Wubbena linear combinations + /// Satellite yaw angle pub yaw: u16, - // ^ Satellite yaw angle + /// Satellite yaw angle rate pub yaw_rate: i8, - // ^ Satellite yaw angle rate + /// Phase biases corrections for a satellite being tracked. pub biases: Vec, - // ^ Phase biases corrections for a satellite being tracked. } impl MsgSsrPhaseBiases { @@ -701,21 +711,21 @@ impl super::SBPMessage for MsgSsrPhaseBiases { } } -// Slant Total Electron Content -// -// The STEC per space vehicle, given as polynomial approximation for -// a given grid. This should be combined with SSR-GriddedCorrection -// message to get the state space representation of the atmospheric -// delay. -// +/// Slant Total Electron Content +/// +/// The STEC per space vehicle, given as polynomial approximation for +/// a given grid. This should be combined with MSG_SSR_GRIDDED_CORRECTION +/// message to get the state space representation of the atmospheric +/// delay. It is typically equivalent to the QZSS CLAS Sub Type 8 messages +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSsrStecCorrection { pub sender_id: Option, + /// Header of a STEC message pub header: STECHeader, - // ^ Header of a STEC message + /// Array of STEC information for each space vehicle pub stec_sat_list: Vec, - // ^ Array of STEC information for each space vehicle } impl MsgSsrStecCorrection { @@ -739,18 +749,19 @@ impl super::SBPMessage for MsgSsrStecCorrection { } } -// Gridded troposphere and STEC residuals -// -// STEC residuals are per space vehicle, tropo is not. -// +/// Gridded troposphere and STEC residuals +/// +/// STEC residuals are per space vehicle, tropo is not. +/// It is typically equivalent to the QZSS CLAS Sub Type 9 messages +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSsrGriddedCorrection { pub sender_id: Option, + /// Header of a Gridded Correction message pub header: GriddedCorrectionHeader, - // ^ Header of a Gridded Correction message + /// Tropo and STEC residuals for the given grid point pub element: GridElement, - // ^ Tropo and STEC residuals for the given grid point } impl MsgSsrGriddedCorrection { @@ -774,21 +785,21 @@ impl super::SBPMessage for MsgSsrGriddedCorrection { } } -// None -// -// Definition of the grid for STEC and tropo messages -// +/// None +/// +/// Definition of the grid for STEC and tropo messages +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgSsrGridDefinition { pub sender_id: Option, + /// Header of a Gridded Correction message pub header: GridDefinitionHeader, - // ^ Header of a Gridded Correction message + /// Run Length Encode list of quadrants that contain valid data. The spec + /// describes the encoding scheme in detail, but essentially the index of + /// the quadrants that contain transitions between valid and invalid (and + /// vice versa) are encoded as u8 integers. pub rle_list: Vec, - // ^ Run Length Encode list of quadrants that contain valid data. The spec - // describes the encoding scheme in detail, but essentially the index of - // the quadrants that contain transitions between valid and invalid (and - // vice versa) are encoded as u8 integers. } impl MsgSsrGridDefinition { diff --git a/rust/sbp/src/messages/system.rs b/rust/sbp/src/messages/system.rs index 418775b8a6..b749fe0b69 100644 --- a/rust/sbp/src/messages/system.rs +++ b/rust/sbp/src/messages/system.rs @@ -12,28 +12,28 @@ // Automatically generated from yaml/swiftnav/sbp/system.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Standardized system messages from Swift Navigation devices. +/// Standardized system messages from Swift Navigation devices. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; -// System start-up message -// -// The system start-up message is sent once on system -// start-up. It notifies the host or other attached devices that -// the system has started and is now ready to respond to commands -// or configuration requests. -// +/// System start-up message +/// +/// The system start-up message is sent once on system +/// start-up. It notifies the host or other attached devices that +/// the system has started and is now ready to respond to commands +/// or configuration requests. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgStartup { pub sender_id: Option, + /// Cause of startup pub cause: u8, - // ^ Cause of startup + /// Startup type pub startup_type: u8, - // ^ Startup type + /// Reserved pub reserved: u16, - // ^ Reserved } impl MsgStartup { @@ -58,24 +58,24 @@ impl super::SBPMessage for MsgStartup { } } -// Status of received corrections -// -// This message provides information about the receipt of Differential -// corrections. It is expected to be sent with each receipt of a complete -// corrections packet. -// +/// Status of received corrections +/// +/// This message provides information about the receipt of Differential +/// corrections. It is expected to be sent with each receipt of a complete +/// corrections packet. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgDgnssStatus { pub sender_id: Option, + /// Status flags pub flags: u8, - // ^ Status flags + /// Latency of observation receipt pub latency: u16, - // ^ Latency of observation receipt + /// Number of signals from base station pub num_signals: u8, - // ^ Number of signals from base station + /// Corrections source string pub source: String, - // ^ Corrections source string } impl MsgDgnssStatus { @@ -101,25 +101,25 @@ impl super::SBPMessage for MsgDgnssStatus { } } -// System heartbeat message -// -// The heartbeat message is sent periodically to inform the host -// or other attached devices that the system is running. It is -// used to monitor system malfunctions. It also contains status -// flags that indicate to the host the status of the system and -// whether it is operating correctly. Currently, the expected -// heartbeat interval is 1 sec. -// -// The system error flag is used to indicate that an error has -// occurred in the system. To determine the source of the error, -// the remaining error flags should be inspected. -// +/// System heartbeat message +/// +/// The heartbeat message is sent periodically to inform the host +/// or other attached devices that the system is running. It is +/// used to monitor system malfunctions. It also contains status +/// flags that indicate to the host the status of the system and +/// whether it is operating correctly. Currently, the expected +/// heartbeat interval is 1 sec. +/// +/// The system error flag is used to indicate that an error has +/// occurred in the system. To determine the source of the error, +/// the remaining error flags should be inspected. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgHeartbeat { pub sender_id: Option, + /// Status flags pub flags: u32, - // ^ Status flags } impl MsgHeartbeat { @@ -142,17 +142,17 @@ impl super::SBPMessage for MsgHeartbeat { } } -// Inertial Navigation System status message -// -// The INS status message describes the state of the operation -// and initialization of the inertial navigation system. -// +/// Inertial Navigation System status message +/// +/// The INS status message describes the state of the operation +/// and initialization of the inertial navigation system. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgInsStatus { pub sender_id: Option, + /// Status flags pub flags: u32, - // ^ Status flags } impl MsgInsStatus { @@ -175,21 +175,21 @@ impl super::SBPMessage for MsgInsStatus { } } -// Experimental telemetry message -// -// The CSAC telemetry message has an implementation defined telemetry string -// from a device. It is not produced or available on general Swift Products. -// It is intended to be a low rate message for status purposes. -// +/// Experimental telemetry message +/// +/// The CSAC telemetry message has an implementation defined telemetry string +/// from a device. It is not produced or available on general Swift Products. +/// It is intended to be a low rate message for status purposes. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgCsacTelemetry { pub sender_id: Option, + /// Index representing the type of telemetry in use. It is implemention + /// defined. pub id: u8, - // ^ Index representing the type of telemetry in use. It is implemention - // defined. + /// Comma separated list of values as defined by the index pub telemetry: String, - // ^ Comma separated list of values as defined by the index } impl MsgCsacTelemetry { @@ -213,21 +213,21 @@ impl super::SBPMessage for MsgCsacTelemetry { } } -// Experimental telemetry message labels -// -// The CSAC telemetry message provides labels for each member of the string -// produced by MSG_CSAC_TELEMETRY. It should be provided by a device at a lower -// rate than the MSG_CSAC_TELEMETRY. -// +/// Experimental telemetry message labels +/// +/// The CSAC telemetry message provides labels for each member of the string +/// produced by MSG_CSAC_TELEMETRY. It should be provided by a device at a lower +/// rate than the MSG_CSAC_TELEMETRY. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgCsacTelemetryLabels { pub sender_id: Option, + /// Index representing the type of telemetry in use. It is implemention + /// defined. pub id: u8, - // ^ Index representing the type of telemetry in use. It is implemention - // defined. + /// Comma separated list of telemetry field values pub telemetry_labels: String, - // ^ Comma separated list of telemetry field values } impl MsgCsacTelemetryLabels { diff --git a/rust/sbp/src/messages/tracking.rs b/rust/sbp/src/messages/tracking.rs index 8e17b9b2a6..53748aa6fc 100644 --- a/rust/sbp/src/messages/tracking.rs +++ b/rust/sbp/src/messages/tracking.rs @@ -12,69 +12,69 @@ // Automatically generated from yaml/swiftnav/sbp/tracking.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Satellite code and carrier-phase tracking messages from the device. +/// Satellite code and carrier-phase tracking messages from the device. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; use super::gnss::*; -// Detailed signal tracking channel states. DEPRECATED. -// -// The tracking message returns a set tracking channel parameters for a -// single tracking channel useful for debugging issues. -// +/// Detailed signal tracking channel states. DEPRECATED. +/// +/// The tracking message returns a set tracking channel parameters for a +/// single tracking channel useful for debugging issues. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgTrackingStateDetailedDepA { pub sender_id: Option, + /// Receiver clock time. pub recv_time: u64, - // ^ Receiver clock time. + /// Time of transmission of signal from satellite. TOW only valid when TOW + /// status is decoded or propagated. WN only valid when week number valid + /// flag is set. pub tot: GPSTime, - // ^ Time of transmission of signal from satellite. TOW only valid when TOW - // status is decoded or propagated. WN only valid when week number valid - // flag is set. + /// Pseudorange observation. Valid only when pseudorange valid flag is set. pub P: u32, - // ^ Pseudorange observation. Valid only when pseudorange valid flag is set. + /// Pseudorange observation standard deviation. Valid only when pseudorange + /// valid flag is set. pub P_std: u16, - // ^ Pseudorange observation standard deviation. Valid only when pseudorange - // valid flag is set. + /// Carrier phase observation with typical sign convention. Valid only when + /// PLL pessimistic lock is achieved. pub L: CarrierPhase, - // ^ Carrier phase observation with typical sign convention. Valid only when - // PLL pessimistic lock is achieved. + /// Carrier-to-Noise density pub cn0: u8, - // ^ Carrier-to-Noise density + /// Lock time. It is encoded according to DF402 from the RTCM 10403.2 + /// Amendment 2 specification. Valid values range from 0 to 15. pub lock: u16, - // ^ Lock time. It is encoded according to DF402 from the RTCM 10403.2 - // Amendment 2 specification. Valid values range from 0 to 15. + /// GNSS signal identifier. pub sid: GnssSignal, - // ^ GNSS signal identifier. + /// Carrier Doppler frequency. pub doppler: i32, - // ^ Carrier Doppler frequency. + /// Carrier Doppler frequency standard deviation. pub doppler_std: u16, - // ^ Carrier Doppler frequency standard deviation. + /// Number of seconds of continuous tracking. Specifies how much time signal + /// is in continuous track. pub uptime: u32, - // ^ Number of seconds of continuous tracking. Specifies how much time signal - // is in continuous track. + /// TCXO clock offset. Valid only when valid clock valid flag is set. pub clock_offset: i16, - // ^ TCXO clock offset. Valid only when valid clock valid flag is set. + /// TCXO clock drift. Valid only when valid clock valid flag is set. pub clock_drift: i16, - // ^ TCXO clock drift. Valid only when valid clock valid flag is set. + /// Early-Prompt (EP) and Prompt-Late (PL) correlators spacing. pub corr_spacing: u16, - // ^ Early-Prompt (EP) and Prompt-Late (PL) correlators spacing. + /// Acceleration. Valid only when acceleration valid flag is set. pub acceleration: i8, - // ^ Acceleration. Valid only when acceleration valid flag is set. + /// Synchronization status flags. pub sync_flags: u8, - // ^ Synchronization status flags. + /// TOW status flags. pub tow_flags: u8, - // ^ TOW status flags. + /// Tracking loop status flags. pub track_flags: u8, - // ^ Tracking loop status flags. + /// Navigation data status flags. pub nav_flags: u8, - // ^ Navigation data status flags. + /// Parameters sets flags. pub pset_flags: u8, - // ^ Parameters sets flags. + /// Miscellaneous flags. pub misc_flags: u8, - // ^ Miscellaneous flags. } impl MsgTrackingStateDetailedDepA { @@ -117,62 +117,62 @@ impl super::SBPMessage for MsgTrackingStateDetailedDepA { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgTrackingStateDetailedDep { pub sender_id: Option, + /// Receiver clock time. pub recv_time: u64, - // ^ Receiver clock time. + /// Time of transmission of signal from satellite. TOW only valid when TOW + /// status is decoded or propagated. WN only valid when week number valid + /// flag is set. pub tot: GPSTimeDep, - // ^ Time of transmission of signal from satellite. TOW only valid when TOW - // status is decoded or propagated. WN only valid when week number valid - // flag is set. + /// Pseudorange observation. Valid only when pseudorange valid flag is set. pub P: u32, - // ^ Pseudorange observation. Valid only when pseudorange valid flag is set. + /// Pseudorange observation standard deviation. Valid only when pseudorange + /// valid flag is set. pub P_std: u16, - // ^ Pseudorange observation standard deviation. Valid only when pseudorange - // valid flag is set. + /// Carrier phase observation with typical sign convention. Valid only when + /// PLL pessimistic lock is achieved. pub L: CarrierPhase, - // ^ Carrier phase observation with typical sign convention. Valid only when - // PLL pessimistic lock is achieved. + /// Carrier-to-Noise density pub cn0: u8, - // ^ Carrier-to-Noise density + /// Lock time. It is encoded according to DF402 from the RTCM 10403.2 + /// Amendment 2 specification. Valid values range from 0 to 15. pub lock: u16, - // ^ Lock time. It is encoded according to DF402 from the RTCM 10403.2 - // Amendment 2 specification. Valid values range from 0 to 15. + /// GNSS signal identifier. pub sid: GnssSignalDep, - // ^ GNSS signal identifier. + /// Carrier Doppler frequency. pub doppler: i32, - // ^ Carrier Doppler frequency. + /// Carrier Doppler frequency standard deviation. pub doppler_std: u16, - // ^ Carrier Doppler frequency standard deviation. + /// Number of seconds of continuous tracking. Specifies how much time signal + /// is in continuous track. pub uptime: u32, - // ^ Number of seconds of continuous tracking. Specifies how much time signal - // is in continuous track. + /// TCXO clock offset. Valid only when valid clock valid flag is set. pub clock_offset: i16, - // ^ TCXO clock offset. Valid only when valid clock valid flag is set. + /// TCXO clock drift. Valid only when valid clock valid flag is set. pub clock_drift: i16, - // ^ TCXO clock drift. Valid only when valid clock valid flag is set. + /// Early-Prompt (EP) and Prompt-Late (PL) correlators spacing. pub corr_spacing: u16, - // ^ Early-Prompt (EP) and Prompt-Late (PL) correlators spacing. + /// Acceleration. Valid only when acceleration valid flag is set. pub acceleration: i8, - // ^ Acceleration. Valid only when acceleration valid flag is set. + /// Synchronization status flags. pub sync_flags: u8, - // ^ Synchronization status flags. + /// TOW status flags. pub tow_flags: u8, - // ^ TOW status flags. + /// Tracking loop status flags. pub track_flags: u8, - // ^ Tracking loop status flags. + /// Navigation data status flags. pub nav_flags: u8, - // ^ Navigation data status flags. + /// Parameters sets flags. pub pset_flags: u8, - // ^ Parameters sets flags. + /// Miscellaneous flags. pub misc_flags: u8, - // ^ Miscellaneous flags. } impl MsgTrackingStateDetailedDep { @@ -215,20 +215,20 @@ impl super::SBPMessage for MsgTrackingStateDetailedDep { } } -// Signal tracking channel state -// -// Tracking channel state for a specific satellite signal and -// measured signal power. -// +/// Signal tracking channel state +/// +/// Tracking channel state for a specific satellite signal and +/// measured signal power. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct TrackingChannelState { + /// GNSS signal being tracked pub sid: GnssSignal, - // ^ GNSS signal being tracked + /// Frequency channel number (GLONASS only) pub fcn: u8, - // ^ Frequency channel number (GLONASS only) + /// Carrier-to-Noise density. Zero implies invalid cn0. pub cn0: u8, - // ^ Carrier-to-Noise density. Zero implies invalid cn0. } impl TrackingChannelState { @@ -261,18 +261,18 @@ impl TrackingChannelState { } } -// Signal tracking channel states -// -// The tracking message returns a variable-length array of tracking -// channel states. It reports status and carrier-to-noise density -// measurements for all tracked satellites. -// +/// Signal tracking channel states +/// +/// The tracking message returns a variable-length array of tracking +/// channel states. It reports status and carrier-to-noise density +/// measurements for all tracked satellites. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgTrackingState { pub sender_id: Option, + /// Signal tracking channel state pub states: Vec, - // ^ Signal tracking channel state } impl MsgTrackingState { @@ -295,22 +295,22 @@ impl super::SBPMessage for MsgTrackingState { } } -// Measurement Engine signal tracking channel state -// -// Measurement Engine tracking channel state for a specific satellite signal -// and measured signal power. -// The mesid field for Glonass can either -// carry the FCN as 100 + FCN where FCN is in [-7, +6] or -// the Slot ID (from 1 to 28) -// +/// Measurement Engine signal tracking channel state +/// +/// Measurement Engine tracking channel state for a specific satellite signal +/// and measured signal power. +/// The mesid field for Glonass can either +/// carry the FCN as 100 + FCN where FCN is in [-7, +6] or +/// the Slot ID (from 1 to 28) +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MeasurementState { + /// Measurement Engine GNSS signal being tracked (carries either Glonass FCN + /// or SLOT) pub mesid: GnssSignal, - // ^ Measurement Engine GNSS signal being tracked (carries either Glonass FCN - // or SLOT) + /// Carrier-to-Noise density. Zero implies invalid cn0. pub cn0: u8, - // ^ Carrier-to-Noise density. Zero implies invalid cn0. } impl MeasurementState { @@ -340,18 +340,18 @@ impl MeasurementState { } } -// Measurement Engine signal tracking channel states -// -// The tracking message returns a variable-length array of tracking -// channel states. It reports status and carrier-to-noise density -// measurements for all tracked satellites. -// +/// Measurement Engine signal tracking channel states +/// +/// The tracking message returns a variable-length array of tracking +/// channel states. It reports status and carrier-to-noise density +/// measurements for all tracked satellites. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgMeasurementState { pub sender_id: Option, + /// ME signal tracking channel state pub states: Vec, - // ^ ME signal tracking channel state } impl MsgMeasurementState { @@ -374,17 +374,17 @@ impl super::SBPMessage for MsgMeasurementState { } } -// Complex correlation structure -// -// Structure containing in-phase and quadrature correlation components. -// +/// Complex correlation structure +/// +/// Structure containing in-phase and quadrature correlation components. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct TrackingChannelCorrelation { + /// In-phase correlation pub I: i16, - // ^ In-phase correlation + /// Quadrature correlation pub Q: i16, - // ^ Quadrature correlation } impl TrackingChannelCorrelation { @@ -416,21 +416,21 @@ impl TrackingChannelCorrelation { } } -// Tracking channel correlations -// -// When enabled, a tracking channel can output the correlations at each -// update interval. -// +/// Tracking channel correlations +/// +/// When enabled, a tracking channel can output the correlations at each +/// update interval. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgTrackingIq { pub sender_id: Option, + /// Tracking channel of origin pub channel: u8, - // ^ Tracking channel of origin + /// GNSS signal identifier pub sid: GnssSignal, - // ^ GNSS signal identifier + /// Early, Prompt and Late correlations pub corrs: Vec, - // ^ Early, Prompt and Late correlations } impl MsgTrackingIq { @@ -455,17 +455,17 @@ impl super::SBPMessage for MsgTrackingIq { } } -// Complex correlation structure -// -// Structure containing in-phase and quadrature correlation components. -// +/// Complex correlation structure +/// +/// Structure containing in-phase and quadrature correlation components. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct TrackingChannelCorrelationDep { + /// In-phase correlation pub I: i32, - // ^ In-phase correlation + /// Quadrature correlation pub Q: i32, - // ^ Quadrature correlation } impl TrackingChannelCorrelationDep { @@ -499,21 +499,21 @@ impl TrackingChannelCorrelationDep { } } -// Tracking channel correlations -// -// When enabled, a tracking channel can output the correlations at each -// update interval. -// +/// Tracking channel correlations +/// +/// When enabled, a tracking channel can output the correlations at each +/// update interval. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgTrackingIqDepB { pub sender_id: Option, + /// Tracking channel of origin pub channel: u8, - // ^ Tracking channel of origin + /// GNSS signal identifier pub sid: GnssSignal, - // ^ GNSS signal identifier + /// Early, Prompt and Late correlations pub corrs: Vec, - // ^ Early, Prompt and Late correlations } impl MsgTrackingIqDepB { @@ -538,20 +538,20 @@ impl super::SBPMessage for MsgTrackingIqDepB { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgTrackingIqDepA { pub sender_id: Option, + /// Tracking channel of origin pub channel: u8, - // ^ Tracking channel of origin + /// GNSS signal identifier pub sid: GnssSignalDep, - // ^ GNSS signal identifier + /// Early, Prompt and Late correlations pub corrs: Vec, - // ^ Early, Prompt and Late correlations } impl MsgTrackingIqDepA { @@ -576,19 +576,19 @@ impl super::SBPMessage for MsgTrackingIqDepA { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct TrackingChannelStateDepA { + /// Status of tracking channel pub state: u8, - // ^ Status of tracking channel + /// PRN-1 being tracked pub prn: u8, - // ^ PRN-1 being tracked + /// Carrier-to-noise density pub cn0: f32, - // ^ Carrier-to-noise density } impl TrackingChannelStateDepA { @@ -621,16 +621,16 @@ impl TrackingChannelStateDepA { } } -// Deprecated -// -// Deprecated. -// +/// Deprecated +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgTrackingStateDepA { pub sender_id: Option, + /// Satellite tracking channel state pub states: Vec, - // ^ Satellite tracking channel state } impl MsgTrackingStateDepA { @@ -653,19 +653,19 @@ impl super::SBPMessage for MsgTrackingStateDepA { } } -// Deprecated. -// -// Deprecated. -// +/// Deprecated. +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct TrackingChannelStateDepB { + /// Status of tracking channel pub state: u8, - // ^ Status of tracking channel + /// GNSS signal being tracked pub sid: GnssSignalDep, - // ^ GNSS signal being tracked + /// Carrier-to-noise density pub cn0: f32, - // ^ Carrier-to-noise density } impl TrackingChannelStateDepB { @@ -698,16 +698,16 @@ impl TrackingChannelStateDepB { } } -// Deprecated. -// -// Deprecated. -// +/// Deprecated. +/// +/// Deprecated. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgTrackingStateDepB { pub sender_id: Option, + /// Signal tracking channel state pub states: Vec, - // ^ Signal tracking channel state } impl MsgTrackingStateDepB { diff --git a/rust/sbp/src/messages/user.rs b/rust/sbp/src/messages/user.rs index cd47f0f499..8e1adca926 100644 --- a/rust/sbp/src/messages/user.rs +++ b/rust/sbp/src/messages/user.rs @@ -12,22 +12,22 @@ // Automatically generated from yaml/swiftnav/sbp/user.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Messages reserved for use by the user. +/// Messages reserved for use by the user. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; -// User data -// -// This message can contain any application specific user data up to a -// maximum length of 255 bytes per message. -// +/// User data +/// +/// This message can contain any application specific user data up to a +/// maximum length of 255 bytes per message. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgUserData { pub sender_id: Option, + /// User data payload pub contents: Vec, - // ^ User data payload } impl MsgUserData { diff --git a/rust/sbp/src/messages/vehicle.rs b/rust/sbp/src/messages/vehicle.rs index c99217c205..2b1cc9dc67 100644 --- a/rust/sbp/src/messages/vehicle.rs +++ b/rust/sbp/src/messages/vehicle.rs @@ -12,31 +12,31 @@ // Automatically generated from yaml/swiftnav/sbp/vehicle.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -// Messages from a vehicle. +/// Messages from a vehicle. extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; -// Vehicle forward (x-axis) velocity -// -// Message representing the x component of vehicle velocity in the user frame at the odometry -// reference point(s) specified by the user. The offset for the odometry reference point and -// the definition and origin of the user frame are defined through the device settings interface. -// There are 4 possible user-defined sources of this message which are labeled arbitrarily -// source 0 through 3. -// +/// Vehicle forward (x-axis) velocity +/// +/// Message representing the x component of vehicle velocity in the user frame at the odometry +/// reference point(s) specified by the user. The offset for the odometry reference point and +/// the definition and origin of the user frame are defined through the device settings interface. +/// There are 4 possible user-defined sources of this message which are labeled arbitrarily +/// source 0 through 3. +/// #[derive(Debug)] #[allow(non_snake_case)] pub struct MsgOdometry { pub sender_id: Option, + /// Time field representing either milliseconds in the GPS Week or local CPU + /// time from the producing system in milliseconds. See the tow_source flag + /// for the exact source of this timestamp. pub tow: u32, - // ^ Time field representing either milliseconds in the GPS Week or local CPU - // time from the producing system in milliseconds. See the tow_source flag - // for the exact source of this timestamp. + /// The signed forward component of vehicle velocity. pub velocity: i32, - // ^ The signed forward component of vehicle velocity. + /// Status flags pub flags: u8, - // ^ Status flags } impl MsgOdometry { From eb0bf5685c5f43014b06b78ecb4e0463526dc7bf Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Mon, 22 Jul 2019 09:02:39 -0700 Subject: [PATCH 21/25] Removed the unneeded MessageError enum --- .../resources/sbp_messages_template.rs | 6 +- rust/sbp/src/messages/acquisition.rs | 30 +- rust/sbp/src/messages/bootload.rs | 12 +- rust/sbp/src/messages/ext_events.rs | 2 +- rust/sbp/src/messages/file_io.rs | 18 +- rust/sbp/src/messages/flash.rs | 20 +- rust/sbp/src/messages/gnss.rs | 63 +- rust/sbp/src/messages/imu.rs | 4 +- rust/sbp/src/messages/linux.rs | 16 +- rust/sbp/src/messages/logging.rs | 6 +- rust/sbp/src/messages/mag.rs | 2 +- rust/sbp/src/messages/mod.rs | 1178 ++++++++--------- rust/sbp/src/messages/navigation.rs | 48 +- rust/sbp/src/messages/ndb.rs | 2 +- rust/sbp/src/messages/observation.rs | 211 ++- rust/sbp/src/messages/orientation.rs | 8 +- rust/sbp/src/messages/piksi.rs | 86 +- rust/sbp/src/messages/sbas.rs | 2 +- rust/sbp/src/messages/settings.rs | 20 +- rust/sbp/src/messages/ssr.rs | 89 +- rust/sbp/src/messages/system.rs | 12 +- rust/sbp/src/messages/tracking.rs | 69 +- rust/sbp/src/messages/user.rs | 2 +- rust/sbp/src/messages/vehicle.rs | 2 +- rust/sbp/src/parser/mod.rs | 35 +- 25 files changed, 906 insertions(+), 1037 deletions(-) diff --git a/generator/sbpg/targets/resources/sbp_messages_template.rs b/generator/sbpg/targets/resources/sbp_messages_template.rs index 9e781f8270..ae485906e7 100644 --- a/generator/sbpg/targets/resources/sbp_messages_template.rs +++ b/generator/sbpg/targets/resources/sbp_messages_template.rs @@ -45,7 +45,7 @@ pub struct (((m.identifier|camel_case))) { } impl (((m.identifier|camel_case))) { - pub fn parse(_buf: &mut &[u8]) -> Result<(((m.identifier|camel_case))), ::parser::MessageError> { + pub fn parse(_buf: &mut &[u8]) -> Result<(((m.identifier|camel_case))), ::Error> { Ok( (((m.identifier|camel_case))){ ((*- if m.sbp_id *)) sender_id: None, @@ -57,7 +57,7 @@ impl (((m.identifier|camel_case))) { } ((*- if not m.sbp_id *)) - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push( (((m.identifier|camel_case)))::parse(buf)? ); @@ -65,7 +65,7 @@ impl (((m.identifier|camel_case))) { Ok(v) } - pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push( (((m.identifier|camel_case)))::parse(buf)? ); diff --git a/rust/sbp/src/messages/acquisition.rs b/rust/sbp/src/messages/acquisition.rs index f144ce86b6..a5a6a8e60f 100644 --- a/rust/sbp/src/messages/acquisition.rs +++ b/rust/sbp/src/messages/acquisition.rs @@ -41,7 +41,7 @@ pub struct MsgAcqResult { } impl MsgAcqResult { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAcqResult { sender_id: None, cn0: _buf.read_f32::()?, @@ -82,7 +82,7 @@ pub struct MsgAcqResultDepC { } impl MsgAcqResultDepC { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAcqResultDepC { sender_id: None, cn0: _buf.read_f32::()?, @@ -124,7 +124,7 @@ pub struct MsgAcqResultDepB { } impl MsgAcqResultDepB { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAcqResultDepB { sender_id: None, snr: _buf.read_f32::()?, @@ -167,7 +167,7 @@ pub struct MsgAcqResultDepA { } impl MsgAcqResultDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAcqResultDepA { sender_id: None, snr: _buf.read_f32::()?, @@ -225,7 +225,7 @@ pub struct AcqSvProfile { } impl AcqSvProfile { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(AcqSvProfile { job_type: _buf.read_u8()?, status: _buf.read_u8()?, @@ -241,7 +241,7 @@ impl AcqSvProfile { cp: _buf.read_u32::()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(AcqSvProfile::parse(buf)?); @@ -249,10 +249,7 @@ impl AcqSvProfile { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(AcqSvProfile::parse(buf)?); @@ -295,7 +292,7 @@ pub struct AcqSvProfileDep { } impl AcqSvProfileDep { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(AcqSvProfileDep { job_type: _buf.read_u8()?, status: _buf.read_u8()?, @@ -311,7 +308,7 @@ impl AcqSvProfileDep { cp: _buf.read_u32::()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(AcqSvProfileDep::parse(buf)?); @@ -319,10 +316,7 @@ impl AcqSvProfileDep { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(AcqSvProfileDep::parse(buf)?); @@ -345,7 +339,7 @@ pub struct MsgAcqSvProfile { } impl MsgAcqSvProfile { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAcqSvProfile { sender_id: None, acq_sv_profile: AcqSvProfile::parse_array(_buf)?, @@ -377,7 +371,7 @@ pub struct MsgAcqSvProfileDep { } impl MsgAcqSvProfileDep { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAcqSvProfileDep { sender_id: None, acq_sv_profile: AcqSvProfileDep::parse_array(_buf)?, diff --git a/rust/sbp/src/messages/bootload.rs b/rust/sbp/src/messages/bootload.rs index 1b2eaa9f53..4be7b50a7f 100644 --- a/rust/sbp/src/messages/bootload.rs +++ b/rust/sbp/src/messages/bootload.rs @@ -34,7 +34,7 @@ pub struct MsgBootloaderHandshakeReq { } impl MsgBootloaderHandshakeReq { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBootloaderHandshakeReq { sender_id: None }) } } @@ -69,7 +69,7 @@ pub struct MsgBootloaderHandshakeResp { } impl MsgBootloaderHandshakeResp { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBootloaderHandshakeResp { sender_id: None, flags: _buf.read_u32::()?, @@ -102,7 +102,7 @@ pub struct MsgBootloaderJumpToApp { } impl MsgBootloaderJumpToApp { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBootloaderJumpToApp { sender_id: None, jump: _buf.read_u8()?, @@ -137,7 +137,7 @@ pub struct MsgNapDeviceDnaReq { } impl MsgNapDeviceDnaReq { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgNapDeviceDnaReq { sender_id: None }) } } @@ -171,7 +171,7 @@ pub struct MsgNapDeviceDnaResp { } impl MsgNapDeviceDnaResp { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgNapDeviceDnaResp { sender_id: None, dna: ::parser::read_u8_array_limit(_buf, 8)?, @@ -203,7 +203,7 @@ pub struct MsgBootloaderHandshakeDepA { } impl MsgBootloaderHandshakeDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBootloaderHandshakeDepA { sender_id: None, handshake: ::parser::read_u8_array(_buf)?, diff --git a/rust/sbp/src/messages/ext_events.rs b/rust/sbp/src/messages/ext_events.rs index 2a32a82e45..4af1295bf6 100644 --- a/rust/sbp/src/messages/ext_events.rs +++ b/rust/sbp/src/messages/ext_events.rs @@ -41,7 +41,7 @@ pub struct MsgExtEvent { } impl MsgExtEvent { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgExtEvent { sender_id: None, wn: _buf.read_u16::()?, diff --git a/rust/sbp/src/messages/file_io.rs b/rust/sbp/src/messages/file_io.rs index a3dcbed75a..587a15cc6e 100644 --- a/rust/sbp/src/messages/file_io.rs +++ b/rust/sbp/src/messages/file_io.rs @@ -50,7 +50,7 @@ pub struct MsgFileioReadReq { } impl MsgFileioReadReq { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioReadReq { sender_id: None, sequence: _buf.read_u32::()?, @@ -91,7 +91,7 @@ pub struct MsgFileioReadResp { } impl MsgFileioReadResp { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioReadResp { sender_id: None, sequence: _buf.read_u32::()?, @@ -137,7 +137,7 @@ pub struct MsgFileioReadDirReq { } impl MsgFileioReadDirReq { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioReadDirReq { sender_id: None, sequence: _buf.read_u32::()?, @@ -178,7 +178,7 @@ pub struct MsgFileioReadDirResp { } impl MsgFileioReadDirResp { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioReadDirResp { sender_id: None, sequence: _buf.read_u32::()?, @@ -214,7 +214,7 @@ pub struct MsgFileioRemove { } impl MsgFileioRemove { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioRemove { sender_id: None, filename: ::parser::read_string(_buf)?, @@ -259,7 +259,7 @@ pub struct MsgFileioWriteReq { } impl MsgFileioWriteReq { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioWriteReq { sender_id: None, sequence: _buf.read_u32::()?, @@ -298,7 +298,7 @@ pub struct MsgFileioWriteResp { } impl MsgFileioWriteResp { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioWriteResp { sender_id: None, sequence: _buf.read_u32::()?, @@ -333,7 +333,7 @@ pub struct MsgFileioConfigReq { } impl MsgFileioConfigReq { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioConfigReq { sender_id: None, sequence: _buf.read_u32::()?, @@ -375,7 +375,7 @@ pub struct MsgFileioConfigResp { } impl MsgFileioConfigResp { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFileioConfigResp { sender_id: None, sequence: _buf.read_u32::()?, diff --git a/rust/sbp/src/messages/flash.rs b/rust/sbp/src/messages/flash.rs index 944326ea9d..722cd2b811 100644 --- a/rust/sbp/src/messages/flash.rs +++ b/rust/sbp/src/messages/flash.rs @@ -45,7 +45,7 @@ pub struct MsgFlashProgram { } impl MsgFlashProgram { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFlashProgram { sender_id: None, target: _buf.read_u8()?, @@ -83,7 +83,7 @@ pub struct MsgFlashDone { } impl MsgFlashDone { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFlashDone { sender_id: None, response: _buf.read_u8()?, @@ -125,7 +125,7 @@ pub struct MsgFlashReadReq { } impl MsgFlashReadReq { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFlashReadReq { sender_id: None, target: _buf.read_u8()?, @@ -169,7 +169,7 @@ pub struct MsgFlashReadResp { } impl MsgFlashReadResp { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFlashReadResp { sender_id: None, target: _buf.read_u8()?, @@ -209,7 +209,7 @@ pub struct MsgFlashErase { } impl MsgFlashErase { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFlashErase { sender_id: None, target: _buf.read_u8()?, @@ -243,7 +243,7 @@ pub struct MsgStmFlashLockSector { } impl MsgStmFlashLockSector { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgStmFlashLockSector { sender_id: None, sector: _buf.read_u32::()?, @@ -276,7 +276,7 @@ pub struct MsgStmFlashUnlockSector { } impl MsgStmFlashUnlockSector { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgStmFlashUnlockSector { sender_id: None, sector: _buf.read_u32::()?, @@ -310,7 +310,7 @@ pub struct MsgStmUniqueIdReq { } impl MsgStmUniqueIdReq { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgStmUniqueIdReq { sender_id: None }) } } @@ -343,7 +343,7 @@ pub struct MsgStmUniqueIdResp { } impl MsgStmUniqueIdResp { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgStmUniqueIdResp { sender_id: None, stm_id: ::parser::read_u8_array_limit(_buf, 12)?, @@ -376,7 +376,7 @@ pub struct MsgM25FlashWriteStatus { } impl MsgM25FlashWriteStatus { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgM25FlashWriteStatus { sender_id: None, status: ::parser::read_u8_array_limit(_buf, 1)?, diff --git a/rust/sbp/src/messages/gnss.rs b/rust/sbp/src/messages/gnss.rs index 12e0f96c98..5e7c95c84a 100644 --- a/rust/sbp/src/messages/gnss.rs +++ b/rust/sbp/src/messages/gnss.rs @@ -32,13 +32,13 @@ pub struct GnssSignal { } impl GnssSignal { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(GnssSignal { sat: _buf.read_u8()?, code: _buf.read_u8()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(GnssSignal::parse(buf)?); @@ -46,10 +46,7 @@ impl GnssSignal { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(GnssSignal::parse(buf)?); @@ -73,13 +70,13 @@ pub struct SvId { } impl SvId { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(SvId { satId: _buf.read_u8()?, constellation: _buf.read_u8()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(SvId::parse(buf)?); @@ -87,10 +84,7 @@ impl SvId { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(SvId::parse(buf)?); @@ -117,14 +111,14 @@ pub struct GnssSignalDep { } impl GnssSignalDep { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(GnssSignalDep { sat: _buf.read_u16::()?, code: _buf.read_u8()?, reserved: _buf.read_u8()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(GnssSignalDep::parse(buf)?); @@ -132,10 +126,7 @@ impl GnssSignalDep { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(GnssSignalDep::parse(buf)?); @@ -160,13 +151,13 @@ pub struct GPSTimeDep { } impl GPSTimeDep { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(GPSTimeDep { tow: _buf.read_u32::()?, wn: _buf.read_u16::()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(GPSTimeDep::parse(buf)?); @@ -174,10 +165,7 @@ impl GPSTimeDep { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(GPSTimeDep::parse(buf)?); @@ -202,13 +190,13 @@ pub struct GPSTimeSec { } impl GPSTimeSec { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(GPSTimeSec { tow: _buf.read_u32::()?, wn: _buf.read_u16::()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(GPSTimeSec::parse(buf)?); @@ -216,10 +204,7 @@ impl GPSTimeSec { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(GPSTimeSec::parse(buf)?); @@ -248,14 +233,14 @@ pub struct GPSTime { } impl GPSTime { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(GPSTime { tow: _buf.read_u32::()?, ns_residual: _buf.read_i32::()?, wn: _buf.read_u16::()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(GPSTime::parse(buf)?); @@ -263,10 +248,7 @@ impl GPSTime { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(GPSTime::parse(buf)?); @@ -292,13 +274,13 @@ pub struct CarrierPhase { } impl CarrierPhase { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(CarrierPhase { i: _buf.read_i32::()?, f: _buf.read_u8()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(CarrierPhase::parse(buf)?); @@ -306,10 +288,7 @@ impl CarrierPhase { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(CarrierPhase::parse(buf)?); diff --git a/rust/sbp/src/messages/imu.rs b/rust/sbp/src/messages/imu.rs index 1e8541bbc9..c7438cd76c 100644 --- a/rust/sbp/src/messages/imu.rs +++ b/rust/sbp/src/messages/imu.rs @@ -48,7 +48,7 @@ pub struct MsgImuRaw { } impl MsgImuRaw { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgImuRaw { sender_id: None, tow: _buf.read_u32::()?, @@ -93,7 +93,7 @@ pub struct MsgImuAux { } impl MsgImuAux { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgImuAux { sender_id: None, imu_type: _buf.read_u8()?, diff --git a/rust/sbp/src/messages/linux.rs b/rust/sbp/src/messages/linux.rs index 8e36750a11..12515efc75 100644 --- a/rust/sbp/src/messages/linux.rs +++ b/rust/sbp/src/messages/linux.rs @@ -39,7 +39,7 @@ pub struct MsgLinuxCpuState { } impl MsgLinuxCpuState { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLinuxCpuState { sender_id: None, index: _buf.read_u8()?, @@ -84,7 +84,7 @@ pub struct MsgLinuxMemState { } impl MsgLinuxMemState { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLinuxMemState { sender_id: None, index: _buf.read_u8()?, @@ -130,7 +130,7 @@ pub struct MsgLinuxSysState { } impl MsgLinuxSysState { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLinuxSysState { sender_id: None, mem_total: _buf.read_u16::()?, @@ -181,7 +181,7 @@ pub struct MsgLinuxProcessSocketCounts { } impl MsgLinuxProcessSocketCounts { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLinuxProcessSocketCounts { sender_id: None, index: _buf.read_u8()?, @@ -237,7 +237,7 @@ pub struct MsgLinuxProcessSocketQueues { } impl MsgLinuxProcessSocketQueues { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLinuxProcessSocketQueues { sender_id: None, index: _buf.read_u8()?, @@ -286,7 +286,7 @@ pub struct MsgLinuxSocketUsage { } impl MsgLinuxSocketUsage { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLinuxSocketUsage { sender_id: None, avg_queue_depth: _buf.read_u32::()?, @@ -327,7 +327,7 @@ pub struct MsgLinuxProcessFdCount { } impl MsgLinuxProcessFdCount { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLinuxProcessFdCount { sender_id: None, index: _buf.read_u8()?, @@ -368,7 +368,7 @@ pub struct MsgLinuxProcessFdSummary { } impl MsgLinuxProcessFdSummary { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLinuxProcessFdSummary { sender_id: None, sys_fd_count: _buf.read_u32::()?, diff --git a/rust/sbp/src/messages/logging.rs b/rust/sbp/src/messages/logging.rs index 60a5d391a1..03a45d0d2a 100644 --- a/rust/sbp/src/messages/logging.rs +++ b/rust/sbp/src/messages/logging.rs @@ -34,7 +34,7 @@ pub struct MsgLog { } impl MsgLog { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgLog { sender_id: None, level: _buf.read_u8()?, @@ -77,7 +77,7 @@ pub struct MsgFwd { } impl MsgFwd { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFwd { sender_id: None, source: _buf.read_u8()?, @@ -111,7 +111,7 @@ pub struct MsgPrintDep { } impl MsgPrintDep { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgPrintDep { sender_id: None, text: ::parser::read_string(_buf)?, diff --git a/rust/sbp/src/messages/mag.rs b/rust/sbp/src/messages/mag.rs index 3f6a91e8fc..d742703c45 100644 --- a/rust/sbp/src/messages/mag.rs +++ b/rust/sbp/src/messages/mag.rs @@ -39,7 +39,7 @@ pub struct MsgMagRaw { } impl MsgMagRaw { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgMagRaw { sender_id: None, tow: _buf.read_u32::()?, diff --git a/rust/sbp/src/messages/mod.rs b/rust/sbp/src/messages/mod.rs index 6cf1c19419..f8715d9b1e 100644 --- a/rust/sbp/src/messages/mod.rs +++ b/rust/sbp/src/messages/mod.rs @@ -217,6 +217,42 @@ pub enum SBP { sender_id: u16, payload: Vec, }, + MsgEphemerisGloDepC(MsgEphemerisGloDepC), + MsgEphemerisGloDepD(MsgEphemerisGloDepD), + MsgEphemerisGlo(MsgEphemerisGlo), + MsgEphemerisDepD(MsgEphemerisDepD), + MsgEphemerisDepA(MsgEphemerisDepA), + MsgEphemerisDepB(MsgEphemerisDepB), + MsgEphemerisDepC(MsgEphemerisDepC), + MsgObsDepA(MsgObsDepA), + MsgObsDepB(MsgObsDepB), + MsgObsDepC(MsgObsDepC), + MsgIono(MsgIono), + MsgSvConfigurationGPSDep(MsgSvConfigurationGPSDep), + MsgGnssCapb(MsgGnssCapb), + MsgGroupDelayDepA(MsgGroupDelayDepA), + MsgGroupDelayDepB(MsgGroupDelayDepB), + MsgGroupDelay(MsgGroupDelay), + MsgAlmanacGPSDep(MsgAlmanacGPSDep), + MsgAlmanacGPS(MsgAlmanacGPS), + MsgAlmanacGloDep(MsgAlmanacGloDep), + MsgAlmanacGlo(MsgAlmanacGlo), + MsgGloBiases(MsgGloBiases), + MsgSvAzEl(MsgSvAzEl), + MsgOsr(MsgOsr), + MsgGPSTime(MsgGPSTime), + MsgUtcTime(MsgUtcTime), + MsgDops(MsgDops), + MsgPosECEF(MsgPosECEF), + MsgPosECEFCov(MsgPosECEFCov), + MsgPosLLH(MsgPosLLH), + MsgPosLLHCov(MsgPosLLHCov), + MsgBaselineECEF(MsgBaselineECEF), + MsgBaselineNED(MsgBaselineNED), + MsgVelECEF(MsgVelECEF), + MsgVelECEFCov(MsgVelECEFCov), + MsgVelNED(MsgVelNED), + MsgVelNEDCov(MsgVelNEDCov), MsgVelBody(MsgVelBody), MsgAgeCorrections(MsgAgeCorrections), MsgGPSTimeDepA(MsgGPSTimeDepA), @@ -228,66 +264,82 @@ pub enum SBP { MsgVelECEFDepA(MsgVelECEFDepA), MsgVelNEDDepA(MsgVelNEDDepA), MsgBaselineHeadingDepA(MsgBaselineHeadingDepA), - MsgSsrOrbitClock(MsgSsrOrbitClock), - MsgSsrOrbitClockDepA(MsgSsrOrbitClockDepA), - MsgSsrCodeBiases(MsgSsrCodeBiases), - MsgSsrPhaseBiases(MsgSsrPhaseBiases), - MsgSsrStecCorrection(MsgSsrStecCorrection), - MsgSsrGriddedCorrection(MsgSsrGriddedCorrection), - MsgSsrGridDefinition(MsgSsrGridDefinition), - MsgMagRaw(MsgMagRaw), - MsgNdbEvent(MsgNdbEvent), + MsgOdometry(MsgOdometry), + MsgFileioReadDirResp(MsgFileioReadDirResp), + MsgFileioReadReq(MsgFileioReadReq), + MsgFileioReadResp(MsgFileioReadResp), + MsgFileioReadDirReq(MsgFileioReadDirReq), + MsgFileioRemove(MsgFileioRemove), + MsgFileioWriteReq(MsgFileioWriteReq), + MsgFileioWriteResp(MsgFileioWriteResp), + MsgFileioConfigReq(MsgFileioConfigReq), + MsgFileioConfigResp(MsgFileioConfigResp), MsgBaselineHeading(MsgBaselineHeading), MsgOrientQuat(MsgOrientQuat), MsgOrientEuler(MsgOrientEuler), MsgAngularRate(MsgAngularRate), - MsgObs(MsgObs), - MsgBasePosLLH(MsgBasePosLLH), - MsgBasePosECEF(MsgBasePosECEF), - MsgEphemerisGPSDepF(MsgEphemerisGPSDepF), - MsgEphemerisGPS(MsgEphemerisGPS), - MsgEphemerisGPSDepE(MsgEphemerisGPSDepE), - MsgEphemerisQzss(MsgEphemerisQzss), - MsgEphemerisBds(MsgEphemerisBds), - MsgLinuxProcessSocketQueues(MsgLinuxProcessSocketQueues), - MsgLinuxSocketUsage(MsgLinuxSocketUsage), - MsgLinuxProcessFdCount(MsgLinuxProcessFdCount), - MsgLinuxProcessFdSummary(MsgLinuxProcessFdSummary), - MsgUserData(MsgUserData), - MsgGPSTime(MsgGPSTime), - MsgUtcTime(MsgUtcTime), - MsgDops(MsgDops), - MsgPosECEF(MsgPosECEF), - MsgPosECEFCov(MsgPosECEFCov), - MsgPosLLH(MsgPosLLH), - MsgPosLLHCov(MsgPosLLHCov), - MsgBaselineECEF(MsgBaselineECEF), - MsgBaselineNED(MsgBaselineNED), - MsgVelECEF(MsgVelECEF), - MsgVelECEFCov(MsgVelECEFCov), - MsgVelNED(MsgVelNED), - MsgVelNEDCov(MsgVelNEDCov), - MsgCommandResp(MsgCommandResp), - MsgCommandOutput(MsgCommandOutput), - MsgNetworkStateReq(MsgNetworkStateReq), - MsgNetworkStateResp(MsgNetworkStateResp), - MsgNetworkBandwidthUsage(MsgNetworkBandwidthUsage), - MsgCellModemStatus(MsgCellModemStatus), - MsgSpecanDep(MsgSpecanDep), - MsgSpecan(MsgSpecan), - MsgFrontEndGain(MsgFrontEndGain), MsgStartup(MsgStartup), MsgDgnssStatus(MsgDgnssStatus), MsgHeartbeat(MsgHeartbeat), MsgInsStatus(MsgInsStatus), MsgCsacTelemetry(MsgCsacTelemetry), MsgCsacTelemetryLabels(MsgCsacTelemetryLabels), + MsgImuRaw(MsgImuRaw), + MsgImuAux(MsgImuAux), MsgBootloaderHandshakeReq(MsgBootloaderHandshakeReq), MsgBootloaderHandshakeResp(MsgBootloaderHandshakeResp), MsgBootloaderJumpToApp(MsgBootloaderJumpToApp), MsgNapDeviceDnaReq(MsgNapDeviceDnaReq), MsgNapDeviceDnaResp(MsgNapDeviceDnaResp), MsgBootloaderHandshakeDepA(MsgBootloaderHandshakeDepA), + MsgSbasRaw(MsgSbasRaw), + MsgObs(MsgObs), + MsgBasePosLLH(MsgBasePosLLH), + MsgBasePosECEF(MsgBasePosECEF), + MsgEphemerisGPSDepE(MsgEphemerisGPSDepE), + MsgEphemerisGPSDepF(MsgEphemerisGPSDepF), + MsgEphemerisGPS(MsgEphemerisGPS), + MsgSsrOrbitClock(MsgSsrOrbitClock), + MsgTrackingIqDepA(MsgTrackingIqDepA), + MsgTrackingStateDepA(MsgTrackingStateDepA), + MsgTrackingStateDepB(MsgTrackingStateDepB), + MsgSsrOrbitClockDepA(MsgSsrOrbitClockDepA), + MsgSsrCodeBiases(MsgSsrCodeBiases), + MsgSsrPhaseBiases(MsgSsrPhaseBiases), + MsgSsrStecCorrection(MsgSsrStecCorrection), + MsgSsrGriddedCorrection(MsgSsrGriddedCorrection), + MsgSsrGridDefinition(MsgSsrGridDefinition), + MsgMagRaw(MsgMagRaw), + MsgAlmanac(MsgAlmanac), + MsgSetTime(MsgSetTime), + MsgReset(MsgReset), + MsgResetDep(MsgResetDep), + MsgCwResults(MsgCwResults), + MsgCwStart(MsgCwStart), + MsgResetFilters(MsgResetFilters), + MsgInitBaseDep(MsgInitBaseDep), + MsgThreadState(MsgThreadState), + MsgEphemerisQzss(MsgEphemerisQzss), + MsgEphemerisBds(MsgEphemerisBds), + MsgEphemerisGalDepA(MsgEphemerisGalDepA), + MsgEphemerisGal(MsgEphemerisGal), + MsgEphemerisSbasDepA(MsgEphemerisSbasDepA), + MsgEphemerisGloDepA(MsgEphemerisGloDepA), + MsgEphemerisSbasDepB(MsgEphemerisSbasDepB), + MsgEphemerisSbas(MsgEphemerisSbas), + MsgEphemerisGloDepB(MsgEphemerisGloDepB), + MsgLog(MsgLog), + MsgAcqSvProfile(MsgAcqSvProfile), + MsgAcqSvProfileDep(MsgAcqSvProfileDep), + MsgFwd(MsgFwd), + MsgPrintDep(MsgPrintDep), + MsgNdbEvent(MsgNdbEvent), + MsgTrackingStateDetailedDepA(MsgTrackingStateDetailedDepA), + MsgTrackingStateDetailedDep(MsgTrackingStateDetailedDep), + MsgMeasurementState(MsgMeasurementState), + MsgTrackingIq(MsgTrackingIq), + MsgTrackingState(MsgTrackingState), + MsgTrackingIqDepB(MsgTrackingIqDepB), MsgSettingsSave(MsgSettingsSave), MsgSettingsWrite(MsgSettingsWrite), MsgSettingsWriteResp(MsgSettingsWriteResp), @@ -298,48 +350,12 @@ pub enum SBP { MsgSettingsReadByIndexDone(MsgSettingsReadByIndexDone), MsgSettingsRegister(MsgSettingsRegister), MsgSettingsRegisterResp(MsgSettingsRegisterResp), - MsgLog(MsgLog), - MsgFwd(MsgFwd), - MsgPrintDep(MsgPrintDep), - MsgFileioReadReq(MsgFileioReadReq), - MsgFileioReadResp(MsgFileioReadResp), - MsgFileioReadDirReq(MsgFileioReadDirReq), - MsgFileioReadDirResp(MsgFileioReadDirResp), - MsgFileioRemove(MsgFileioRemove), - MsgFileioWriteReq(MsgFileioWriteReq), - MsgFileioWriteResp(MsgFileioWriteResp), - MsgFileioConfigReq(MsgFileioConfigReq), - MsgFileioConfigResp(MsgFileioConfigResp), - MsgLinuxCpuState(MsgLinuxCpuState), - MsgLinuxMemState(MsgLinuxMemState), - MsgLinuxSysState(MsgLinuxSysState), - MsgLinuxProcessSocketCounts(MsgLinuxProcessSocketCounts), - MsgTrackingStateDetailedDep(MsgTrackingStateDetailedDep), - MsgTrackingState(MsgTrackingState), - MsgMeasurementState(MsgMeasurementState), - MsgTrackingIq(MsgTrackingIq), - MsgTrackingIqDepB(MsgTrackingIqDepB), - MsgTrackingIqDepA(MsgTrackingIqDepA), - MsgTrackingStateDepA(MsgTrackingStateDepA), - MsgTrackingStateDepB(MsgTrackingStateDepB), - MsgExtEvent(MsgExtEvent), - MsgSbasRaw(MsgSbasRaw), + MsgUserData(MsgUserData), MsgAcqResult(MsgAcqResult), + MsgExtEvent(MsgExtEvent), MsgAcqResultDepC(MsgAcqResultDepC), MsgAcqResultDepB(MsgAcqResultDepB), MsgAcqResultDepA(MsgAcqResultDepA), - MsgAcqSvProfile(MsgAcqSvProfile), - MsgAcqSvProfileDep(MsgAcqSvProfileDep), - MsgOdometry(MsgOdometry), - MsgAlmanac(MsgAlmanac), - MsgSetTime(MsgSetTime), - MsgReset(MsgReset), - MsgResetDep(MsgResetDep), - MsgCwResults(MsgCwResults), - MsgCwStart(MsgCwStart), - MsgResetFilters(MsgResetFilters), - MsgInitBaseDep(MsgInitBaseDep), - MsgThreadState(MsgThreadState), MsgUartState(MsgUartState), MsgUartStateDepa(MsgUartStateDepa), MsgIarState(MsgIarState), @@ -347,17 +363,23 @@ pub enum SBP { MsgMaskSatelliteDep(MsgMaskSatelliteDep), MsgDeviceMonitor(MsgDeviceMonitor), MsgCommandReq(MsgCommandReq), - MsgGroupDelayDepB(MsgGroupDelayDepB), - MsgGroupDelay(MsgGroupDelay), - MsgAlmanacGPSDep(MsgAlmanacGPSDep), - MsgAlmanacGPS(MsgAlmanacGPS), - MsgAlmanacGloDep(MsgAlmanacGloDep), - MsgAlmanacGlo(MsgAlmanacGlo), - MsgGloBiases(MsgGloBiases), - MsgSvAzEl(MsgSvAzEl), - MsgOsr(MsgOsr), - MsgImuRaw(MsgImuRaw), - MsgImuAux(MsgImuAux), + MsgCommandResp(MsgCommandResp), + MsgCommandOutput(MsgCommandOutput), + MsgNetworkStateReq(MsgNetworkStateReq), + MsgNetworkStateResp(MsgNetworkStateResp), + MsgNetworkBandwidthUsage(MsgNetworkBandwidthUsage), + MsgCellModemStatus(MsgCellModemStatus), + MsgSpecanDep(MsgSpecanDep), + MsgSpecan(MsgSpecan), + MsgFrontEndGain(MsgFrontEndGain), + MsgLinuxCpuState(MsgLinuxCpuState), + MsgLinuxMemState(MsgLinuxMemState), + MsgLinuxSysState(MsgLinuxSysState), + MsgLinuxProcessSocketCounts(MsgLinuxProcessSocketCounts), + MsgLinuxProcessSocketQueues(MsgLinuxProcessSocketQueues), + MsgLinuxSocketUsage(MsgLinuxSocketUsage), + MsgLinuxProcessFdCount(MsgLinuxProcessFdCount), + MsgLinuxProcessFdSummary(MsgLinuxProcessFdSummary), MsgFlashProgram(MsgFlashProgram), MsgFlashDone(MsgFlashDone), MsgFlashReadReq(MsgFlashReadReq), @@ -368,217 +390,125 @@ pub enum SBP { MsgStmUniqueIdReq(MsgStmUniqueIdReq), MsgStmUniqueIdResp(MsgStmUniqueIdResp), MsgM25FlashWriteStatus(MsgM25FlashWriteStatus), - MsgTrackingStateDetailedDepA(MsgTrackingStateDetailedDepA), - MsgEphemerisDepD(MsgEphemerisDepD), - MsgEphemerisDepA(MsgEphemerisDepA), - MsgEphemerisDepB(MsgEphemerisDepB), - MsgEphemerisDepC(MsgEphemerisDepC), - MsgObsDepA(MsgObsDepA), - MsgObsDepB(MsgObsDepB), - MsgObsDepC(MsgObsDepC), - MsgIono(MsgIono), - MsgSvConfigurationGPSDep(MsgSvConfigurationGPSDep), - MsgGnssCapb(MsgGnssCapb), - MsgGroupDelayDepA(MsgGroupDelayDepA), - MsgEphemerisGalDepA(MsgEphemerisGalDepA), - MsgEphemerisGal(MsgEphemerisGal), - MsgEphemerisSbasDepA(MsgEphemerisSbasDepA), - MsgEphemerisGloDepA(MsgEphemerisGloDepA), - MsgEphemerisSbasDepB(MsgEphemerisSbasDepB), - MsgEphemerisSbas(MsgEphemerisSbas), - MsgEphemerisGloDepB(MsgEphemerisGloDepB), - MsgEphemerisGloDepC(MsgEphemerisGloDepC), - MsgEphemerisGloDepD(MsgEphemerisGloDepD), - MsgEphemerisGlo(MsgEphemerisGlo), } impl SBP { pub fn parse(msg_id: u16, sender_id: u16, payload: &mut &[u8]) -> Result { let x: Result = match msg_id { - 531 => { - let mut msg = MsgVelBody::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgVelBody(msg)) - } - 528 => { - let mut msg = MsgAgeCorrections::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgAgeCorrections(msg)) - } - 256 => { - let mut msg = MsgGPSTimeDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgGPSTimeDepA(msg)) - } - 518 => { - let mut msg = MsgDopsDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgDopsDepA(msg)) - } - 512 => { - let mut msg = MsgPosECEFDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgPosECEFDepA(msg)) - } - 513 => { - let mut msg = MsgPosLLHDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgPosLLHDepA(msg)) - } - 514 => { - let mut msg = MsgBaselineECEFDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineECEFDepA(msg)) - } - 515 => { - let mut msg = MsgBaselineNEDDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineNEDDepA(msg)) - } - 516 => { - let mut msg = MsgVelECEFDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgVelECEFDepA(msg)) - } - 517 => { - let mut msg = MsgVelNEDDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgVelNEDDepA(msg)) - } - 519 => { - let mut msg = MsgBaselineHeadingDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineHeadingDepA(msg)) - } - 1501 => { - let mut msg = MsgSsrOrbitClock::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrOrbitClock(msg)) - } - 1500 => { - let mut msg = MsgSsrOrbitClockDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrOrbitClockDepA(msg)) - } - 1505 => { - let mut msg = MsgSsrCodeBiases::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrCodeBiases(msg)) - } - 1510 => { - let mut msg = MsgSsrPhaseBiases::parse(payload)?; + 135 => { + let mut msg = MsgEphemerisGloDepC::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrPhaseBiases(msg)) + Ok(SBP::MsgEphemerisGloDepC(msg)) } - 1515 => { - let mut msg = MsgSsrStecCorrection::parse(payload)?; + 136 => { + let mut msg = MsgEphemerisGloDepD::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrStecCorrection(msg)) + Ok(SBP::MsgEphemerisGloDepD(msg)) } - 1520 => { - let mut msg = MsgSsrGriddedCorrection::parse(payload)?; + 139 => { + let mut msg = MsgEphemerisGlo::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrGriddedCorrection(msg)) + Ok(SBP::MsgEphemerisGlo(msg)) } - 1525 => { - let mut msg = MsgSsrGridDefinition::parse(payload)?; + 128 => { + let mut msg = MsgEphemerisDepD::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrGridDefinition(msg)) + Ok(SBP::MsgEphemerisDepD(msg)) } - 2306 => { - let mut msg = MsgMagRaw::parse(payload)?; + 26 => { + let mut msg = MsgEphemerisDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgMagRaw(msg)) + Ok(SBP::MsgEphemerisDepA(msg)) } - 1024 => { - let mut msg = MsgNdbEvent::parse(payload)?; + 70 => { + let mut msg = MsgEphemerisDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNdbEvent(msg)) + Ok(SBP::MsgEphemerisDepB(msg)) } - 527 => { - let mut msg = MsgBaselineHeading::parse(payload)?; + 71 => { + let mut msg = MsgEphemerisDepC::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineHeading(msg)) + Ok(SBP::MsgEphemerisDepC(msg)) } - 544 => { - let mut msg = MsgOrientQuat::parse(payload)?; + 69 => { + let mut msg = MsgObsDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgOrientQuat(msg)) + Ok(SBP::MsgObsDepA(msg)) } - 545 => { - let mut msg = MsgOrientEuler::parse(payload)?; + 67 => { + let mut msg = MsgObsDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgOrientEuler(msg)) + Ok(SBP::MsgObsDepB(msg)) } - 546 => { - let mut msg = MsgAngularRate::parse(payload)?; + 73 => { + let mut msg = MsgObsDepC::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAngularRate(msg)) + Ok(SBP::MsgObsDepC(msg)) } - 74 => { - let mut msg = MsgObs::parse(payload)?; + 144 => { + let mut msg = MsgIono::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgObs(msg)) + Ok(SBP::MsgIono(msg)) } - 68 => { - let mut msg = MsgBasePosLLH::parse(payload)?; + 145 => { + let mut msg = MsgSvConfigurationGPSDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBasePosLLH(msg)) + Ok(SBP::MsgSvConfigurationGPSDep(msg)) } - 72 => { - let mut msg = MsgBasePosECEF::parse(payload)?; + 150 => { + let mut msg = MsgGnssCapb::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBasePosECEF(msg)) + Ok(SBP::MsgGnssCapb(msg)) } - 134 => { - let mut msg = MsgEphemerisGPSDepF::parse(payload)?; + 146 => { + let mut msg = MsgGroupDelayDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGPSDepF(msg)) + Ok(SBP::MsgGroupDelayDepA(msg)) } - 138 => { - let mut msg = MsgEphemerisGPS::parse(payload)?; + 147 => { + let mut msg = MsgGroupDelayDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGPS(msg)) + Ok(SBP::MsgGroupDelayDepB(msg)) } - 129 => { - let mut msg = MsgEphemerisGPSDepE::parse(payload)?; + 148 => { + let mut msg = MsgGroupDelay::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGPSDepE(msg)) + Ok(SBP::MsgGroupDelay(msg)) } - 142 => { - let mut msg = MsgEphemerisQzss::parse(payload)?; + 112 => { + let mut msg = MsgAlmanacGPSDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisQzss(msg)) + Ok(SBP::MsgAlmanacGPSDep(msg)) } - 137 => { - let mut msg = MsgEphemerisBds::parse(payload)?; + 114 => { + let mut msg = MsgAlmanacGPS::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisBds(msg)) + Ok(SBP::MsgAlmanacGPS(msg)) } - 32516 => { - let mut msg = MsgLinuxProcessSocketQueues::parse(payload)?; + 113 => { + let mut msg = MsgAlmanacGloDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxProcessSocketQueues(msg)) + Ok(SBP::MsgAlmanacGloDep(msg)) } - 32517 => { - let mut msg = MsgLinuxSocketUsage::parse(payload)?; + 115 => { + let mut msg = MsgAlmanacGlo::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxSocketUsage(msg)) + Ok(SBP::MsgAlmanacGlo(msg)) } - 32518 => { - let mut msg = MsgLinuxProcessFdCount::parse(payload)?; + 117 => { + let mut msg = MsgGloBiases::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxProcessFdCount(msg)) + Ok(SBP::MsgGloBiases(msg)) } - 32519 => { - let mut msg = MsgLinuxProcessFdSummary::parse(payload)?; + 151 => { + let mut msg = MsgSvAzEl::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxProcessFdSummary(msg)) + Ok(SBP::MsgSvAzEl(msg)) } - 2048 => { - let mut msg = MsgUserData::parse(payload)?; + 1600 => { + let mut msg = MsgOsr::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgUserData(msg)) + Ok(SBP::MsgOsr(msg)) } 258 => { let mut msg = MsgGPSTime::parse(payload)?; @@ -645,50 +575,130 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgVelNEDCov(msg)) } - 185 => { - let mut msg = MsgCommandResp::parse(payload)?; + 531 => { + let mut msg = MsgVelBody::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCommandResp(msg)) + Ok(SBP::MsgVelBody(msg)) } - 188 => { - let mut msg = MsgCommandOutput::parse(payload)?; + 528 => { + let mut msg = MsgAgeCorrections::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCommandOutput(msg)) + Ok(SBP::MsgAgeCorrections(msg)) } - 186 => { - let mut msg = MsgNetworkStateReq::parse(payload)?; + 256 => { + let mut msg = MsgGPSTimeDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNetworkStateReq(msg)) + Ok(SBP::MsgGPSTimeDepA(msg)) } - 187 => { - let mut msg = MsgNetworkStateResp::parse(payload)?; + 518 => { + let mut msg = MsgDopsDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNetworkStateResp(msg)) + Ok(SBP::MsgDopsDepA(msg)) } - 189 => { - let mut msg = MsgNetworkBandwidthUsage::parse(payload)?; + 512 => { + let mut msg = MsgPosECEFDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNetworkBandwidthUsage(msg)) + Ok(SBP::MsgPosECEFDepA(msg)) } - 190 => { - let mut msg = MsgCellModemStatus::parse(payload)?; + 513 => { + let mut msg = MsgPosLLHDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCellModemStatus(msg)) + Ok(SBP::MsgPosLLHDepA(msg)) } - 80 => { - let mut msg = MsgSpecanDep::parse(payload)?; + 514 => { + let mut msg = MsgBaselineECEFDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSpecanDep(msg)) + Ok(SBP::MsgBaselineECEFDepA(msg)) } - 81 => { - let mut msg = MsgSpecan::parse(payload)?; + 515 => { + let mut msg = MsgBaselineNEDDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSpecan(msg)) + Ok(SBP::MsgBaselineNEDDepA(msg)) } - 191 => { - let mut msg = MsgFrontEndGain::parse(payload)?; + 516 => { + let mut msg = MsgVelECEFDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFrontEndGain(msg)) + Ok(SBP::MsgVelECEFDepA(msg)) + } + 517 => { + let mut msg = MsgVelNEDDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgVelNEDDepA(msg)) + } + 519 => { + let mut msg = MsgBaselineHeadingDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBaselineHeadingDepA(msg)) + } + 2307 => { + let mut msg = MsgOdometry::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgOdometry(msg)) + } + 170 => { + let mut msg = MsgFileioReadDirResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadDirResp(msg)) + } + 168 => { + let mut msg = MsgFileioReadReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadReq(msg)) + } + 163 => { + let mut msg = MsgFileioReadResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadResp(msg)) + } + 169 => { + let mut msg = MsgFileioReadDirReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadDirReq(msg)) + } + 172 => { + let mut msg = MsgFileioRemove::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioRemove(msg)) + } + 173 => { + let mut msg = MsgFileioWriteReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioWriteReq(msg)) + } + 171 => { + let mut msg = MsgFileioWriteResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioWriteResp(msg)) + } + 4097 => { + let mut msg = MsgFileioConfigReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioConfigReq(msg)) + } + 4098 => { + let mut msg = MsgFileioConfigResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioConfigResp(msg)) + } + 527 => { + let mut msg = MsgBaselineHeading::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBaselineHeading(msg)) + } + 544 => { + let mut msg = MsgOrientQuat::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgOrientQuat(msg)) + } + 545 => { + let mut msg = MsgOrientEuler::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgOrientEuler(msg)) + } + 546 => { + let mut msg = MsgAngularRate::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAngularRate(msg)) } 65280 => { let mut msg = MsgStartup::parse(payload)?; @@ -720,6 +730,16 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgCsacTelemetryLabels(msg)) } + 2304 => { + let mut msg = MsgImuRaw::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgImuRaw(msg)) + } + 2305 => { + let mut msg = MsgImuAux::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgImuAux(msg)) + } 179 => { let mut msg = MsgBootloaderHandshakeReq::parse(payload)?; msg.set_sender_id(sender_id); @@ -735,161 +755,241 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgBootloaderJumpToApp(msg)) } - 222 => { - let mut msg = MsgNapDeviceDnaReq::parse(payload)?; + 222 => { + let mut msg = MsgNapDeviceDnaReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgNapDeviceDnaReq(msg)) + } + 221 => { + let mut msg = MsgNapDeviceDnaResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgNapDeviceDnaResp(msg)) + } + 176 => { + let mut msg = MsgBootloaderHandshakeDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBootloaderHandshakeDepA(msg)) + } + 30583 => { + let mut msg = MsgSbasRaw::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSbasRaw(msg)) + } + 74 => { + let mut msg = MsgObs::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgObs(msg)) + } + 68 => { + let mut msg = MsgBasePosLLH::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBasePosLLH(msg)) + } + 72 => { + let mut msg = MsgBasePosECEF::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBasePosECEF(msg)) + } + 129 => { + let mut msg = MsgEphemerisGPSDepE::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGPSDepE(msg)) + } + 134 => { + let mut msg = MsgEphemerisGPSDepF::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGPSDepF(msg)) + } + 138 => { + let mut msg = MsgEphemerisGPS::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGPS(msg)) + } + 1501 => { + let mut msg = MsgSsrOrbitClock::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrOrbitClock(msg)) + } + 28 => { + let mut msg = MsgTrackingIqDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingIqDepA(msg)) + } + 22 => { + let mut msg = MsgTrackingStateDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingStateDepA(msg)) + } + 19 => { + let mut msg = MsgTrackingStateDepB::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingStateDepB(msg)) + } + 1500 => { + let mut msg = MsgSsrOrbitClockDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrOrbitClockDepA(msg)) + } + 1505 => { + let mut msg = MsgSsrCodeBiases::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrCodeBiases(msg)) + } + 1510 => { + let mut msg = MsgSsrPhaseBiases::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSsrPhaseBiases(msg)) + } + 1515 => { + let mut msg = MsgSsrStecCorrection::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNapDeviceDnaReq(msg)) + Ok(SBP::MsgSsrStecCorrection(msg)) } - 221 => { - let mut msg = MsgNapDeviceDnaResp::parse(payload)?; + 1520 => { + let mut msg = MsgSsrGriddedCorrection::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNapDeviceDnaResp(msg)) + Ok(SBP::MsgSsrGriddedCorrection(msg)) } - 176 => { - let mut msg = MsgBootloaderHandshakeDepA::parse(payload)?; + 1525 => { + let mut msg = MsgSsrGridDefinition::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBootloaderHandshakeDepA(msg)) + Ok(SBP::MsgSsrGridDefinition(msg)) } - 161 => { - let mut msg = MsgSettingsSave::parse(payload)?; + 2306 => { + let mut msg = MsgMagRaw::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsSave(msg)) + Ok(SBP::MsgMagRaw(msg)) } - 160 => { - let mut msg = MsgSettingsWrite::parse(payload)?; + 105 => { + let mut msg = MsgAlmanac::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsWrite(msg)) + Ok(SBP::MsgAlmanac(msg)) } - 175 => { - let mut msg = MsgSettingsWriteResp::parse(payload)?; + 104 => { + let mut msg = MsgSetTime::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsWriteResp(msg)) + Ok(SBP::MsgSetTime(msg)) } - 164 => { - let mut msg = MsgSettingsReadReq::parse(payload)?; + 182 => { + let mut msg = MsgReset::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsReadReq(msg)) + Ok(SBP::MsgReset(msg)) } - 165 => { - let mut msg = MsgSettingsReadResp::parse(payload)?; + 178 => { + let mut msg = MsgResetDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsReadResp(msg)) + Ok(SBP::MsgResetDep(msg)) } - 162 => { - let mut msg = MsgSettingsReadByIndexReq::parse(payload)?; + 192 => { + let mut msg = MsgCwResults::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsReadByIndexReq(msg)) + Ok(SBP::MsgCwResults(msg)) } - 167 => { - let mut msg = MsgSettingsReadByIndexResp::parse(payload)?; + 193 => { + let mut msg = MsgCwStart::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsReadByIndexResp(msg)) + Ok(SBP::MsgCwStart(msg)) } - 166 => { - let mut msg = MsgSettingsReadByIndexDone::parse(payload)?; + 34 => { + let mut msg = MsgResetFilters::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsReadByIndexDone(msg)) + Ok(SBP::MsgResetFilters(msg)) } - 174 => { - let mut msg = MsgSettingsRegister::parse(payload)?; + 35 => { + let mut msg = MsgInitBaseDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsRegister(msg)) + Ok(SBP::MsgInitBaseDep(msg)) } - 431 => { - let mut msg = MsgSettingsRegisterResp::parse(payload)?; + 23 => { + let mut msg = MsgThreadState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsRegisterResp(msg)) + Ok(SBP::MsgThreadState(msg)) } - 1025 => { - let mut msg = MsgLog::parse(payload)?; + 142 => { + let mut msg = MsgEphemerisQzss::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLog(msg)) + Ok(SBP::MsgEphemerisQzss(msg)) } - 1026 => { - let mut msg = MsgFwd::parse(payload)?; + 137 => { + let mut msg = MsgEphemerisBds::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFwd(msg)) + Ok(SBP::MsgEphemerisBds(msg)) } - 16 => { - let mut msg = MsgPrintDep::parse(payload)?; + 149 => { + let mut msg = MsgEphemerisGalDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPrintDep(msg)) + Ok(SBP::MsgEphemerisGalDepA(msg)) } - 168 => { - let mut msg = MsgFileioReadReq::parse(payload)?; + 141 => { + let mut msg = MsgEphemerisGal::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioReadReq(msg)) + Ok(SBP::MsgEphemerisGal(msg)) } - 163 => { - let mut msg = MsgFileioReadResp::parse(payload)?; + 130 => { + let mut msg = MsgEphemerisSbasDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioReadResp(msg)) + Ok(SBP::MsgEphemerisSbasDepA(msg)) } - 169 => { - let mut msg = MsgFileioReadDirReq::parse(payload)?; + 131 => { + let mut msg = MsgEphemerisGloDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioReadDirReq(msg)) + Ok(SBP::MsgEphemerisGloDepA(msg)) } - 170 => { - let mut msg = MsgFileioReadDirResp::parse(payload)?; + 132 => { + let mut msg = MsgEphemerisSbasDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioReadDirResp(msg)) + Ok(SBP::MsgEphemerisSbasDepB(msg)) } - 172 => { - let mut msg = MsgFileioRemove::parse(payload)?; + 140 => { + let mut msg = MsgEphemerisSbas::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioRemove(msg)) + Ok(SBP::MsgEphemerisSbas(msg)) } - 173 => { - let mut msg = MsgFileioWriteReq::parse(payload)?; + 133 => { + let mut msg = MsgEphemerisGloDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioWriteReq(msg)) + Ok(SBP::MsgEphemerisGloDepB(msg)) } - 171 => { - let mut msg = MsgFileioWriteResp::parse(payload)?; + 1025 => { + let mut msg = MsgLog::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioWriteResp(msg)) + Ok(SBP::MsgLog(msg)) } - 4097 => { - let mut msg = MsgFileioConfigReq::parse(payload)?; + 46 => { + let mut msg = MsgAcqSvProfile::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioConfigReq(msg)) + Ok(SBP::MsgAcqSvProfile(msg)) } - 4098 => { - let mut msg = MsgFileioConfigResp::parse(payload)?; + 30 => { + let mut msg = MsgAcqSvProfileDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioConfigResp(msg)) + Ok(SBP::MsgAcqSvProfileDep(msg)) } - 32512 => { - let mut msg = MsgLinuxCpuState::parse(payload)?; + 1026 => { + let mut msg = MsgFwd::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxCpuState(msg)) + Ok(SBP::MsgFwd(msg)) } - 32513 => { - let mut msg = MsgLinuxMemState::parse(payload)?; + 16 => { + let mut msg = MsgPrintDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxMemState(msg)) + Ok(SBP::MsgPrintDep(msg)) } - 32514 => { - let mut msg = MsgLinuxSysState::parse(payload)?; + 1024 => { + let mut msg = MsgNdbEvent::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxSysState(msg)) + Ok(SBP::MsgNdbEvent(msg)) } - 32515 => { - let mut msg = MsgLinuxProcessSocketCounts::parse(payload)?; + 33 => { + let mut msg = MsgTrackingStateDetailedDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxProcessSocketCounts(msg)) + Ok(SBP::MsgTrackingStateDetailedDepA(msg)) } 17 => { let mut msg = MsgTrackingStateDetailedDep::parse(payload)?; msg.set_sender_id(sender_id); Ok(SBP::MsgTrackingStateDetailedDep(msg)) } - 65 => { - let mut msg = MsgTrackingState::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingState(msg)) - } 97 => { let mut msg = MsgMeasurementState::parse(payload)?; msg.set_sender_id(sender_id); @@ -900,115 +1000,95 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgTrackingIq(msg)) } + 65 => { + let mut msg = MsgTrackingState::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgTrackingState(msg)) + } 44 => { let mut msg = MsgTrackingIqDepB::parse(payload)?; msg.set_sender_id(sender_id); Ok(SBP::MsgTrackingIqDepB(msg)) } - 28 => { - let mut msg = MsgTrackingIqDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingIqDepA(msg)) - } - 22 => { - let mut msg = MsgTrackingStateDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingStateDepA(msg)) - } - 19 => { - let mut msg = MsgTrackingStateDepB::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingStateDepB(msg)) - } - 257 => { - let mut msg = MsgExtEvent::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgExtEvent(msg)) - } - 30583 => { - let mut msg = MsgSbasRaw::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSbasRaw(msg)) - } - 47 => { - let mut msg = MsgAcqResult::parse(payload)?; + 161 => { + let mut msg = MsgSettingsSave::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqResult(msg)) + Ok(SBP::MsgSettingsSave(msg)) } - 31 => { - let mut msg = MsgAcqResultDepC::parse(payload)?; + 160 => { + let mut msg = MsgSettingsWrite::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqResultDepC(msg)) + Ok(SBP::MsgSettingsWrite(msg)) } - 20 => { - let mut msg = MsgAcqResultDepB::parse(payload)?; + 175 => { + let mut msg = MsgSettingsWriteResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqResultDepB(msg)) + Ok(SBP::MsgSettingsWriteResp(msg)) } - 21 => { - let mut msg = MsgAcqResultDepA::parse(payload)?; + 164 => { + let mut msg = MsgSettingsReadReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqResultDepA(msg)) + Ok(SBP::MsgSettingsReadReq(msg)) } - 46 => { - let mut msg = MsgAcqSvProfile::parse(payload)?; + 165 => { + let mut msg = MsgSettingsReadResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqSvProfile(msg)) + Ok(SBP::MsgSettingsReadResp(msg)) } - 30 => { - let mut msg = MsgAcqSvProfileDep::parse(payload)?; + 162 => { + let mut msg = MsgSettingsReadByIndexReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqSvProfileDep(msg)) + Ok(SBP::MsgSettingsReadByIndexReq(msg)) } - 2307 => { - let mut msg = MsgOdometry::parse(payload)?; + 167 => { + let mut msg = MsgSettingsReadByIndexResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgOdometry(msg)) + Ok(SBP::MsgSettingsReadByIndexResp(msg)) } - 105 => { - let mut msg = MsgAlmanac::parse(payload)?; + 166 => { + let mut msg = MsgSettingsReadByIndexDone::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanac(msg)) + Ok(SBP::MsgSettingsReadByIndexDone(msg)) } - 104 => { - let mut msg = MsgSetTime::parse(payload)?; + 174 => { + let mut msg = MsgSettingsRegister::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSetTime(msg)) + Ok(SBP::MsgSettingsRegister(msg)) } - 182 => { - let mut msg = MsgReset::parse(payload)?; + 431 => { + let mut msg = MsgSettingsRegisterResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgReset(msg)) + Ok(SBP::MsgSettingsRegisterResp(msg)) } - 178 => { - let mut msg = MsgResetDep::parse(payload)?; + 2048 => { + let mut msg = MsgUserData::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgResetDep(msg)) + Ok(SBP::MsgUserData(msg)) } - 192 => { - let mut msg = MsgCwResults::parse(payload)?; + 47 => { + let mut msg = MsgAcqResult::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCwResults(msg)) + Ok(SBP::MsgAcqResult(msg)) } - 193 => { - let mut msg = MsgCwStart::parse(payload)?; + 257 => { + let mut msg = MsgExtEvent::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCwStart(msg)) + Ok(SBP::MsgExtEvent(msg)) } - 34 => { - let mut msg = MsgResetFilters::parse(payload)?; + 31 => { + let mut msg = MsgAcqResultDepC::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgResetFilters(msg)) + Ok(SBP::MsgAcqResultDepC(msg)) } - 35 => { - let mut msg = MsgInitBaseDep::parse(payload)?; + 20 => { + let mut msg = MsgAcqResultDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgInitBaseDep(msg)) + Ok(SBP::MsgAcqResultDepB(msg)) } - 23 => { - let mut msg = MsgThreadState::parse(payload)?; + 21 => { + let mut msg = MsgAcqResultDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgThreadState(msg)) + Ok(SBP::MsgAcqResultDepA(msg)) } 29 => { let mut msg = MsgUartState::parse(payload)?; @@ -1045,60 +1125,90 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgCommandReq(msg)) } - 147 => { - let mut msg = MsgGroupDelayDepB::parse(payload)?; + 185 => { + let mut msg = MsgCommandResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgGroupDelayDepB(msg)) + Ok(SBP::MsgCommandResp(msg)) } - 148 => { - let mut msg = MsgGroupDelay::parse(payload)?; + 188 => { + let mut msg = MsgCommandOutput::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgGroupDelay(msg)) + Ok(SBP::MsgCommandOutput(msg)) } - 112 => { - let mut msg = MsgAlmanacGPSDep::parse(payload)?; + 186 => { + let mut msg = MsgNetworkStateReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanacGPSDep(msg)) + Ok(SBP::MsgNetworkStateReq(msg)) } - 114 => { - let mut msg = MsgAlmanacGPS::parse(payload)?; + 187 => { + let mut msg = MsgNetworkStateResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanacGPS(msg)) + Ok(SBP::MsgNetworkStateResp(msg)) } - 113 => { - let mut msg = MsgAlmanacGloDep::parse(payload)?; + 189 => { + let mut msg = MsgNetworkBandwidthUsage::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanacGloDep(msg)) + Ok(SBP::MsgNetworkBandwidthUsage(msg)) } - 115 => { - let mut msg = MsgAlmanacGlo::parse(payload)?; + 190 => { + let mut msg = MsgCellModemStatus::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanacGlo(msg)) + Ok(SBP::MsgCellModemStatus(msg)) } - 117 => { - let mut msg = MsgGloBiases::parse(payload)?; + 80 => { + let mut msg = MsgSpecanDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgGloBiases(msg)) + Ok(SBP::MsgSpecanDep(msg)) } - 151 => { - let mut msg = MsgSvAzEl::parse(payload)?; + 81 => { + let mut msg = MsgSpecan::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSvAzEl(msg)) + Ok(SBP::MsgSpecan(msg)) } - 1600 => { - let mut msg = MsgOsr::parse(payload)?; + 191 => { + let mut msg = MsgFrontEndGain::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgOsr(msg)) + Ok(SBP::MsgFrontEndGain(msg)) } - 2304 => { - let mut msg = MsgImuRaw::parse(payload)?; + 32512 => { + let mut msg = MsgLinuxCpuState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgImuRaw(msg)) + Ok(SBP::MsgLinuxCpuState(msg)) } - 2305 => { - let mut msg = MsgImuAux::parse(payload)?; + 32513 => { + let mut msg = MsgLinuxMemState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgImuAux(msg)) + Ok(SBP::MsgLinuxMemState(msg)) + } + 32514 => { + let mut msg = MsgLinuxSysState::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxSysState(msg)) + } + 32515 => { + let mut msg = MsgLinuxProcessSocketCounts::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxProcessSocketCounts(msg)) + } + 32516 => { + let mut msg = MsgLinuxProcessSocketQueues::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxProcessSocketQueues(msg)) + } + 32517 => { + let mut msg = MsgLinuxSocketUsage::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxSocketUsage(msg)) + } + 32518 => { + let mut msg = MsgLinuxProcessFdCount::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxProcessFdCount(msg)) + } + 32519 => { + let mut msg = MsgLinuxProcessFdSummary::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgLinuxProcessFdSummary(msg)) } 230 => { let mut msg = MsgFlashProgram::parse(payload)?; @@ -1150,116 +1260,6 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgM25FlashWriteStatus(msg)) } - 33 => { - let mut msg = MsgTrackingStateDetailedDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingStateDetailedDepA(msg)) - } - 128 => { - let mut msg = MsgEphemerisDepD::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisDepD(msg)) - } - 26 => { - let mut msg = MsgEphemerisDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisDepA(msg)) - } - 70 => { - let mut msg = MsgEphemerisDepB::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisDepB(msg)) - } - 71 => { - let mut msg = MsgEphemerisDepC::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisDepC(msg)) - } - 69 => { - let mut msg = MsgObsDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgObsDepA(msg)) - } - 67 => { - let mut msg = MsgObsDepB::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgObsDepB(msg)) - } - 73 => { - let mut msg = MsgObsDepC::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgObsDepC(msg)) - } - 144 => { - let mut msg = MsgIono::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgIono(msg)) - } - 145 => { - let mut msg = MsgSvConfigurationGPSDep::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSvConfigurationGPSDep(msg)) - } - 150 => { - let mut msg = MsgGnssCapb::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgGnssCapb(msg)) - } - 146 => { - let mut msg = MsgGroupDelayDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgGroupDelayDepA(msg)) - } - 149 => { - let mut msg = MsgEphemerisGalDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGalDepA(msg)) - } - 141 => { - let mut msg = MsgEphemerisGal::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGal(msg)) - } - 130 => { - let mut msg = MsgEphemerisSbasDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisSbasDepA(msg)) - } - 131 => { - let mut msg = MsgEphemerisGloDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGloDepA(msg)) - } - 132 => { - let mut msg = MsgEphemerisSbasDepB::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisSbasDepB(msg)) - } - 140 => { - let mut msg = MsgEphemerisSbas::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisSbas(msg)) - } - 133 => { - let mut msg = MsgEphemerisGloDepB::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGloDepB(msg)) - } - 135 => { - let mut msg = MsgEphemerisGloDepC::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGloDepC(msg)) - } - 136 => { - let mut msg = MsgEphemerisGloDepD::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGloDepD(msg)) - } - 139 => { - let mut msg = MsgEphemerisGlo::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGlo(msg)) - } _ => Ok(SBP::Unknown { msg_id: msg_id, sender_id: sender_id, diff --git a/rust/sbp/src/messages/navigation.rs b/rust/sbp/src/messages/navigation.rs index 7f9419e644..9b03a11be0 100644 --- a/rust/sbp/src/messages/navigation.rs +++ b/rust/sbp/src/messages/navigation.rs @@ -66,7 +66,7 @@ pub struct MsgGPSTime { } impl MsgGPSTime { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgGPSTime { sender_id: None, wn: _buf.read_u16::()?, @@ -118,7 +118,7 @@ pub struct MsgUtcTime { } impl MsgUtcTime { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgUtcTime { sender_id: None, flags: _buf.read_u8()?, @@ -173,7 +173,7 @@ pub struct MsgDops { } impl MsgDops { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgDops { sender_id: None, tow: _buf.read_u32::()?, @@ -230,7 +230,7 @@ pub struct MsgPosECEF { } impl MsgPosECEF { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgPosECEF { sender_id: None, tow: _buf.read_u32::()?, @@ -298,7 +298,7 @@ pub struct MsgPosECEFCov { } impl MsgPosECEFCov { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgPosECEFCov { sender_id: None, tow: _buf.read_u32::()?, @@ -362,7 +362,7 @@ pub struct MsgPosLLH { } impl MsgPosLLH { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgPosLLH { sender_id: None, tow: _buf.read_u32::()?, @@ -430,7 +430,7 @@ pub struct MsgPosLLHCov { } impl MsgPosLLHCov { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgPosLLHCov { sender_id: None, tow: _buf.read_u32::()?, @@ -489,7 +489,7 @@ pub struct MsgBaselineECEF { } impl MsgBaselineECEF { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBaselineECEF { sender_id: None, tow: _buf.read_u32::()?, @@ -546,7 +546,7 @@ pub struct MsgBaselineNED { } impl MsgBaselineNED { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBaselineNED { sender_id: None, tow: _buf.read_u32::()?, @@ -599,7 +599,7 @@ pub struct MsgVelECEF { } impl MsgVelECEF { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgVelECEF { sender_id: None, tow: _buf.read_u32::()?, @@ -661,7 +661,7 @@ pub struct MsgVelECEFCov { } impl MsgVelECEFCov { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgVelECEFCov { sender_id: None, tow: _buf.read_u32::()?, @@ -721,7 +721,7 @@ pub struct MsgVelNED { } impl MsgVelNED { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgVelNED { sender_id: None, tow: _buf.read_u32::()?, @@ -787,7 +787,7 @@ pub struct MsgVelNEDCov { } impl MsgVelNEDCov { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgVelNEDCov { sender_id: None, tow: _buf.read_u32::()?, @@ -859,7 +859,7 @@ pub struct MsgVelBody { } impl MsgVelBody { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgVelBody { sender_id: None, tow: _buf.read_u32::()?, @@ -905,7 +905,7 @@ pub struct MsgAgeCorrections { } impl MsgAgeCorrections { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAgeCorrections { sender_id: None, tow: _buf.read_u32::()?, @@ -957,7 +957,7 @@ pub struct MsgGPSTimeDepA { } impl MsgGPSTimeDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgGPSTimeDepA { sender_id: None, wn: _buf.read_u16::()?, @@ -1004,7 +1004,7 @@ pub struct MsgDopsDepA { } impl MsgDopsDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgDopsDepA { sender_id: None, tow: _buf.read_u32::()?, @@ -1060,7 +1060,7 @@ pub struct MsgPosECEFDepA { } impl MsgPosECEFDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgPosECEFDepA { sender_id: None, tow: _buf.read_u32::()?, @@ -1119,7 +1119,7 @@ pub struct MsgPosLLHDepA { } impl MsgPosLLHDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgPosLLHDepA { sender_id: None, tow: _buf.read_u32::()?, @@ -1174,7 +1174,7 @@ pub struct MsgBaselineECEFDepA { } impl MsgBaselineECEFDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBaselineECEFDepA { sender_id: None, tow: _buf.read_u32::()?, @@ -1231,7 +1231,7 @@ pub struct MsgBaselineNEDDepA { } impl MsgBaselineNEDDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBaselineNEDDepA { sender_id: None, tow: _buf.read_u32::()?, @@ -1284,7 +1284,7 @@ pub struct MsgVelECEFDepA { } impl MsgVelECEFDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgVelECEFDepA { sender_id: None, tow: _buf.read_u32::()?, @@ -1339,7 +1339,7 @@ pub struct MsgVelNEDDepA { } impl MsgVelNEDDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgVelNEDDepA { sender_id: None, tow: _buf.read_u32::()?, @@ -1386,7 +1386,7 @@ pub struct MsgBaselineHeadingDepA { } impl MsgBaselineHeadingDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBaselineHeadingDepA { sender_id: None, tow: _buf.read_u32::()?, diff --git a/rust/sbp/src/messages/ndb.rs b/rust/sbp/src/messages/ndb.rs index 77e3af7602..5eda14842e 100644 --- a/rust/sbp/src/messages/ndb.rs +++ b/rust/sbp/src/messages/ndb.rs @@ -52,7 +52,7 @@ pub struct MsgNdbEvent { } impl MsgNdbEvent { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgNdbEvent { sender_id: None, recv_time: _buf.read_u64::()?, diff --git a/rust/sbp/src/messages/observation.rs b/rust/sbp/src/messages/observation.rs index 74771649ef..fe1e072fc2 100644 --- a/rust/sbp/src/messages/observation.rs +++ b/rust/sbp/src/messages/observation.rs @@ -33,13 +33,13 @@ pub struct ObservationHeader { } impl ObservationHeader { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(ObservationHeader { t: GPSTime::parse(_buf)?, n_obs: _buf.read_u8()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(ObservationHeader::parse(buf)?); @@ -47,10 +47,7 @@ impl ObservationHeader { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(ObservationHeader::parse(buf)?); @@ -76,13 +73,13 @@ pub struct Doppler { } impl Doppler { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(Doppler { i: _buf.read_i16::()?, f: _buf.read_u8()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(Doppler::parse(buf)?); @@ -90,10 +87,7 @@ impl Doppler { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(Doppler::parse(buf)?); @@ -139,7 +133,7 @@ pub struct PackedObsContent { } impl PackedObsContent { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(PackedObsContent { P: _buf.read_u32::()?, L: CarrierPhase::parse(_buf)?, @@ -150,7 +144,7 @@ impl PackedObsContent { sid: GnssSignal::parse(_buf)?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(PackedObsContent::parse(buf)?); @@ -158,10 +152,7 @@ impl PackedObsContent { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(PackedObsContent::parse(buf)?); @@ -201,7 +192,7 @@ pub struct PackedOsrContent { } impl PackedOsrContent { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(PackedOsrContent { P: _buf.read_u32::()?, L: CarrierPhase::parse(_buf)?, @@ -213,7 +204,7 @@ impl PackedOsrContent { range_std: _buf.read_u16::()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(PackedOsrContent::parse(buf)?); @@ -221,10 +212,7 @@ impl PackedOsrContent { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(PackedOsrContent::parse(buf)?); @@ -254,7 +242,7 @@ pub struct MsgObs { } impl MsgObs { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgObs { sender_id: None, header: ObservationHeader::parse(_buf)?, @@ -295,7 +283,7 @@ pub struct MsgBasePosLLH { } impl MsgBasePosLLH { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBasePosLLH { sender_id: None, lat: _buf.read_f64::()?, @@ -338,7 +326,7 @@ pub struct MsgBasePosECEF { } impl MsgBasePosECEF { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBasePosECEF { sender_id: None, x: _buf.read_f64::()?, @@ -378,7 +366,7 @@ pub struct EphemerisCommonContent { } impl EphemerisCommonContent { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(EphemerisCommonContent { sid: GnssSignal::parse(_buf)?, toe: GPSTimeSec::parse(_buf)?, @@ -388,9 +376,7 @@ impl EphemerisCommonContent { health_bits: _buf.read_u8()?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(EphemerisCommonContent::parse(buf)?); @@ -401,7 +387,7 @@ impl EphemerisCommonContent { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(EphemerisCommonContent::parse(buf)?); @@ -429,7 +415,7 @@ pub struct EphemerisCommonContentDepB { } impl EphemerisCommonContentDepB { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(EphemerisCommonContentDepB { sid: GnssSignal::parse(_buf)?, toe: GPSTimeSec::parse(_buf)?, @@ -439,9 +425,7 @@ impl EphemerisCommonContentDepB { health_bits: _buf.read_u8()?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(EphemerisCommonContentDepB::parse(buf)?); @@ -452,7 +436,7 @@ impl EphemerisCommonContentDepB { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(EphemerisCommonContentDepB::parse(buf)?); @@ -480,7 +464,7 @@ pub struct EphemerisCommonContentDepA { } impl EphemerisCommonContentDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(EphemerisCommonContentDepA { sid: GnssSignalDep::parse(_buf)?, toe: GPSTimeDep::parse(_buf)?, @@ -490,9 +474,7 @@ impl EphemerisCommonContentDepA { health_bits: _buf.read_u8()?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(EphemerisCommonContentDepA::parse(buf)?); @@ -503,7 +485,7 @@ impl EphemerisCommonContentDepA { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(EphemerisCommonContentDepA::parse(buf)?); @@ -577,7 +559,7 @@ pub struct MsgEphemerisGPSDepE { } impl MsgEphemerisGPSDepE { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGPSDepE { sender_id: None, common: EphemerisCommonContentDepA::parse(_buf)?, @@ -680,7 +662,7 @@ pub struct MsgEphemerisGPSDepF { } impl MsgEphemerisGPSDepF { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGPSDepF { sender_id: None, common: EphemerisCommonContentDepB::parse(_buf)?, @@ -786,7 +768,7 @@ pub struct MsgEphemerisGPS { } impl MsgEphemerisGPS { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGPS { sender_id: None, common: EphemerisCommonContent::parse(_buf)?, @@ -890,7 +872,7 @@ pub struct MsgEphemerisQzss { } impl MsgEphemerisQzss { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisQzss { sender_id: None, common: EphemerisCommonContent::parse(_buf)?, @@ -997,7 +979,7 @@ pub struct MsgEphemerisBds { } impl MsgEphemerisBds { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisBds { sender_id: None, common: EphemerisCommonContent::parse(_buf)?, @@ -1103,7 +1085,7 @@ pub struct MsgEphemerisGalDepA { } impl MsgEphemerisGalDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGalDepA { sender_id: None, common: EphemerisCommonContent::parse(_buf)?, @@ -1213,7 +1195,7 @@ pub struct MsgEphemerisGal { } impl MsgEphemerisGal { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGal { sender_id: None, common: EphemerisCommonContent::parse(_buf)?, @@ -1275,7 +1257,7 @@ pub struct MsgEphemerisSbasDepA { } impl MsgEphemerisSbasDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisSbasDepA { sender_id: None, common: EphemerisCommonContentDepA::parse(_buf)?, @@ -1326,7 +1308,7 @@ pub struct MsgEphemerisGloDepA { } impl MsgEphemerisGloDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGloDepA { sender_id: None, common: EphemerisCommonContentDepA::parse(_buf)?, @@ -1374,7 +1356,7 @@ pub struct MsgEphemerisSbasDepB { } impl MsgEphemerisSbasDepB { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisSbasDepB { sender_id: None, common: EphemerisCommonContentDepB::parse(_buf)?, @@ -1417,7 +1399,7 @@ pub struct MsgEphemerisSbas { } impl MsgEphemerisSbas { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisSbas { sender_id: None, common: EphemerisCommonContent::parse(_buf)?, @@ -1468,7 +1450,7 @@ pub struct MsgEphemerisGloDepB { } impl MsgEphemerisGloDepB { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGloDepB { sender_id: None, common: EphemerisCommonContentDepB::parse(_buf)?, @@ -1523,7 +1505,7 @@ pub struct MsgEphemerisGloDepC { } impl MsgEphemerisGloDepC { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGloDepC { sender_id: None, common: EphemerisCommonContentDepB::parse(_buf)?, @@ -1579,7 +1561,7 @@ pub struct MsgEphemerisGloDepD { } impl MsgEphemerisGloDepD { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGloDepD { sender_id: None, common: EphemerisCommonContentDepB::parse(_buf)?, @@ -1639,7 +1621,7 @@ pub struct MsgEphemerisGlo { } impl MsgEphemerisGlo { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisGlo { sender_id: None, common: EphemerisCommonContent::parse(_buf)?, @@ -1743,7 +1725,7 @@ pub struct MsgEphemerisDepD { } impl MsgEphemerisDepD { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisDepD { sender_id: None, tgd: _buf.read_f64::()?, @@ -1857,7 +1839,7 @@ pub struct MsgEphemerisDepA { } impl MsgEphemerisDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisDepA { sender_id: None, tgd: _buf.read_f64::()?, @@ -1970,7 +1952,7 @@ pub struct MsgEphemerisDepB { } impl MsgEphemerisDepB { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisDepB { sender_id: None, tgd: _buf.read_f64::()?, @@ -2092,7 +2074,7 @@ pub struct MsgEphemerisDepC { } impl MsgEphemerisDepC { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgEphemerisDepC { sender_id: None, tgd: _buf.read_f64::()?, @@ -2154,15 +2136,13 @@ pub struct ObservationHeaderDep { } impl ObservationHeaderDep { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(ObservationHeaderDep { t: GPSTimeDep::parse(_buf)?, n_obs: _buf.read_u8()?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(ObservationHeaderDep::parse(buf)?); @@ -2173,7 +2153,7 @@ impl ObservationHeaderDep { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(ObservationHeaderDep::parse(buf)?); @@ -2200,13 +2180,13 @@ pub struct CarrierPhaseDepA { } impl CarrierPhaseDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(CarrierPhaseDepA { i: _buf.read_i32::()?, f: _buf.read_u8()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(CarrierPhaseDepA::parse(buf)?); @@ -2214,10 +2194,7 @@ impl CarrierPhaseDepA { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(CarrierPhaseDepA::parse(buf)?); @@ -2248,7 +2225,7 @@ pub struct PackedObsContentDepA { } impl PackedObsContentDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(PackedObsContentDepA { P: _buf.read_u32::()?, L: CarrierPhaseDepA::parse(_buf)?, @@ -2257,9 +2234,7 @@ impl PackedObsContentDepA { prn: _buf.read_u8()?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(PackedObsContentDepA::parse(buf)?); @@ -2270,7 +2245,7 @@ impl PackedObsContentDepA { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(PackedObsContentDepA::parse(buf)?); @@ -2302,7 +2277,7 @@ pub struct PackedObsContentDepB { } impl PackedObsContentDepB { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(PackedObsContentDepB { P: _buf.read_u32::()?, L: CarrierPhaseDepA::parse(_buf)?, @@ -2311,9 +2286,7 @@ impl PackedObsContentDepB { sid: GnssSignalDep::parse(_buf)?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(PackedObsContentDepB::parse(buf)?); @@ -2324,7 +2297,7 @@ impl PackedObsContentDepB { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(PackedObsContentDepB::parse(buf)?); @@ -2357,7 +2330,7 @@ pub struct PackedObsContentDepC { } impl PackedObsContentDepC { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(PackedObsContentDepC { P: _buf.read_u32::()?, L: CarrierPhase::parse(_buf)?, @@ -2366,9 +2339,7 @@ impl PackedObsContentDepC { sid: GnssSignalDep::parse(_buf)?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(PackedObsContentDepC::parse(buf)?); @@ -2379,7 +2350,7 @@ impl PackedObsContentDepC { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(PackedObsContentDepC::parse(buf)?); @@ -2403,7 +2374,7 @@ pub struct MsgObsDepA { } impl MsgObsDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgObsDepA { sender_id: None, header: ObservationHeaderDep::parse(_buf)?, @@ -2443,7 +2414,7 @@ pub struct MsgObsDepB { } impl MsgObsDepB { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgObsDepB { sender_id: None, header: ObservationHeaderDep::parse(_buf)?, @@ -2484,7 +2455,7 @@ pub struct MsgObsDepC { } impl MsgObsDepC { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgObsDepC { sender_id: None, header: ObservationHeaderDep::parse(_buf)?, @@ -2527,7 +2498,7 @@ pub struct MsgIono { } impl MsgIono { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgIono { sender_id: None, t_nmct: GPSTimeSec::parse(_buf)?, @@ -2569,7 +2540,7 @@ pub struct MsgSvConfigurationGPSDep { } impl MsgSvConfigurationGPSDep { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSvConfigurationGPSDep { sender_id: None, t_nmct: GPSTimeSec::parse(_buf)?, @@ -2627,7 +2598,7 @@ pub struct GnssCapb { } impl GnssCapb { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(GnssCapb { gps_active: _buf.read_u64::()?, gps_l2c: _buf.read_u64::()?, @@ -2646,7 +2617,7 @@ impl GnssCapb { gal_e5: _buf.read_u64::()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(GnssCapb::parse(buf)?); @@ -2654,10 +2625,7 @@ impl GnssCapb { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(GnssCapb::parse(buf)?); @@ -2677,7 +2645,7 @@ pub struct MsgGnssCapb { } impl MsgGnssCapb { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgGnssCapb { sender_id: None, t_nmct: GPSTimeSec::parse(_buf)?, @@ -2718,7 +2686,7 @@ pub struct MsgGroupDelayDepA { } impl MsgGroupDelayDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgGroupDelayDepA { sender_id: None, t_op: GPSTimeDep::parse(_buf)?, @@ -2763,7 +2731,7 @@ pub struct MsgGroupDelayDepB { } impl MsgGroupDelayDepB { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgGroupDelayDepB { sender_id: None, t_op: GPSTimeSec::parse(_buf)?, @@ -2808,7 +2776,7 @@ pub struct MsgGroupDelay { } impl MsgGroupDelay { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgGroupDelay { sender_id: None, t_op: GPSTimeSec::parse(_buf)?, @@ -2859,7 +2827,7 @@ pub struct AlmanacCommonContent { } impl AlmanacCommonContent { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(AlmanacCommonContent { sid: GnssSignal::parse(_buf)?, toa: GPSTimeSec::parse(_buf)?, @@ -2869,9 +2837,7 @@ impl AlmanacCommonContent { health_bits: _buf.read_u8()?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(AlmanacCommonContent::parse(buf)?); @@ -2882,7 +2848,7 @@ impl AlmanacCommonContent { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(AlmanacCommonContent::parse(buf)?); @@ -2918,7 +2884,7 @@ pub struct AlmanacCommonContentDep { } impl AlmanacCommonContentDep { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(AlmanacCommonContentDep { sid: GnssSignalDep::parse(_buf)?, toa: GPSTimeSec::parse(_buf)?, @@ -2928,9 +2894,7 @@ impl AlmanacCommonContentDep { health_bits: _buf.read_u8()?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(AlmanacCommonContentDep::parse(buf)?); @@ -2941,7 +2905,7 @@ impl AlmanacCommonContentDep { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(AlmanacCommonContentDep::parse(buf)?); @@ -2984,7 +2948,7 @@ pub struct MsgAlmanacGPSDep { } impl MsgAlmanacGPSDep { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAlmanacGPSDep { sender_id: None, common: AlmanacCommonContentDep::parse(_buf)?, @@ -3046,7 +3010,7 @@ pub struct MsgAlmanacGPS { } impl MsgAlmanacGPS { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAlmanacGPS { sender_id: None, common: AlmanacCommonContent::parse(_buf)?, @@ -3105,7 +3069,7 @@ pub struct MsgAlmanacGloDep { } impl MsgAlmanacGloDep { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAlmanacGloDep { sender_id: None, common: AlmanacCommonContentDep::parse(_buf)?, @@ -3162,7 +3126,7 @@ pub struct MsgAlmanacGlo { } impl MsgAlmanacGlo { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAlmanacGlo { sender_id: None, common: AlmanacCommonContent::parse(_buf)?, @@ -3212,7 +3176,7 @@ pub struct MsgGloBiases { } impl MsgGloBiases { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgGloBiases { sender_id: None, mask: _buf.read_u8()?, @@ -3251,14 +3215,14 @@ pub struct SvAzEl { } impl SvAzEl { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(SvAzEl { sid: GnssSignal::parse(_buf)?, az: _buf.read_u8()?, el: _buf.read_i8()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(SvAzEl::parse(buf)?); @@ -3266,10 +3230,7 @@ impl SvAzEl { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(SvAzEl::parse(buf)?); @@ -3292,7 +3253,7 @@ pub struct MsgSvAzEl { } impl MsgSvAzEl { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSvAzEl { sender_id: None, azel: SvAzEl::parse_array(_buf)?, @@ -3326,7 +3287,7 @@ pub struct MsgOsr { } impl MsgOsr { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgOsr { sender_id: None, header: ObservationHeader::parse(_buf)?, diff --git a/rust/sbp/src/messages/orientation.rs b/rust/sbp/src/messages/orientation.rs index ba386cba78..f97154ec47 100644 --- a/rust/sbp/src/messages/orientation.rs +++ b/rust/sbp/src/messages/orientation.rs @@ -39,7 +39,7 @@ pub struct MsgBaselineHeading { } impl MsgBaselineHeading { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgBaselineHeading { sender_id: None, tow: _buf.read_u32::()?, @@ -96,7 +96,7 @@ pub struct MsgOrientQuat { } impl MsgOrientQuat { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgOrientQuat { sender_id: None, tow: _buf.read_u32::()?, @@ -155,7 +155,7 @@ pub struct MsgOrientEuler { } impl MsgOrientEuler { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgOrientEuler { sender_id: None, tow: _buf.read_u32::()?, @@ -210,7 +210,7 @@ pub struct MsgAngularRate { } impl MsgAngularRate { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAngularRate { sender_id: None, tow: _buf.read_u32::()?, diff --git a/rust/sbp/src/messages/piksi.rs b/rust/sbp/src/messages/piksi.rs index 65d6d1be26..fe4e24d0ce 100644 --- a/rust/sbp/src/messages/piksi.rs +++ b/rust/sbp/src/messages/piksi.rs @@ -32,7 +32,7 @@ pub struct MsgAlmanac { } impl MsgAlmanac { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgAlmanac { sender_id: None }) } } @@ -60,7 +60,7 @@ pub struct MsgSetTime { } impl MsgSetTime { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSetTime { sender_id: None }) } } @@ -90,7 +90,7 @@ pub struct MsgReset { } impl MsgReset { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgReset { sender_id: None, flags: _buf.read_u32::()?, @@ -121,7 +121,7 @@ pub struct MsgResetDep { } impl MsgResetDep { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgResetDep { sender_id: None }) } } @@ -150,7 +150,7 @@ pub struct MsgCwResults { } impl MsgCwResults { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgCwResults { sender_id: None }) } } @@ -179,7 +179,7 @@ pub struct MsgCwStart { } impl MsgCwStart { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgCwStart { sender_id: None }) } } @@ -209,7 +209,7 @@ pub struct MsgResetFilters { } impl MsgResetFilters { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgResetFilters { sender_id: None, filter: _buf.read_u8()?, @@ -239,7 +239,7 @@ pub struct MsgInitBaseDep { } impl MsgInitBaseDep { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgInitBaseDep { sender_id: None }) } } @@ -275,7 +275,7 @@ pub struct MsgThreadState { } impl MsgThreadState { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgThreadState { sender_id: None, name: ::parser::read_string_limit(_buf, 20)?, @@ -320,7 +320,7 @@ pub struct UARTChannel { } impl UARTChannel { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(UARTChannel { tx_throughput: _buf.read_f32::()?, rx_throughput: _buf.read_f32::()?, @@ -330,7 +330,7 @@ impl UARTChannel { rx_buffer_level: _buf.read_u8()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(UARTChannel::parse(buf)?); @@ -338,10 +338,7 @@ impl UARTChannel { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(UARTChannel::parse(buf)?); @@ -373,7 +370,7 @@ pub struct Period { } impl Period { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(Period { avg: _buf.read_i32::()?, pmin: _buf.read_i32::()?, @@ -381,7 +378,7 @@ impl Period { current: _buf.read_i32::()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(Period::parse(buf)?); @@ -389,10 +386,7 @@ impl Period { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(Period::parse(buf)?); @@ -423,7 +417,7 @@ pub struct Latency { } impl Latency { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(Latency { avg: _buf.read_i32::()?, lmin: _buf.read_i32::()?, @@ -431,7 +425,7 @@ impl Latency { current: _buf.read_i32::()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(Latency::parse(buf)?); @@ -439,10 +433,7 @@ impl Latency { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(Latency::parse(buf)?); @@ -480,7 +471,7 @@ pub struct MsgUartState { } impl MsgUartState { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgUartState { sender_id: None, uart_a: UARTChannel::parse(_buf)?, @@ -522,7 +513,7 @@ pub struct MsgUartStateDepa { } impl MsgUartStateDepa { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgUartStateDepa { sender_id: None, uart_a: UARTChannel::parse(_buf)?, @@ -560,7 +551,7 @@ pub struct MsgIarState { } impl MsgIarState { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgIarState { sender_id: None, num_hyps: _buf.read_u32::()?, @@ -595,7 +586,7 @@ pub struct MsgMaskSatellite { } impl MsgMaskSatellite { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgMaskSatellite { sender_id: None, mask: _buf.read_u8()?, @@ -630,7 +621,7 @@ pub struct MsgMaskSatelliteDep { } impl MsgMaskSatelliteDep { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgMaskSatelliteDep { sender_id: None, mask: _buf.read_u8()?, @@ -673,7 +664,7 @@ pub struct MsgDeviceMonitor { } impl MsgDeviceMonitor { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgDeviceMonitor { sender_id: None, dev_vin: _buf.read_i16::()?, @@ -713,7 +704,7 @@ pub struct MsgCommandReq { } impl MsgCommandReq { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgCommandReq { sender_id: None, sequence: _buf.read_u32::()?, @@ -749,7 +740,7 @@ pub struct MsgCommandResp { } impl MsgCommandResp { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgCommandResp { sender_id: None, sequence: _buf.read_u32::()?, @@ -787,7 +778,7 @@ pub struct MsgCommandOutput { } impl MsgCommandOutput { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgCommandOutput { sender_id: None, sequence: _buf.read_u32::()?, @@ -819,7 +810,7 @@ pub struct MsgNetworkStateReq { } impl MsgNetworkStateReq { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgNetworkStateReq { sender_id: None }) } } @@ -864,7 +855,7 @@ pub struct MsgNetworkStateResp { } impl MsgNetworkStateResp { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgNetworkStateResp { sender_id: None, ipv4_address: ::parser::read_u8_array_limit(_buf, 4)?, @@ -915,7 +906,7 @@ pub struct NetworkUsage { } impl NetworkUsage { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(NetworkUsage { duration: _buf.read_u64::()?, total_bytes: _buf.read_u64::()?, @@ -924,7 +915,7 @@ impl NetworkUsage { interface_name: ::parser::read_string_limit(_buf, 16)?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(NetworkUsage::parse(buf)?); @@ -932,10 +923,7 @@ impl NetworkUsage { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(NetworkUsage::parse(buf)?); @@ -957,7 +945,7 @@ pub struct MsgNetworkBandwidthUsage { } impl MsgNetworkBandwidthUsage { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgNetworkBandwidthUsage { sender_id: None, interfaces: NetworkUsage::parse_array(_buf)?, @@ -995,7 +983,7 @@ pub struct MsgCellModemStatus { } impl MsgCellModemStatus { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgCellModemStatus { sender_id: None, signal_strength: _buf.read_i8()?, @@ -1041,7 +1029,7 @@ pub struct MsgSpecanDep { } impl MsgSpecanDep { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSpecanDep { sender_id: None, channel_tag: _buf.read_u16::()?, @@ -1091,7 +1079,7 @@ pub struct MsgSpecan { } impl MsgSpecan { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSpecan { sender_id: None, channel_tag: _buf.read_u16::()?, @@ -1136,7 +1124,7 @@ pub struct MsgFrontEndGain { } impl MsgFrontEndGain { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgFrontEndGain { sender_id: None, rf_gain: ::parser::read_s8_array_limit(_buf, 8)?, diff --git a/rust/sbp/src/messages/sbas.rs b/rust/sbp/src/messages/sbas.rs index 7ede007f40..c6fd4018a4 100644 --- a/rust/sbp/src/messages/sbas.rs +++ b/rust/sbp/src/messages/sbas.rs @@ -38,7 +38,7 @@ pub struct MsgSbasRaw { } impl MsgSbasRaw { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSbasRaw { sender_id: None, sid: GnssSignal::parse(_buf)?, diff --git a/rust/sbp/src/messages/settings.rs b/rust/sbp/src/messages/settings.rs index 4b1f6668b4..b0bdece5d1 100644 --- a/rust/sbp/src/messages/settings.rs +++ b/rust/sbp/src/messages/settings.rs @@ -54,7 +54,7 @@ pub struct MsgSettingsSave { } impl MsgSettingsSave { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsSave { sender_id: None }) } } @@ -90,7 +90,7 @@ pub struct MsgSettingsWrite { } impl MsgSettingsWrite { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsWrite { sender_id: None, setting: ::parser::read_string(_buf)?, @@ -131,7 +131,7 @@ pub struct MsgSettingsWriteResp { } impl MsgSettingsWriteResp { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsWriteResp { sender_id: None, status: _buf.read_u8()?, @@ -172,7 +172,7 @@ pub struct MsgSettingsReadReq { } impl MsgSettingsReadReq { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsReadReq { sender_id: None, setting: ::parser::read_string(_buf)?, @@ -211,7 +211,7 @@ pub struct MsgSettingsReadResp { } impl MsgSettingsReadResp { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsReadResp { sender_id: None, setting: ::parser::read_string(_buf)?, @@ -246,7 +246,7 @@ pub struct MsgSettingsReadByIndexReq { } impl MsgSettingsReadByIndexReq { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsReadByIndexReq { sender_id: None, index: _buf.read_u16::()?, @@ -291,7 +291,7 @@ pub struct MsgSettingsReadByIndexResp { } impl MsgSettingsReadByIndexResp { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsReadByIndexResp { sender_id: None, index: _buf.read_u16::()?, @@ -322,7 +322,7 @@ pub struct MsgSettingsReadByIndexDone { } impl MsgSettingsReadByIndexDone { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsReadByIndexDone { sender_id: None }) } } @@ -354,7 +354,7 @@ pub struct MsgSettingsRegister { } impl MsgSettingsRegister { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsRegister { sender_id: None, setting: ::parser::read_string(_buf)?, @@ -393,7 +393,7 @@ pub struct MsgSettingsRegisterResp { } impl MsgSettingsRegisterResp { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSettingsRegisterResp { sender_id: None, status: _buf.read_u8()?, diff --git a/rust/sbp/src/messages/ssr.rs b/rust/sbp/src/messages/ssr.rs index 29bea73a1b..4ef50c7510 100644 --- a/rust/sbp/src/messages/ssr.rs +++ b/rust/sbp/src/messages/ssr.rs @@ -33,13 +33,13 @@ pub struct CodeBiasesContent { } impl CodeBiasesContent { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(CodeBiasesContent { code: _buf.read_u8()?, value: _buf.read_i16::()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(CodeBiasesContent::parse(buf)?); @@ -47,10 +47,7 @@ impl CodeBiasesContent { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(CodeBiasesContent::parse(buf)?); @@ -81,7 +78,7 @@ pub struct PhaseBiasesContent { } impl PhaseBiasesContent { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(PhaseBiasesContent { code: _buf.read_u8()?, integer_indicator: _buf.read_u8()?, @@ -90,7 +87,7 @@ impl PhaseBiasesContent { bias: _buf.read_i32::()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(PhaseBiasesContent::parse(buf)?); @@ -101,7 +98,7 @@ impl PhaseBiasesContent { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(PhaseBiasesContent::parse(buf)?); @@ -134,7 +131,7 @@ pub struct STECHeader { } impl STECHeader { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(STECHeader { time: GPSTimeSec::parse(_buf)?, num_msgs: _buf.read_u8()?, @@ -143,7 +140,7 @@ impl STECHeader { iod_ssr: _buf.read_u8()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(STECHeader::parse(buf)?); @@ -151,10 +148,7 @@ impl STECHeader { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(STECHeader::parse(buf)?); @@ -190,7 +184,7 @@ pub struct GriddedCorrectionHeader { } impl GriddedCorrectionHeader { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(GriddedCorrectionHeader { time: GPSTimeSec::parse(_buf)?, num_msgs: _buf.read_u16::()?, @@ -200,9 +194,7 @@ impl GriddedCorrectionHeader { tropo_quality_indicator: _buf.read_u8()?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(GriddedCorrectionHeader::parse(buf)?); @@ -213,7 +205,7 @@ impl GriddedCorrectionHeader { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(GriddedCorrectionHeader::parse(buf)?); @@ -239,14 +231,14 @@ pub struct STECSatElement { } impl STECSatElement { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(STECSatElement { sv_id: SvId::parse(_buf)?, stec_quality_indicator: _buf.read_u8()?, stec_coeff: ::parser::read_s16_array_limit(_buf, 4)?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(STECSatElement::parse(buf)?); @@ -254,10 +246,7 @@ impl STECSatElement { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(STECSatElement::parse(buf)?); @@ -280,15 +269,13 @@ pub struct TroposphericDelayCorrection { } impl TroposphericDelayCorrection { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(TroposphericDelayCorrection { hydro: _buf.read_i16::()?, wet: _buf.read_i8()?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(TroposphericDelayCorrection::parse(buf)?); @@ -299,7 +286,7 @@ impl TroposphericDelayCorrection { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(TroposphericDelayCorrection::parse(buf)?); @@ -322,13 +309,13 @@ pub struct STECResidual { } impl STECResidual { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(STECResidual { sv_id: SvId::parse(_buf)?, residual: _buf.read_i16::()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(STECResidual::parse(buf)?); @@ -336,10 +323,7 @@ impl STECResidual { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(STECResidual::parse(buf)?); @@ -365,14 +349,14 @@ pub struct GridElement { } impl GridElement { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(GridElement { index: _buf.read_u16::()?, tropo_delay_correction: TroposphericDelayCorrection::parse(_buf)?, stec_residuals: STECResidual::parse_array(_buf)?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(GridElement::parse(buf)?); @@ -380,10 +364,7 @@ impl GridElement { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(GridElement::parse(buf)?); @@ -415,7 +396,7 @@ pub struct GridDefinitionHeader { } impl GridDefinitionHeader { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(GridDefinitionHeader { region_size_inverse: _buf.read_u8()?, area_width: _buf.read_u16::()?, @@ -425,9 +406,7 @@ impl GridDefinitionHeader { seq_num: _buf.read_u8()?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(GridDefinitionHeader::parse(buf)?); @@ -438,7 +417,7 @@ impl GridDefinitionHeader { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(GridDefinitionHeader::parse(buf)?); @@ -491,7 +470,7 @@ pub struct MsgSsrOrbitClock { } impl MsgSsrOrbitClock { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSsrOrbitClock { sender_id: None, time: GPSTimeSec::parse(_buf)?, @@ -567,7 +546,7 @@ pub struct MsgSsrOrbitClockDepA { } impl MsgSsrOrbitClockDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSsrOrbitClockDepA { sender_id: None, time: GPSTimeSec::parse(_buf)?, @@ -625,7 +604,7 @@ pub struct MsgSsrCodeBiases { } impl MsgSsrCodeBiases { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSsrCodeBiases { sender_id: None, time: GPSTimeSec::parse(_buf)?, @@ -684,7 +663,7 @@ pub struct MsgSsrPhaseBiases { } impl MsgSsrPhaseBiases { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSsrPhaseBiases { sender_id: None, time: GPSTimeSec::parse(_buf)?, @@ -729,7 +708,7 @@ pub struct MsgSsrStecCorrection { } impl MsgSsrStecCorrection { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSsrStecCorrection { sender_id: None, header: STECHeader::parse(_buf)?, @@ -765,7 +744,7 @@ pub struct MsgSsrGriddedCorrection { } impl MsgSsrGriddedCorrection { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSsrGriddedCorrection { sender_id: None, header: GriddedCorrectionHeader::parse(_buf)?, @@ -803,7 +782,7 @@ pub struct MsgSsrGridDefinition { } impl MsgSsrGridDefinition { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgSsrGridDefinition { sender_id: None, header: GridDefinitionHeader::parse(_buf)?, diff --git a/rust/sbp/src/messages/system.rs b/rust/sbp/src/messages/system.rs index b749fe0b69..0892bd990d 100644 --- a/rust/sbp/src/messages/system.rs +++ b/rust/sbp/src/messages/system.rs @@ -37,7 +37,7 @@ pub struct MsgStartup { } impl MsgStartup { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgStartup { sender_id: None, cause: _buf.read_u8()?, @@ -79,7 +79,7 @@ pub struct MsgDgnssStatus { } impl MsgDgnssStatus { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgDgnssStatus { sender_id: None, flags: _buf.read_u8()?, @@ -123,7 +123,7 @@ pub struct MsgHeartbeat { } impl MsgHeartbeat { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgHeartbeat { sender_id: None, flags: _buf.read_u32::()?, @@ -156,7 +156,7 @@ pub struct MsgInsStatus { } impl MsgInsStatus { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgInsStatus { sender_id: None, flags: _buf.read_u32::()?, @@ -193,7 +193,7 @@ pub struct MsgCsacTelemetry { } impl MsgCsacTelemetry { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgCsacTelemetry { sender_id: None, id: _buf.read_u8()?, @@ -231,7 +231,7 @@ pub struct MsgCsacTelemetryLabels { } impl MsgCsacTelemetryLabels { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgCsacTelemetryLabels { sender_id: None, id: _buf.read_u8()?, diff --git a/rust/sbp/src/messages/tracking.rs b/rust/sbp/src/messages/tracking.rs index 53748aa6fc..35dd913c10 100644 --- a/rust/sbp/src/messages/tracking.rs +++ b/rust/sbp/src/messages/tracking.rs @@ -78,7 +78,7 @@ pub struct MsgTrackingStateDetailedDepA { } impl MsgTrackingStateDetailedDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgTrackingStateDetailedDepA { sender_id: None, recv_time: _buf.read_u64::()?, @@ -176,7 +176,7 @@ pub struct MsgTrackingStateDetailedDep { } impl MsgTrackingStateDetailedDep { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgTrackingStateDetailedDep { sender_id: None, recv_time: _buf.read_u64::()?, @@ -232,16 +232,14 @@ pub struct TrackingChannelState { } impl TrackingChannelState { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(TrackingChannelState { sid: GnssSignal::parse(_buf)?, fcn: _buf.read_u8()?, cn0: _buf.read_u8()?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(TrackingChannelState::parse(buf)?); @@ -252,7 +250,7 @@ impl TrackingChannelState { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(TrackingChannelState::parse(buf)?); @@ -276,7 +274,7 @@ pub struct MsgTrackingState { } impl MsgTrackingState { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgTrackingState { sender_id: None, states: TrackingChannelState::parse_array(_buf)?, @@ -314,13 +312,13 @@ pub struct MeasurementState { } impl MeasurementState { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MeasurementState { mesid: GnssSignal::parse(_buf)?, cn0: _buf.read_u8()?, }) } - pub fn parse_array(buf: &mut &[u8]) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(MeasurementState::parse(buf)?); @@ -328,10 +326,7 @@ impl MeasurementState { Ok(v) } - pub fn parse_array_limit( - buf: &mut &[u8], - n: usize, - ) -> Result, ::parser::MessageError> { + pub fn parse_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(MeasurementState::parse(buf)?); @@ -355,7 +350,7 @@ pub struct MsgMeasurementState { } impl MsgMeasurementState { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgMeasurementState { sender_id: None, states: MeasurementState::parse_array(_buf)?, @@ -388,15 +383,13 @@ pub struct TrackingChannelCorrelation { } impl TrackingChannelCorrelation { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(TrackingChannelCorrelation { I: _buf.read_i16::()?, Q: _buf.read_i16::()?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(TrackingChannelCorrelation::parse(buf)?); @@ -407,7 +400,7 @@ impl TrackingChannelCorrelation { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(TrackingChannelCorrelation::parse(buf)?); @@ -434,7 +427,7 @@ pub struct MsgTrackingIq { } impl MsgTrackingIq { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgTrackingIq { sender_id: None, channel: _buf.read_u8()?, @@ -469,17 +462,13 @@ pub struct TrackingChannelCorrelationDep { } impl TrackingChannelCorrelationDep { - pub fn parse( - _buf: &mut &[u8], - ) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(TrackingChannelCorrelationDep { I: _buf.read_i32::()?, Q: _buf.read_i32::()?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(TrackingChannelCorrelationDep::parse(buf)?); @@ -490,7 +479,7 @@ impl TrackingChannelCorrelationDep { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(TrackingChannelCorrelationDep::parse(buf)?); @@ -517,7 +506,7 @@ pub struct MsgTrackingIqDepB { } impl MsgTrackingIqDepB { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgTrackingIqDepB { sender_id: None, channel: _buf.read_u8()?, @@ -555,7 +544,7 @@ pub struct MsgTrackingIqDepA { } impl MsgTrackingIqDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgTrackingIqDepA { sender_id: None, channel: _buf.read_u8()?, @@ -592,16 +581,14 @@ pub struct TrackingChannelStateDepA { } impl TrackingChannelStateDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(TrackingChannelStateDepA { state: _buf.read_u8()?, prn: _buf.read_u8()?, cn0: _buf.read_f32::()?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(TrackingChannelStateDepA::parse(buf)?); @@ -612,7 +599,7 @@ impl TrackingChannelStateDepA { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(TrackingChannelStateDepA::parse(buf)?); @@ -634,7 +621,7 @@ pub struct MsgTrackingStateDepA { } impl MsgTrackingStateDepA { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgTrackingStateDepA { sender_id: None, states: TrackingChannelStateDepA::parse_array(_buf)?, @@ -669,16 +656,14 @@ pub struct TrackingChannelStateDepB { } impl TrackingChannelStateDepB { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(TrackingChannelStateDepB { state: _buf.read_u8()?, sid: GnssSignalDep::parse(_buf)?, cn0: _buf.read_f32::()?, }) } - pub fn parse_array( - buf: &mut &[u8], - ) -> Result, ::parser::MessageError> { + pub fn parse_array(buf: &mut &[u8]) -> Result, ::Error> { let mut v = Vec::new(); while buf.len() > 0 { v.push(TrackingChannelStateDepB::parse(buf)?); @@ -689,7 +674,7 @@ impl TrackingChannelStateDepB { pub fn parse_array_limit( buf: &mut &[u8], n: usize, - ) -> Result, ::parser::MessageError> { + ) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(TrackingChannelStateDepB::parse(buf)?); @@ -711,7 +696,7 @@ pub struct MsgTrackingStateDepB { } impl MsgTrackingStateDepB { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgTrackingStateDepB { sender_id: None, states: TrackingChannelStateDepB::parse_array(_buf)?, diff --git a/rust/sbp/src/messages/user.rs b/rust/sbp/src/messages/user.rs index 8e1adca926..94cbc1664b 100644 --- a/rust/sbp/src/messages/user.rs +++ b/rust/sbp/src/messages/user.rs @@ -31,7 +31,7 @@ pub struct MsgUserData { } impl MsgUserData { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgUserData { sender_id: None, contents: ::parser::read_u8_array(_buf)?, diff --git a/rust/sbp/src/messages/vehicle.rs b/rust/sbp/src/messages/vehicle.rs index 2b1cc9dc67..54b3324a8b 100644 --- a/rust/sbp/src/messages/vehicle.rs +++ b/rust/sbp/src/messages/vehicle.rs @@ -40,7 +40,7 @@ pub struct MsgOdometry { } impl MsgOdometry { - pub fn parse(_buf: &mut &[u8]) -> Result { + pub fn parse(_buf: &mut &[u8]) -> Result { Ok(MsgOdometry { sender_id: None, tow: _buf.read_u32::()?, diff --git a/rust/sbp/src/parser/mod.rs b/rust/sbp/src/parser/mod.rs index 00092a4f06..b0b495fe53 100644 --- a/rust/sbp/src/parser/mod.rs +++ b/rust/sbp/src/parser/mod.rs @@ -97,44 +97,27 @@ impl Parser { } } -pub enum MessageError { - ParseError, - IoError(io::Error), -} - -impl From for MessageError { - fn from(error: io::Error) -> Self { - MessageError::IoError(error) - } -} - -impl From for ::Error { - fn from(_: MessageError) -> Self { - ::Error::ParseError - } -} - impl From for ::Error { fn from(error: io::Error) -> Self { ::Error::IoError(error) } } -pub fn read_string(buf: &mut Read) -> Result { +pub fn read_string(buf: &mut Read) -> Result { let mut s = String::new(); buf.read_to_string(&mut s)?; Ok(s) } -pub fn read_string_limit(buf: &mut Read, n: u64) -> Result { +pub fn read_string_limit(buf: &mut Read, n: u64) -> Result { read_string(&mut buf.take(n)) } -pub fn read_u8_array(buf: &mut &[u8]) -> Result, MessageError> { +pub fn read_u8_array(buf: &mut &[u8]) -> Result, ::Error> { Ok(buf.to_vec()) } -pub fn read_u8_array_limit(buf: &mut &[u8], n: usize) -> Result, MessageError> { +pub fn read_u8_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(buf.read_u8()?); @@ -142,7 +125,7 @@ pub fn read_u8_array_limit(buf: &mut &[u8], n: usize) -> Result, Message Ok(v) } -pub fn read_s8_array_limit(buf: &mut &[u8], n: usize) -> Result, MessageError> { +pub fn read_s8_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(buf.read_i8()?); @@ -150,7 +133,7 @@ pub fn read_s8_array_limit(buf: &mut &[u8], n: usize) -> Result, Message Ok(v) } -pub fn read_s16_array_limit(buf: &mut &[u8], n: usize) -> Result, MessageError> { +pub fn read_s16_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(buf.read_i16::()?); @@ -158,7 +141,7 @@ pub fn read_s16_array_limit(buf: &mut &[u8], n: usize) -> Result, Messa Ok(v) } -pub fn read_u16_array_limit(buf: &mut &[u8], n: usize) -> Result, MessageError> { +pub fn read_u16_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(buf.read_u16::()?); @@ -166,7 +149,7 @@ pub fn read_u16_array_limit(buf: &mut &[u8], n: usize) -> Result, Messa Ok(v) } -pub fn read_float_array_limit(buf: &mut &[u8], n: usize) -> Result, MessageError> { +pub fn read_float_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(buf.read_f32::()?); @@ -174,7 +157,7 @@ pub fn read_float_array_limit(buf: &mut &[u8], n: usize) -> Result, Mes Ok(v) } -pub fn read_double_array_limit(buf: &mut &[u8], n: usize) -> Result, MessageError> { +pub fn read_double_array_limit(buf: &mut &[u8], n: usize) -> Result, ::Error> { let mut v = Vec::new(); for _ in 0..n { v.push(buf.read_f64::()?); From 7ce631e91004efedf9e877f677e056b7d7a01d7b Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Mon, 22 Jul 2019 09:03:09 -0700 Subject: [PATCH 22/25] Added a crate description and some missing doc comments about the parser module --- rust/sbp/Cargo.toml | 1 + rust/sbp/src/parser/mod.rs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/rust/sbp/Cargo.toml b/rust/sbp/Cargo.toml index aee596eeca..3d28c624c7 100644 --- a/rust/sbp/Cargo.toml +++ b/rust/sbp/Cargo.toml @@ -2,6 +2,7 @@ name = "sbp" version = "0.1.0" authors = ["Gareth McMullin "] +description = "Rust native implementation of SBP (Swift Binary Protocol) for communicating with devices made by Swift Navigation" [dependencies] byteorder = "1.2.1" diff --git a/rust/sbp/src/parser/mod.rs b/rust/sbp/src/parser/mod.rs index b0b495fe53..f6c5a58b65 100644 --- a/rust/sbp/src/parser/mod.rs +++ b/rust/sbp/src/parser/mod.rs @@ -8,6 +8,12 @@ use self::nom::sequence::tuple; use messages::SBP; use std::io::{self, Read}; +/// Attempts to extract a single SBP message from a data slice +/// +/// This function returns a tuple of a result and the number of bytes processed +/// from the slice. In regardless of the result the processed bytes should be +/// removed from the slice before calling `frame()` again. If the result is a +/// success then the SBP message has been fully validated. pub fn frame(input: &[u8]) -> (Result, usize) { let original_size = input.len(); let preamble = is_a("\x55"); @@ -41,6 +47,11 @@ pub fn frame(input: &[u8]) -> (Result, usize) { } } +/// A basic parser for SBP messages +/// +/// This object reads data from a source and attempts to read SBP messages from +/// the stream. A Parser buffers some data locally to reduce the number of +/// calls to read data. pub struct Parser { buffer: Vec, } @@ -48,10 +59,15 @@ pub struct Parser { impl Parser { const BUF_SIZE: usize = 1024usize; + /// Creates a new Parser object pub fn new() -> Parser { Parser { buffer: vec![0; 0] } } + /// Attempts to read a single SBP message from the input stream + /// + /// This function will read data from the input source as needed + /// until either a message is successfully parsed or an error occurs pub fn parse(&mut self, input: &mut R) -> Result { if self.buffer.len() == 0 { self.read_more(input)?; From bd6d619b63c8665878c4c6cd5ef5a8582d9cacff Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Mon, 22 Jul 2019 09:16:56 -0700 Subject: [PATCH 23/25] Fixed up the module level comments --- .../resources/sbp_messages_template.rs | 2 +- rust/sbp/src/lib.rs | 2 +- rust/sbp/src/messages/acquisition.rs | 3 +- rust/sbp/src/messages/bootload.rs | 10 +- rust/sbp/src/messages/ext_events.rs | 5 +- rust/sbp/src/messages/file_io.rs | 15 +- rust/sbp/src/messages/flash.rs | 10 +- rust/sbp/src/messages/gnss.rs | 3 +- rust/sbp/src/messages/imu.rs | 3 +- rust/sbp/src/messages/linux.rs | 3 +- rust/sbp/src/messages/logging.rs | 3 +- rust/sbp/src/messages/mag.rs | 3 +- rust/sbp/src/messages/mod.rs | 1268 ++++++++--------- rust/sbp/src/messages/navigation.rs | 33 +- rust/sbp/src/messages/ndb.rs | 3 +- rust/sbp/src/messages/observation.rs | 3 +- rust/sbp/src/messages/orientation.rs | 3 +- rust/sbp/src/messages/piksi.rs | 7 +- rust/sbp/src/messages/sbas.rs | 3 +- rust/sbp/src/messages/settings.rs | 51 +- rust/sbp/src/messages/ssr.rs | 3 +- rust/sbp/src/messages/system.rs | 3 +- rust/sbp/src/messages/tracking.rs | 3 +- rust/sbp/src/messages/user.rs | 3 +- rust/sbp/src/messages/vehicle.rs | 3 +- rust/sbp/src/parser/mod.rs | 2 + 26 files changed, 732 insertions(+), 718 deletions(-) diff --git a/generator/sbpg/targets/resources/sbp_messages_template.rs b/generator/sbpg/targets/resources/sbp_messages_template.rs index ae485906e7..14fc63e3d8 100644 --- a/generator/sbpg/targets/resources/sbp_messages_template.rs +++ b/generator/sbpg/targets/resources/sbp_messages_template.rs @@ -13,7 +13,7 @@ // with generate.py. Please do not hand edit! //****************************************************************************/ -(((description|commentify))) +//! (((description | replace("\n", " ") | wordwrap(width=75, wrapstring="\n //! ")))) extern crate byteorder; #[allow(unused_imports)] diff --git a/rust/sbp/src/lib.rs b/rust/sbp/src/lib.rs index 1cca8a067a..bf4ffcd29b 100644 --- a/rust/sbp/src/lib.rs +++ b/rust/sbp/src/lib.rs @@ -27,7 +27,7 @@ mod tests { y: 1327294, z: 631798, }; - let sbp_result = ::messages::SBP::parse(0x20b, 1234,&mut &baseline_ecef_payload[..]); + let sbp_result = ::messages::SBP::parse(0x20b, 1234, &mut &baseline_ecef_payload[..]); assert!(sbp_result.is_ok()); if let ::messages::SBP::MsgBaselineECEF(msg) = sbp_result.unwrap() { assert_eq!(msg.sender_id, baseline_ecef_expectation.sender_id); diff --git a/rust/sbp/src/messages/acquisition.rs b/rust/sbp/src/messages/acquisition.rs index a5a6a8e60f..e16bff45e5 100644 --- a/rust/sbp/src/messages/acquisition.rs +++ b/rust/sbp/src/messages/acquisition.rs @@ -12,7 +12,8 @@ // Automatically generated from yaml/swiftnav/sbp/acquisition.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Satellite acquisition messages from the device. +//! Satellite acquisition messages from the device. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/bootload.rs b/rust/sbp/src/messages/bootload.rs index 4be7b50a7f..3158b94956 100644 --- a/rust/sbp/src/messages/bootload.rs +++ b/rust/sbp/src/messages/bootload.rs @@ -12,11 +12,11 @@ // Automatically generated from yaml/swiftnav/sbp/bootload.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Messages for the bootloading configuration of a Piksi 2.3.1. This message -/// group does not apply to Piksi Multi. -/// -/// Note that some of these messages share the same message type ID for both the -/// host request and the device response. +//! Messages for the bootloading configuration of a Piksi 2.3.1. This message +//! group does not apply to Piksi Multi. Note that some of these messages +//! share the same message type ID for both the host request and the device +//! response. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/ext_events.rs b/rust/sbp/src/messages/ext_events.rs index 4af1295bf6..9ed6fccc19 100644 --- a/rust/sbp/src/messages/ext_events.rs +++ b/rust/sbp/src/messages/ext_events.rs @@ -12,8 +12,9 @@ // Automatically generated from yaml/swiftnav/sbp/ext_events.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Messages reporting accurately-timestamped external events, -/// e.g. camera shutter time. +//! Messages reporting accurately-timestamped external events, e.g. camera +//! shutter time. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/file_io.rs b/rust/sbp/src/messages/file_io.rs index 587a15cc6e..1c891e6fd5 100644 --- a/rust/sbp/src/messages/file_io.rs +++ b/rust/sbp/src/messages/file_io.rs @@ -12,14 +12,13 @@ // Automatically generated from yaml/swiftnav/sbp/file_io.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Messages for using device's onboard flash filesystem -/// functionality. This allows data to be stored persistently in the -/// device's program flash with wear-levelling using a simple filesystem -/// interface. The file system interface (CFS) defines an abstract API -/// for reading directories and for reading and writing files. -/// -/// Note that some of these messages share the same message type ID for both the -/// host request and the device response. +//! Messages for using device's onboard flash filesystem functionality. This +//! allows data to be stored persistently in the device's program flash with +//! wear-levelling using a simple filesystem interface. The file system +//! interface (CFS) defines an abstract API for reading directories and for +//! reading and writing files. Note that some of these messages share the same +//! message type ID for both the host request and the device response. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/flash.rs b/rust/sbp/src/messages/flash.rs index 722cd2b811..be757b5373 100644 --- a/rust/sbp/src/messages/flash.rs +++ b/rust/sbp/src/messages/flash.rs @@ -12,11 +12,11 @@ // Automatically generated from yaml/swiftnav/sbp/flash.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Messages for reading/writing the device's onboard flash memory. Many -/// of these messages target specific flash memory peripherals used in -/// Swift Navigation devices: the STM32 flash and the M25Pxx FPGA -/// configuration flash from Piksi 2.3.1. This module does not apply -/// to Piksi Multi. +//! Messages for reading/writing the device's onboard flash memory. Many of +//! these messages target specific flash memory peripherals used in Swift +//! Navigation devices: the STM32 flash and the M25Pxx FPGA configuration flash +//! from Piksi 2.3.1. This module does not apply to Piksi Multi. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/gnss.rs b/rust/sbp/src/messages/gnss.rs index 5e7c95c84a..3a5a9971ef 100644 --- a/rust/sbp/src/messages/gnss.rs +++ b/rust/sbp/src/messages/gnss.rs @@ -12,7 +12,8 @@ // Automatically generated from yaml/swiftnav/sbp/gnss.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Various structs shared between modules +//! Various structs shared between modules + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/imu.rs b/rust/sbp/src/messages/imu.rs index c7438cd76c..1215e038e7 100644 --- a/rust/sbp/src/messages/imu.rs +++ b/rust/sbp/src/messages/imu.rs @@ -12,7 +12,8 @@ // Automatically generated from yaml/swiftnav/sbp/imu.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Inertial Measurement Unit (IMU) messages. +//! Inertial Measurement Unit (IMU) messages. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/linux.rs b/rust/sbp/src/messages/linux.rs index 12515efc75..31959c4e18 100644 --- a/rust/sbp/src/messages/linux.rs +++ b/rust/sbp/src/messages/linux.rs @@ -12,7 +12,8 @@ // Automatically generated from yaml/swiftnav/sbp/linux.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Linux state monitoring. +//! Linux state monitoring. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/logging.rs b/rust/sbp/src/messages/logging.rs index 03a45d0d2a..940452f95c 100644 --- a/rust/sbp/src/messages/logging.rs +++ b/rust/sbp/src/messages/logging.rs @@ -12,7 +12,8 @@ // Automatically generated from yaml/swiftnav/sbp/logging.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Logging and debugging messages from the device. +//! Logging and debugging messages from the device. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/mag.rs b/rust/sbp/src/messages/mag.rs index d742703c45..23d7e266a9 100644 --- a/rust/sbp/src/messages/mag.rs +++ b/rust/sbp/src/messages/mag.rs @@ -12,7 +12,8 @@ // Automatically generated from yaml/swiftnav/sbp/mag.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Magnetometer (mag) messages. +//! Magnetometer (mag) messages. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/mod.rs b/rust/sbp/src/messages/mod.rs index f8715d9b1e..06eb1833ef 100644 --- a/rust/sbp/src/messages/mod.rs +++ b/rust/sbp/src/messages/mod.rs @@ -217,32 +217,73 @@ pub enum SBP { sender_id: u16, payload: Vec, }, + MsgAcqSvProfile(MsgAcqSvProfile), + MsgAcqSvProfileDep(MsgAcqSvProfileDep), + MsgSbasRaw(MsgSbasRaw), + MsgOdometry(MsgOdometry), + MsgTrackingStateDetailedDepA(MsgTrackingStateDetailedDepA), + MsgTrackingStateDetailedDep(MsgTrackingStateDetailedDep), + MsgTrackingState(MsgTrackingState), + MsgMeasurementState(MsgMeasurementState), + MsgTrackingIq(MsgTrackingIq), + MsgTrackingIqDepB(MsgTrackingIqDepB), + MsgTrackingIqDepA(MsgTrackingIqDepA), + MsgTrackingStateDepA(MsgTrackingStateDepA), + MsgTrackingStateDepB(MsgTrackingStateDepB), + MsgExtEvent(MsgExtEvent), + MsgFlashProgram(MsgFlashProgram), + MsgFlashDone(MsgFlashDone), + MsgFlashReadReq(MsgFlashReadReq), + MsgFlashReadResp(MsgFlashReadResp), + MsgFlashErase(MsgFlashErase), + MsgStmFlashLockSector(MsgStmFlashLockSector), + MsgStmFlashUnlockSector(MsgStmFlashUnlockSector), + MsgStmUniqueIdReq(MsgStmUniqueIdReq), + MsgStmUniqueIdResp(MsgStmUniqueIdResp), + MsgM25FlashWriteStatus(MsgM25FlashWriteStatus), + MsgMagRaw(MsgMagRaw), + MsgAngularRate(MsgAngularRate), + MsgNdbEvent(MsgNdbEvent), + MsgSsrOrbitClock(MsgSsrOrbitClock), + MsgSsrOrbitClockDepA(MsgSsrOrbitClockDepA), + MsgSsrCodeBiases(MsgSsrCodeBiases), + MsgSsrPhaseBiases(MsgSsrPhaseBiases), + MsgSsrStecCorrection(MsgSsrStecCorrection), + MsgSsrGriddedCorrection(MsgSsrGriddedCorrection), + MsgSsrGridDefinition(MsgSsrGridDefinition), + MsgLinuxCpuState(MsgLinuxCpuState), + MsgLinuxMemState(MsgLinuxMemState), + MsgLinuxSysState(MsgLinuxSysState), + MsgLinuxProcessSocketCounts(MsgLinuxProcessSocketCounts), + MsgBaselineHeading(MsgBaselineHeading), + MsgOrientQuat(MsgOrientQuat), + MsgOrientEuler(MsgOrientEuler), + MsgImuRaw(MsgImuRaw), + MsgImuAux(MsgImuAux), + MsgObs(MsgObs), + MsgBasePosLLH(MsgBasePosLLH), + MsgBasePosECEF(MsgBasePosECEF), + MsgEphemerisGPSDepE(MsgEphemerisGPSDepE), + MsgEphemerisGPSDepF(MsgEphemerisGPSDepF), + MsgEphemerisQzss(MsgEphemerisQzss), + MsgEphemerisBds(MsgEphemerisBds), + MsgEphemerisGPS(MsgEphemerisGPS), + MsgEphemerisGalDepA(MsgEphemerisGalDepA), + MsgEphemerisGal(MsgEphemerisGal), + MsgEphemerisSbasDepA(MsgEphemerisSbasDepA), + MsgEphemerisGloDepA(MsgEphemerisGloDepA), + MsgEphemerisSbasDepB(MsgEphemerisSbasDepB), + MsgEphemerisSbas(MsgEphemerisSbas), + MsgEphemerisGloDepB(MsgEphemerisGloDepB), MsgEphemerisGloDepC(MsgEphemerisGloDepC), - MsgEphemerisGloDepD(MsgEphemerisGloDepD), - MsgEphemerisGlo(MsgEphemerisGlo), - MsgEphemerisDepD(MsgEphemerisDepD), - MsgEphemerisDepA(MsgEphemerisDepA), - MsgEphemerisDepB(MsgEphemerisDepB), - MsgEphemerisDepC(MsgEphemerisDepC), - MsgObsDepA(MsgObsDepA), - MsgObsDepB(MsgObsDepB), - MsgObsDepC(MsgObsDepC), - MsgIono(MsgIono), - MsgSvConfigurationGPSDep(MsgSvConfigurationGPSDep), - MsgGnssCapb(MsgGnssCapb), - MsgGroupDelayDepA(MsgGroupDelayDepA), - MsgGroupDelayDepB(MsgGroupDelayDepB), - MsgGroupDelay(MsgGroupDelay), - MsgAlmanacGPSDep(MsgAlmanacGPSDep), - MsgAlmanacGPS(MsgAlmanacGPS), - MsgAlmanacGloDep(MsgAlmanacGloDep), - MsgAlmanacGlo(MsgAlmanacGlo), - MsgGloBiases(MsgGloBiases), - MsgSvAzEl(MsgSvAzEl), - MsgOsr(MsgOsr), - MsgGPSTime(MsgGPSTime), + MsgLinuxProcessSocketQueues(MsgLinuxProcessSocketQueues), + MsgLinuxSocketUsage(MsgLinuxSocketUsage), MsgUtcTime(MsgUtcTime), MsgDops(MsgDops), + MsgLinuxProcessFdCount(MsgLinuxProcessFdCount), + MsgLinuxProcessFdSummary(MsgLinuxProcessFdSummary), + MsgUserData(MsgUserData), + MsgGPSTime(MsgGPSTime), MsgPosECEF(MsgPosECEF), MsgPosECEFCov(MsgPosECEFCov), MsgPosLLH(MsgPosLLH), @@ -253,6 +294,44 @@ pub enum SBP { MsgVelECEFCov(MsgVelECEFCov), MsgVelNED(MsgVelNED), MsgVelNEDCov(MsgVelNEDCov), + MsgEphemerisGloDepD(MsgEphemerisGloDepD), + MsgEphemerisGlo(MsgEphemerisGlo), + MsgEphemerisDepD(MsgEphemerisDepD), + MsgEphemerisDepA(MsgEphemerisDepA), + MsgEphemerisDepB(MsgEphemerisDepB), + MsgEphemerisDepC(MsgEphemerisDepC), + MsgInsStatus(MsgInsStatus), + MsgCsacTelemetry(MsgCsacTelemetry), + MsgCsacTelemetryLabels(MsgCsacTelemetryLabels), + MsgAlmanac(MsgAlmanac), + MsgSetTime(MsgSetTime), + MsgReset(MsgReset), + MsgResetDep(MsgResetDep), + MsgCwResults(MsgCwResults), + MsgCwStart(MsgCwStart), + MsgResetFilters(MsgResetFilters), + MsgInitBaseDep(MsgInitBaseDep), + MsgThreadState(MsgThreadState), + MsgUartState(MsgUartState), + MsgUartStateDepa(MsgUartStateDepa), + MsgIarState(MsgIarState), + MsgMaskSatellite(MsgMaskSatellite), + MsgMaskSatelliteDep(MsgMaskSatelliteDep), + MsgDeviceMonitor(MsgDeviceMonitor), + MsgCommandReq(MsgCommandReq), + MsgCommandResp(MsgCommandResp), + MsgCommandOutput(MsgCommandOutput), + MsgNetworkStateReq(MsgNetworkStateReq), + MsgNetworkStateResp(MsgNetworkStateResp), + MsgNetworkBandwidthUsage(MsgNetworkBandwidthUsage), + MsgCellModemStatus(MsgCellModemStatus), + MsgSpecanDep(MsgSpecanDep), + MsgSpecan(MsgSpecan), + MsgFrontEndGain(MsgFrontEndGain), + MsgAcqResult(MsgAcqResult), + MsgAcqResultDepC(MsgAcqResultDepC), + MsgAcqResultDepB(MsgAcqResultDepB), + MsgAcqResultDepA(MsgAcqResultDepA), MsgVelBody(MsgVelBody), MsgAgeCorrections(MsgAgeCorrections), MsgGPSTimeDepA(MsgGPSTimeDepA), @@ -264,82 +343,18 @@ pub enum SBP { MsgVelECEFDepA(MsgVelECEFDepA), MsgVelNEDDepA(MsgVelNEDDepA), MsgBaselineHeadingDepA(MsgBaselineHeadingDepA), - MsgOdometry(MsgOdometry), - MsgFileioReadDirResp(MsgFileioReadDirResp), MsgFileioReadReq(MsgFileioReadReq), MsgFileioReadResp(MsgFileioReadResp), MsgFileioReadDirReq(MsgFileioReadDirReq), + MsgFileioReadDirResp(MsgFileioReadDirResp), MsgFileioRemove(MsgFileioRemove), MsgFileioWriteReq(MsgFileioWriteReq), MsgFileioWriteResp(MsgFileioWriteResp), MsgFileioConfigReq(MsgFileioConfigReq), MsgFileioConfigResp(MsgFileioConfigResp), - MsgBaselineHeading(MsgBaselineHeading), - MsgOrientQuat(MsgOrientQuat), - MsgOrientEuler(MsgOrientEuler), - MsgAngularRate(MsgAngularRate), - MsgStartup(MsgStartup), - MsgDgnssStatus(MsgDgnssStatus), - MsgHeartbeat(MsgHeartbeat), - MsgInsStatus(MsgInsStatus), - MsgCsacTelemetry(MsgCsacTelemetry), - MsgCsacTelemetryLabels(MsgCsacTelemetryLabels), - MsgImuRaw(MsgImuRaw), - MsgImuAux(MsgImuAux), - MsgBootloaderHandshakeReq(MsgBootloaderHandshakeReq), - MsgBootloaderHandshakeResp(MsgBootloaderHandshakeResp), - MsgBootloaderJumpToApp(MsgBootloaderJumpToApp), - MsgNapDeviceDnaReq(MsgNapDeviceDnaReq), - MsgNapDeviceDnaResp(MsgNapDeviceDnaResp), - MsgBootloaderHandshakeDepA(MsgBootloaderHandshakeDepA), - MsgSbasRaw(MsgSbasRaw), - MsgObs(MsgObs), - MsgBasePosLLH(MsgBasePosLLH), - MsgBasePosECEF(MsgBasePosECEF), - MsgEphemerisGPSDepE(MsgEphemerisGPSDepE), - MsgEphemerisGPSDepF(MsgEphemerisGPSDepF), - MsgEphemerisGPS(MsgEphemerisGPS), - MsgSsrOrbitClock(MsgSsrOrbitClock), - MsgTrackingIqDepA(MsgTrackingIqDepA), - MsgTrackingStateDepA(MsgTrackingStateDepA), - MsgTrackingStateDepB(MsgTrackingStateDepB), - MsgSsrOrbitClockDepA(MsgSsrOrbitClockDepA), - MsgSsrCodeBiases(MsgSsrCodeBiases), - MsgSsrPhaseBiases(MsgSsrPhaseBiases), - MsgSsrStecCorrection(MsgSsrStecCorrection), - MsgSsrGriddedCorrection(MsgSsrGriddedCorrection), - MsgSsrGridDefinition(MsgSsrGridDefinition), - MsgMagRaw(MsgMagRaw), - MsgAlmanac(MsgAlmanac), - MsgSetTime(MsgSetTime), - MsgReset(MsgReset), - MsgResetDep(MsgResetDep), - MsgCwResults(MsgCwResults), - MsgCwStart(MsgCwStart), - MsgResetFilters(MsgResetFilters), - MsgInitBaseDep(MsgInitBaseDep), - MsgThreadState(MsgThreadState), - MsgEphemerisQzss(MsgEphemerisQzss), - MsgEphemerisBds(MsgEphemerisBds), - MsgEphemerisGalDepA(MsgEphemerisGalDepA), - MsgEphemerisGal(MsgEphemerisGal), - MsgEphemerisSbasDepA(MsgEphemerisSbasDepA), - MsgEphemerisGloDepA(MsgEphemerisGloDepA), - MsgEphemerisSbasDepB(MsgEphemerisSbasDepB), - MsgEphemerisSbas(MsgEphemerisSbas), - MsgEphemerisGloDepB(MsgEphemerisGloDepB), MsgLog(MsgLog), - MsgAcqSvProfile(MsgAcqSvProfile), - MsgAcqSvProfileDep(MsgAcqSvProfileDep), MsgFwd(MsgFwd), MsgPrintDep(MsgPrintDep), - MsgNdbEvent(MsgNdbEvent), - MsgTrackingStateDetailedDepA(MsgTrackingStateDetailedDepA), - MsgTrackingStateDetailedDep(MsgTrackingStateDetailedDep), - MsgMeasurementState(MsgMeasurementState), - MsgTrackingIq(MsgTrackingIq), - MsgTrackingState(MsgTrackingState), - MsgTrackingIqDepB(MsgTrackingIqDepB), MsgSettingsSave(MsgSettingsSave), MsgSettingsWrite(MsgSettingsWrite), MsgSettingsWriteResp(MsgSettingsWriteResp), @@ -350,515 +365,465 @@ pub enum SBP { MsgSettingsReadByIndexDone(MsgSettingsReadByIndexDone), MsgSettingsRegister(MsgSettingsRegister), MsgSettingsRegisterResp(MsgSettingsRegisterResp), - MsgUserData(MsgUserData), - MsgAcqResult(MsgAcqResult), - MsgExtEvent(MsgExtEvent), - MsgAcqResultDepC(MsgAcqResultDepC), - MsgAcqResultDepB(MsgAcqResultDepB), - MsgAcqResultDepA(MsgAcqResultDepA), - MsgUartState(MsgUartState), - MsgUartStateDepa(MsgUartStateDepa), - MsgIarState(MsgIarState), - MsgMaskSatellite(MsgMaskSatellite), - MsgMaskSatelliteDep(MsgMaskSatelliteDep), - MsgDeviceMonitor(MsgDeviceMonitor), - MsgCommandReq(MsgCommandReq), - MsgCommandResp(MsgCommandResp), - MsgCommandOutput(MsgCommandOutput), - MsgNetworkStateReq(MsgNetworkStateReq), - MsgNetworkStateResp(MsgNetworkStateResp), - MsgNetworkBandwidthUsage(MsgNetworkBandwidthUsage), - MsgCellModemStatus(MsgCellModemStatus), - MsgSpecanDep(MsgSpecanDep), - MsgSpecan(MsgSpecan), - MsgFrontEndGain(MsgFrontEndGain), - MsgLinuxCpuState(MsgLinuxCpuState), - MsgLinuxMemState(MsgLinuxMemState), - MsgLinuxSysState(MsgLinuxSysState), - MsgLinuxProcessSocketCounts(MsgLinuxProcessSocketCounts), - MsgLinuxProcessSocketQueues(MsgLinuxProcessSocketQueues), - MsgLinuxSocketUsage(MsgLinuxSocketUsage), - MsgLinuxProcessFdCount(MsgLinuxProcessFdCount), - MsgLinuxProcessFdSummary(MsgLinuxProcessFdSummary), - MsgFlashProgram(MsgFlashProgram), - MsgFlashDone(MsgFlashDone), - MsgFlashReadReq(MsgFlashReadReq), - MsgFlashReadResp(MsgFlashReadResp), - MsgFlashErase(MsgFlashErase), - MsgStmFlashLockSector(MsgStmFlashLockSector), - MsgStmFlashUnlockSector(MsgStmFlashUnlockSector), - MsgStmUniqueIdReq(MsgStmUniqueIdReq), - MsgStmUniqueIdResp(MsgStmUniqueIdResp), - MsgM25FlashWriteStatus(MsgM25FlashWriteStatus), + MsgBootloaderHandshakeReq(MsgBootloaderHandshakeReq), + MsgBootloaderHandshakeResp(MsgBootloaderHandshakeResp), + MsgBootloaderJumpToApp(MsgBootloaderJumpToApp), + MsgNapDeviceDnaReq(MsgNapDeviceDnaReq), + MsgBootloaderHandshakeDepA(MsgBootloaderHandshakeDepA), + MsgNapDeviceDnaResp(MsgNapDeviceDnaResp), + MsgDgnssStatus(MsgDgnssStatus), + MsgHeartbeat(MsgHeartbeat), + MsgStartup(MsgStartup), + MsgObsDepA(MsgObsDepA), + MsgObsDepB(MsgObsDepB), + MsgObsDepC(MsgObsDepC), + MsgIono(MsgIono), + MsgSvConfigurationGPSDep(MsgSvConfigurationGPSDep), + MsgGnssCapb(MsgGnssCapb), + MsgAlmanacGPSDep(MsgAlmanacGPSDep), + MsgAlmanacGPS(MsgAlmanacGPS), + MsgGroupDelayDepA(MsgGroupDelayDepA), + MsgGroupDelayDepB(MsgGroupDelayDepB), + MsgGroupDelay(MsgGroupDelay), + MsgGloBiases(MsgGloBiases), + MsgSvAzEl(MsgSvAzEl), + MsgOsr(MsgOsr), + MsgAlmanacGloDep(MsgAlmanacGloDep), + MsgAlmanacGlo(MsgAlmanacGlo), } impl SBP { pub fn parse(msg_id: u16, sender_id: u16, payload: &mut &[u8]) -> Result { let x: Result = match msg_id { - 135 => { - let mut msg = MsgEphemerisGloDepC::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGloDepC(msg)) - } - 136 => { - let mut msg = MsgEphemerisGloDepD::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGloDepD(msg)) - } - 139 => { - let mut msg = MsgEphemerisGlo::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGlo(msg)) - } - 128 => { - let mut msg = MsgEphemerisDepD::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisDepD(msg)) - } - 26 => { - let mut msg = MsgEphemerisDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisDepA(msg)) - } - 70 => { - let mut msg = MsgEphemerisDepB::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisDepB(msg)) - } - 71 => { - let mut msg = MsgEphemerisDepC::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisDepC(msg)) - } - 69 => { - let mut msg = MsgObsDepA::parse(payload)?; + 46 => { + let mut msg = MsgAcqSvProfile::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgObsDepA(msg)) + Ok(SBP::MsgAcqSvProfile(msg)) } - 67 => { - let mut msg = MsgObsDepB::parse(payload)?; + 30 => { + let mut msg = MsgAcqSvProfileDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgObsDepB(msg)) + Ok(SBP::MsgAcqSvProfileDep(msg)) } - 73 => { - let mut msg = MsgObsDepC::parse(payload)?; + 30583 => { + let mut msg = MsgSbasRaw::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgObsDepC(msg)) + Ok(SBP::MsgSbasRaw(msg)) } - 144 => { - let mut msg = MsgIono::parse(payload)?; + 2307 => { + let mut msg = MsgOdometry::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgIono(msg)) + Ok(SBP::MsgOdometry(msg)) } - 145 => { - let mut msg = MsgSvConfigurationGPSDep::parse(payload)?; + 33 => { + let mut msg = MsgTrackingStateDetailedDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSvConfigurationGPSDep(msg)) + Ok(SBP::MsgTrackingStateDetailedDepA(msg)) } - 150 => { - let mut msg = MsgGnssCapb::parse(payload)?; + 17 => { + let mut msg = MsgTrackingStateDetailedDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgGnssCapb(msg)) + Ok(SBP::MsgTrackingStateDetailedDep(msg)) } - 146 => { - let mut msg = MsgGroupDelayDepA::parse(payload)?; + 65 => { + let mut msg = MsgTrackingState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgGroupDelayDepA(msg)) + Ok(SBP::MsgTrackingState(msg)) } - 147 => { - let mut msg = MsgGroupDelayDepB::parse(payload)?; + 97 => { + let mut msg = MsgMeasurementState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgGroupDelayDepB(msg)) + Ok(SBP::MsgMeasurementState(msg)) } - 148 => { - let mut msg = MsgGroupDelay::parse(payload)?; + 45 => { + let mut msg = MsgTrackingIq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgGroupDelay(msg)) + Ok(SBP::MsgTrackingIq(msg)) } - 112 => { - let mut msg = MsgAlmanacGPSDep::parse(payload)?; + 44 => { + let mut msg = MsgTrackingIqDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanacGPSDep(msg)) + Ok(SBP::MsgTrackingIqDepB(msg)) } - 114 => { - let mut msg = MsgAlmanacGPS::parse(payload)?; + 28 => { + let mut msg = MsgTrackingIqDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanacGPS(msg)) + Ok(SBP::MsgTrackingIqDepA(msg)) } - 113 => { - let mut msg = MsgAlmanacGloDep::parse(payload)?; + 22 => { + let mut msg = MsgTrackingStateDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanacGloDep(msg)) + Ok(SBP::MsgTrackingStateDepA(msg)) } - 115 => { - let mut msg = MsgAlmanacGlo::parse(payload)?; + 19 => { + let mut msg = MsgTrackingStateDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanacGlo(msg)) + Ok(SBP::MsgTrackingStateDepB(msg)) } - 117 => { - let mut msg = MsgGloBiases::parse(payload)?; + 257 => { + let mut msg = MsgExtEvent::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgGloBiases(msg)) + Ok(SBP::MsgExtEvent(msg)) } - 151 => { - let mut msg = MsgSvAzEl::parse(payload)?; + 230 => { + let mut msg = MsgFlashProgram::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSvAzEl(msg)) + Ok(SBP::MsgFlashProgram(msg)) } - 1600 => { - let mut msg = MsgOsr::parse(payload)?; + 224 => { + let mut msg = MsgFlashDone::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgOsr(msg)) + Ok(SBP::MsgFlashDone(msg)) } - 258 => { - let mut msg = MsgGPSTime::parse(payload)?; + 231 => { + let mut msg = MsgFlashReadReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgGPSTime(msg)) + Ok(SBP::MsgFlashReadReq(msg)) } - 259 => { - let mut msg = MsgUtcTime::parse(payload)?; + 225 => { + let mut msg = MsgFlashReadResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgUtcTime(msg)) + Ok(SBP::MsgFlashReadResp(msg)) } - 520 => { - let mut msg = MsgDops::parse(payload)?; + 226 => { + let mut msg = MsgFlashErase::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgDops(msg)) + Ok(SBP::MsgFlashErase(msg)) } - 521 => { - let mut msg = MsgPosECEF::parse(payload)?; + 227 => { + let mut msg = MsgStmFlashLockSector::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPosECEF(msg)) + Ok(SBP::MsgStmFlashLockSector(msg)) } - 532 => { - let mut msg = MsgPosECEFCov::parse(payload)?; + 228 => { + let mut msg = MsgStmFlashUnlockSector::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPosECEFCov(msg)) + Ok(SBP::MsgStmFlashUnlockSector(msg)) } - 522 => { - let mut msg = MsgPosLLH::parse(payload)?; + 232 => { + let mut msg = MsgStmUniqueIdReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPosLLH(msg)) + Ok(SBP::MsgStmUniqueIdReq(msg)) } - 529 => { - let mut msg = MsgPosLLHCov::parse(payload)?; + 229 => { + let mut msg = MsgStmUniqueIdResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPosLLHCov(msg)) + Ok(SBP::MsgStmUniqueIdResp(msg)) } - 523 => { - let mut msg = MsgBaselineECEF::parse(payload)?; + 243 => { + let mut msg = MsgM25FlashWriteStatus::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineECEF(msg)) + Ok(SBP::MsgM25FlashWriteStatus(msg)) } - 524 => { - let mut msg = MsgBaselineNED::parse(payload)?; + 2306 => { + let mut msg = MsgMagRaw::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineNED(msg)) + Ok(SBP::MsgMagRaw(msg)) } - 525 => { - let mut msg = MsgVelECEF::parse(payload)?; + 546 => { + let mut msg = MsgAngularRate::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgVelECEF(msg)) + Ok(SBP::MsgAngularRate(msg)) } - 533 => { - let mut msg = MsgVelECEFCov::parse(payload)?; + 1024 => { + let mut msg = MsgNdbEvent::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgVelECEFCov(msg)) + Ok(SBP::MsgNdbEvent(msg)) } - 526 => { - let mut msg = MsgVelNED::parse(payload)?; + 1501 => { + let mut msg = MsgSsrOrbitClock::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgVelNED(msg)) + Ok(SBP::MsgSsrOrbitClock(msg)) } - 530 => { - let mut msg = MsgVelNEDCov::parse(payload)?; + 1500 => { + let mut msg = MsgSsrOrbitClockDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgVelNEDCov(msg)) + Ok(SBP::MsgSsrOrbitClockDepA(msg)) } - 531 => { - let mut msg = MsgVelBody::parse(payload)?; + 1505 => { + let mut msg = MsgSsrCodeBiases::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgVelBody(msg)) + Ok(SBP::MsgSsrCodeBiases(msg)) } - 528 => { - let mut msg = MsgAgeCorrections::parse(payload)?; + 1510 => { + let mut msg = MsgSsrPhaseBiases::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAgeCorrections(msg)) + Ok(SBP::MsgSsrPhaseBiases(msg)) } - 256 => { - let mut msg = MsgGPSTimeDepA::parse(payload)?; + 1515 => { + let mut msg = MsgSsrStecCorrection::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgGPSTimeDepA(msg)) + Ok(SBP::MsgSsrStecCorrection(msg)) } - 518 => { - let mut msg = MsgDopsDepA::parse(payload)?; + 1520 => { + let mut msg = MsgSsrGriddedCorrection::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgDopsDepA(msg)) + Ok(SBP::MsgSsrGriddedCorrection(msg)) } - 512 => { - let mut msg = MsgPosECEFDepA::parse(payload)?; + 1525 => { + let mut msg = MsgSsrGridDefinition::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPosECEFDepA(msg)) + Ok(SBP::MsgSsrGridDefinition(msg)) } - 513 => { - let mut msg = MsgPosLLHDepA::parse(payload)?; + 32512 => { + let mut msg = MsgLinuxCpuState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPosLLHDepA(msg)) + Ok(SBP::MsgLinuxCpuState(msg)) } - 514 => { - let mut msg = MsgBaselineECEFDepA::parse(payload)?; + 32513 => { + let mut msg = MsgLinuxMemState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineECEFDepA(msg)) + Ok(SBP::MsgLinuxMemState(msg)) } - 515 => { - let mut msg = MsgBaselineNEDDepA::parse(payload)?; + 32514 => { + let mut msg = MsgLinuxSysState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineNEDDepA(msg)) + Ok(SBP::MsgLinuxSysState(msg)) } - 516 => { - let mut msg = MsgVelECEFDepA::parse(payload)?; + 32515 => { + let mut msg = MsgLinuxProcessSocketCounts::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgVelECEFDepA(msg)) + Ok(SBP::MsgLinuxProcessSocketCounts(msg)) } - 517 => { - let mut msg = MsgVelNEDDepA::parse(payload)?; + 527 => { + let mut msg = MsgBaselineHeading::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgVelNEDDepA(msg)) + Ok(SBP::MsgBaselineHeading(msg)) } - 519 => { - let mut msg = MsgBaselineHeadingDepA::parse(payload)?; + 544 => { + let mut msg = MsgOrientQuat::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineHeadingDepA(msg)) + Ok(SBP::MsgOrientQuat(msg)) } - 2307 => { - let mut msg = MsgOdometry::parse(payload)?; + 545 => { + let mut msg = MsgOrientEuler::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgOdometry(msg)) + Ok(SBP::MsgOrientEuler(msg)) } - 170 => { - let mut msg = MsgFileioReadDirResp::parse(payload)?; + 2304 => { + let mut msg = MsgImuRaw::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioReadDirResp(msg)) + Ok(SBP::MsgImuRaw(msg)) } - 168 => { - let mut msg = MsgFileioReadReq::parse(payload)?; + 2305 => { + let mut msg = MsgImuAux::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioReadReq(msg)) + Ok(SBP::MsgImuAux(msg)) } - 163 => { - let mut msg = MsgFileioReadResp::parse(payload)?; + 74 => { + let mut msg = MsgObs::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioReadResp(msg)) + Ok(SBP::MsgObs(msg)) } - 169 => { - let mut msg = MsgFileioReadDirReq::parse(payload)?; + 68 => { + let mut msg = MsgBasePosLLH::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioReadDirReq(msg)) + Ok(SBP::MsgBasePosLLH(msg)) } - 172 => { - let mut msg = MsgFileioRemove::parse(payload)?; + 72 => { + let mut msg = MsgBasePosECEF::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioRemove(msg)) + Ok(SBP::MsgBasePosECEF(msg)) } - 173 => { - let mut msg = MsgFileioWriteReq::parse(payload)?; + 129 => { + let mut msg = MsgEphemerisGPSDepE::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioWriteReq(msg)) + Ok(SBP::MsgEphemerisGPSDepE(msg)) } - 171 => { - let mut msg = MsgFileioWriteResp::parse(payload)?; + 134 => { + let mut msg = MsgEphemerisGPSDepF::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioWriteResp(msg)) + Ok(SBP::MsgEphemerisGPSDepF(msg)) } - 4097 => { - let mut msg = MsgFileioConfigReq::parse(payload)?; + 142 => { + let mut msg = MsgEphemerisQzss::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioConfigReq(msg)) + Ok(SBP::MsgEphemerisQzss(msg)) } - 4098 => { - let mut msg = MsgFileioConfigResp::parse(payload)?; + 137 => { + let mut msg = MsgEphemerisBds::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioConfigResp(msg)) + Ok(SBP::MsgEphemerisBds(msg)) } - 527 => { - let mut msg = MsgBaselineHeading::parse(payload)?; + 138 => { + let mut msg = MsgEphemerisGPS::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineHeading(msg)) + Ok(SBP::MsgEphemerisGPS(msg)) } - 544 => { - let mut msg = MsgOrientQuat::parse(payload)?; + 149 => { + let mut msg = MsgEphemerisGalDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgOrientQuat(msg)) + Ok(SBP::MsgEphemerisGalDepA(msg)) } - 545 => { - let mut msg = MsgOrientEuler::parse(payload)?; + 141 => { + let mut msg = MsgEphemerisGal::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgOrientEuler(msg)) + Ok(SBP::MsgEphemerisGal(msg)) } - 546 => { - let mut msg = MsgAngularRate::parse(payload)?; + 130 => { + let mut msg = MsgEphemerisSbasDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAngularRate(msg)) + Ok(SBP::MsgEphemerisSbasDepA(msg)) } - 65280 => { - let mut msg = MsgStartup::parse(payload)?; + 131 => { + let mut msg = MsgEphemerisGloDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgStartup(msg)) + Ok(SBP::MsgEphemerisGloDepA(msg)) } - 65282 => { - let mut msg = MsgDgnssStatus::parse(payload)?; + 132 => { + let mut msg = MsgEphemerisSbasDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgDgnssStatus(msg)) + Ok(SBP::MsgEphemerisSbasDepB(msg)) } - 65535 => { - let mut msg = MsgHeartbeat::parse(payload)?; + 140 => { + let mut msg = MsgEphemerisSbas::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgHeartbeat(msg)) + Ok(SBP::MsgEphemerisSbas(msg)) } - 65283 => { - let mut msg = MsgInsStatus::parse(payload)?; + 133 => { + let mut msg = MsgEphemerisGloDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgInsStatus(msg)) + Ok(SBP::MsgEphemerisGloDepB(msg)) } - 65284 => { - let mut msg = MsgCsacTelemetry::parse(payload)?; + 135 => { + let mut msg = MsgEphemerisGloDepC::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCsacTelemetry(msg)) + Ok(SBP::MsgEphemerisGloDepC(msg)) } - 65285 => { - let mut msg = MsgCsacTelemetryLabels::parse(payload)?; + 32516 => { + let mut msg = MsgLinuxProcessSocketQueues::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCsacTelemetryLabels(msg)) + Ok(SBP::MsgLinuxProcessSocketQueues(msg)) } - 2304 => { - let mut msg = MsgImuRaw::parse(payload)?; + 32517 => { + let mut msg = MsgLinuxSocketUsage::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgImuRaw(msg)) + Ok(SBP::MsgLinuxSocketUsage(msg)) } - 2305 => { - let mut msg = MsgImuAux::parse(payload)?; + 259 => { + let mut msg = MsgUtcTime::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgImuAux(msg)) + Ok(SBP::MsgUtcTime(msg)) } - 179 => { - let mut msg = MsgBootloaderHandshakeReq::parse(payload)?; + 520 => { + let mut msg = MsgDops::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBootloaderHandshakeReq(msg)) + Ok(SBP::MsgDops(msg)) } - 180 => { - let mut msg = MsgBootloaderHandshakeResp::parse(payload)?; + 32518 => { + let mut msg = MsgLinuxProcessFdCount::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBootloaderHandshakeResp(msg)) + Ok(SBP::MsgLinuxProcessFdCount(msg)) } - 177 => { - let mut msg = MsgBootloaderJumpToApp::parse(payload)?; + 32519 => { + let mut msg = MsgLinuxProcessFdSummary::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBootloaderJumpToApp(msg)) + Ok(SBP::MsgLinuxProcessFdSummary(msg)) } - 222 => { - let mut msg = MsgNapDeviceDnaReq::parse(payload)?; + 2048 => { + let mut msg = MsgUserData::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNapDeviceDnaReq(msg)) + Ok(SBP::MsgUserData(msg)) } - 221 => { - let mut msg = MsgNapDeviceDnaResp::parse(payload)?; + 258 => { + let mut msg = MsgGPSTime::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNapDeviceDnaResp(msg)) + Ok(SBP::MsgGPSTime(msg)) } - 176 => { - let mut msg = MsgBootloaderHandshakeDepA::parse(payload)?; + 521 => { + let mut msg = MsgPosECEF::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBootloaderHandshakeDepA(msg)) + Ok(SBP::MsgPosECEF(msg)) } - 30583 => { - let mut msg = MsgSbasRaw::parse(payload)?; + 532 => { + let mut msg = MsgPosECEFCov::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSbasRaw(msg)) + Ok(SBP::MsgPosECEFCov(msg)) } - 74 => { - let mut msg = MsgObs::parse(payload)?; + 522 => { + let mut msg = MsgPosLLH::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgObs(msg)) + Ok(SBP::MsgPosLLH(msg)) } - 68 => { - let mut msg = MsgBasePosLLH::parse(payload)?; + 529 => { + let mut msg = MsgPosLLHCov::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBasePosLLH(msg)) + Ok(SBP::MsgPosLLHCov(msg)) } - 72 => { - let mut msg = MsgBasePosECEF::parse(payload)?; + 523 => { + let mut msg = MsgBaselineECEF::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBasePosECEF(msg)) + Ok(SBP::MsgBaselineECEF(msg)) } - 129 => { - let mut msg = MsgEphemerisGPSDepE::parse(payload)?; + 524 => { + let mut msg = MsgBaselineNED::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGPSDepE(msg)) + Ok(SBP::MsgBaselineNED(msg)) } - 134 => { - let mut msg = MsgEphemerisGPSDepF::parse(payload)?; + 525 => { + let mut msg = MsgVelECEF::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGPSDepF(msg)) + Ok(SBP::MsgVelECEF(msg)) } - 138 => { - let mut msg = MsgEphemerisGPS::parse(payload)?; + 533 => { + let mut msg = MsgVelECEFCov::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGPS(msg)) + Ok(SBP::MsgVelECEFCov(msg)) } - 1501 => { - let mut msg = MsgSsrOrbitClock::parse(payload)?; + 526 => { + let mut msg = MsgVelNED::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrOrbitClock(msg)) + Ok(SBP::MsgVelNED(msg)) } - 28 => { - let mut msg = MsgTrackingIqDepA::parse(payload)?; + 530 => { + let mut msg = MsgVelNEDCov::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingIqDepA(msg)) + Ok(SBP::MsgVelNEDCov(msg)) } - 22 => { - let mut msg = MsgTrackingStateDepA::parse(payload)?; + 136 => { + let mut msg = MsgEphemerisGloDepD::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingStateDepA(msg)) + Ok(SBP::MsgEphemerisGloDepD(msg)) } - 19 => { - let mut msg = MsgTrackingStateDepB::parse(payload)?; + 139 => { + let mut msg = MsgEphemerisGlo::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingStateDepB(msg)) + Ok(SBP::MsgEphemerisGlo(msg)) } - 1500 => { - let mut msg = MsgSsrOrbitClockDepA::parse(payload)?; + 128 => { + let mut msg = MsgEphemerisDepD::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrOrbitClockDepA(msg)) + Ok(SBP::MsgEphemerisDepD(msg)) } - 1505 => { - let mut msg = MsgSsrCodeBiases::parse(payload)?; + 26 => { + let mut msg = MsgEphemerisDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrCodeBiases(msg)) + Ok(SBP::MsgEphemerisDepA(msg)) } - 1510 => { - let mut msg = MsgSsrPhaseBiases::parse(payload)?; + 70 => { + let mut msg = MsgEphemerisDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrPhaseBiases(msg)) + Ok(SBP::MsgEphemerisDepB(msg)) } - 1515 => { - let mut msg = MsgSsrStecCorrection::parse(payload)?; + 71 => { + let mut msg = MsgEphemerisDepC::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrStecCorrection(msg)) + Ok(SBP::MsgEphemerisDepC(msg)) } - 1520 => { - let mut msg = MsgSsrGriddedCorrection::parse(payload)?; + 65283 => { + let mut msg = MsgInsStatus::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrGriddedCorrection(msg)) + Ok(SBP::MsgInsStatus(msg)) } - 1525 => { - let mut msg = MsgSsrGridDefinition::parse(payload)?; + 65284 => { + let mut msg = MsgCsacTelemetry::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrGridDefinition(msg)) + Ok(SBP::MsgCsacTelemetry(msg)) } - 2306 => { - let mut msg = MsgMagRaw::parse(payload)?; + 65285 => { + let mut msg = MsgCsacTelemetryLabels::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgMagRaw(msg)) + Ok(SBP::MsgCsacTelemetryLabels(msg)) } 105 => { let mut msg = MsgAlmanac::parse(payload)?; @@ -905,110 +870,220 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgThreadState(msg)) } - 142 => { - let mut msg = MsgEphemerisQzss::parse(payload)?; + 29 => { + let mut msg = MsgUartState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisQzss(msg)) + Ok(SBP::MsgUartState(msg)) } - 137 => { - let mut msg = MsgEphemerisBds::parse(payload)?; + 24 => { + let mut msg = MsgUartStateDepa::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisBds(msg)) + Ok(SBP::MsgUartStateDepa(msg)) } - 149 => { - let mut msg = MsgEphemerisGalDepA::parse(payload)?; + 25 => { + let mut msg = MsgIarState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGalDepA(msg)) + Ok(SBP::MsgIarState(msg)) } - 141 => { - let mut msg = MsgEphemerisGal::parse(payload)?; + 43 => { + let mut msg = MsgMaskSatellite::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGal(msg)) + Ok(SBP::MsgMaskSatellite(msg)) } - 130 => { - let mut msg = MsgEphemerisSbasDepA::parse(payload)?; + 27 => { + let mut msg = MsgMaskSatelliteDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisSbasDepA(msg)) + Ok(SBP::MsgMaskSatelliteDep(msg)) } - 131 => { - let mut msg = MsgEphemerisGloDepA::parse(payload)?; + 181 => { + let mut msg = MsgDeviceMonitor::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGloDepA(msg)) + Ok(SBP::MsgDeviceMonitor(msg)) } - 132 => { - let mut msg = MsgEphemerisSbasDepB::parse(payload)?; + 184 => { + let mut msg = MsgCommandReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisSbasDepB(msg)) + Ok(SBP::MsgCommandReq(msg)) } - 140 => { - let mut msg = MsgEphemerisSbas::parse(payload)?; + 185 => { + let mut msg = MsgCommandResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisSbas(msg)) + Ok(SBP::MsgCommandResp(msg)) } - 133 => { - let mut msg = MsgEphemerisGloDepB::parse(payload)?; + 188 => { + let mut msg = MsgCommandOutput::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGloDepB(msg)) + Ok(SBP::MsgCommandOutput(msg)) } - 1025 => { - let mut msg = MsgLog::parse(payload)?; + 186 => { + let mut msg = MsgNetworkStateReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLog(msg)) + Ok(SBP::MsgNetworkStateReq(msg)) } - 46 => { - let mut msg = MsgAcqSvProfile::parse(payload)?; + 187 => { + let mut msg = MsgNetworkStateResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqSvProfile(msg)) + Ok(SBP::MsgNetworkStateResp(msg)) } - 30 => { - let mut msg = MsgAcqSvProfileDep::parse(payload)?; + 189 => { + let mut msg = MsgNetworkBandwidthUsage::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqSvProfileDep(msg)) + Ok(SBP::MsgNetworkBandwidthUsage(msg)) } - 1026 => { - let mut msg = MsgFwd::parse(payload)?; + 190 => { + let mut msg = MsgCellModemStatus::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFwd(msg)) + Ok(SBP::MsgCellModemStatus(msg)) } - 16 => { - let mut msg = MsgPrintDep::parse(payload)?; + 80 => { + let mut msg = MsgSpecanDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPrintDep(msg)) + Ok(SBP::MsgSpecanDep(msg)) } - 1024 => { - let mut msg = MsgNdbEvent::parse(payload)?; + 81 => { + let mut msg = MsgSpecan::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNdbEvent(msg)) + Ok(SBP::MsgSpecan(msg)) } - 33 => { - let mut msg = MsgTrackingStateDetailedDepA::parse(payload)?; + 191 => { + let mut msg = MsgFrontEndGain::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingStateDetailedDepA(msg)) + Ok(SBP::MsgFrontEndGain(msg)) + } + 47 => { + let mut msg = MsgAcqResult::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAcqResult(msg)) + } + 31 => { + let mut msg = MsgAcqResultDepC::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAcqResultDepC(msg)) + } + 20 => { + let mut msg = MsgAcqResultDepB::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAcqResultDepB(msg)) + } + 21 => { + let mut msg = MsgAcqResultDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAcqResultDepA(msg)) + } + 531 => { + let mut msg = MsgVelBody::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgVelBody(msg)) + } + 528 => { + let mut msg = MsgAgeCorrections::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgAgeCorrections(msg)) + } + 256 => { + let mut msg = MsgGPSTimeDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgGPSTimeDepA(msg)) + } + 518 => { + let mut msg = MsgDopsDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgDopsDepA(msg)) + } + 512 => { + let mut msg = MsgPosECEFDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgPosECEFDepA(msg)) + } + 513 => { + let mut msg = MsgPosLLHDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgPosLLHDepA(msg)) + } + 514 => { + let mut msg = MsgBaselineECEFDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBaselineECEFDepA(msg)) + } + 515 => { + let mut msg = MsgBaselineNEDDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBaselineNEDDepA(msg)) + } + 516 => { + let mut msg = MsgVelECEFDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgVelECEFDepA(msg)) + } + 517 => { + let mut msg = MsgVelNEDDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgVelNEDDepA(msg)) + } + 519 => { + let mut msg = MsgBaselineHeadingDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBaselineHeadingDepA(msg)) + } + 168 => { + let mut msg = MsgFileioReadReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadReq(msg)) + } + 163 => { + let mut msg = MsgFileioReadResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadResp(msg)) + } + 169 => { + let mut msg = MsgFileioReadDirReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadDirReq(msg)) + } + 170 => { + let mut msg = MsgFileioReadDirResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadDirResp(msg)) + } + 172 => { + let mut msg = MsgFileioRemove::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioRemove(msg)) + } + 173 => { + let mut msg = MsgFileioWriteReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioWriteReq(msg)) + } + 171 => { + let mut msg = MsgFileioWriteResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioWriteResp(msg)) } - 17 => { - let mut msg = MsgTrackingStateDetailedDep::parse(payload)?; + 4097 => { + let mut msg = MsgFileioConfigReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingStateDetailedDep(msg)) + Ok(SBP::MsgFileioConfigReq(msg)) } - 97 => { - let mut msg = MsgMeasurementState::parse(payload)?; + 4098 => { + let mut msg = MsgFileioConfigResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgMeasurementState(msg)) + Ok(SBP::MsgFileioConfigResp(msg)) } - 45 => { - let mut msg = MsgTrackingIq::parse(payload)?; + 1025 => { + let mut msg = MsgLog::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingIq(msg)) + Ok(SBP::MsgLog(msg)) } - 65 => { - let mut msg = MsgTrackingState::parse(payload)?; + 1026 => { + let mut msg = MsgFwd::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingState(msg)) + Ok(SBP::MsgFwd(msg)) } - 44 => { - let mut msg = MsgTrackingIqDepB::parse(payload)?; + 16 => { + let mut msg = MsgPrintDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingIqDepB(msg)) + Ok(SBP::MsgPrintDep(msg)) } 161 => { let mut msg = MsgSettingsSave::parse(payload)?; @@ -1060,205 +1135,130 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgSettingsRegisterResp(msg)) } - 2048 => { - let mut msg = MsgUserData::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgUserData(msg)) - } - 47 => { - let mut msg = MsgAcqResult::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqResult(msg)) - } - 257 => { - let mut msg = MsgExtEvent::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgExtEvent(msg)) - } - 31 => { - let mut msg = MsgAcqResultDepC::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqResultDepC(msg)) - } - 20 => { - let mut msg = MsgAcqResultDepB::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqResultDepB(msg)) - } - 21 => { - let mut msg = MsgAcqResultDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqResultDepA(msg)) - } - 29 => { - let mut msg = MsgUartState::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgUartState(msg)) - } - 24 => { - let mut msg = MsgUartStateDepa::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgUartStateDepa(msg)) - } - 25 => { - let mut msg = MsgIarState::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgIarState(msg)) - } - 43 => { - let mut msg = MsgMaskSatellite::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgMaskSatellite(msg)) - } - 27 => { - let mut msg = MsgMaskSatelliteDep::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgMaskSatelliteDep(msg)) - } - 181 => { - let mut msg = MsgDeviceMonitor::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgDeviceMonitor(msg)) - } - 184 => { - let mut msg = MsgCommandReq::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgCommandReq(msg)) - } - 185 => { - let mut msg = MsgCommandResp::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgCommandResp(msg)) - } - 188 => { - let mut msg = MsgCommandOutput::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgCommandOutput(msg)) - } - 186 => { - let mut msg = MsgNetworkStateReq::parse(payload)?; + 179 => { + let mut msg = MsgBootloaderHandshakeReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNetworkStateReq(msg)) + Ok(SBP::MsgBootloaderHandshakeReq(msg)) } - 187 => { - let mut msg = MsgNetworkStateResp::parse(payload)?; + 180 => { + let mut msg = MsgBootloaderHandshakeResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNetworkStateResp(msg)) + Ok(SBP::MsgBootloaderHandshakeResp(msg)) } - 189 => { - let mut msg = MsgNetworkBandwidthUsage::parse(payload)?; + 177 => { + let mut msg = MsgBootloaderJumpToApp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNetworkBandwidthUsage(msg)) + Ok(SBP::MsgBootloaderJumpToApp(msg)) } - 190 => { - let mut msg = MsgCellModemStatus::parse(payload)?; + 222 => { + let mut msg = MsgNapDeviceDnaReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCellModemStatus(msg)) + Ok(SBP::MsgNapDeviceDnaReq(msg)) } - 80 => { - let mut msg = MsgSpecanDep::parse(payload)?; + 176 => { + let mut msg = MsgBootloaderHandshakeDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSpecanDep(msg)) + Ok(SBP::MsgBootloaderHandshakeDepA(msg)) } - 81 => { - let mut msg = MsgSpecan::parse(payload)?; + 221 => { + let mut msg = MsgNapDeviceDnaResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSpecan(msg)) + Ok(SBP::MsgNapDeviceDnaResp(msg)) } - 191 => { - let mut msg = MsgFrontEndGain::parse(payload)?; + 65282 => { + let mut msg = MsgDgnssStatus::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFrontEndGain(msg)) + Ok(SBP::MsgDgnssStatus(msg)) } - 32512 => { - let mut msg = MsgLinuxCpuState::parse(payload)?; + 65535 => { + let mut msg = MsgHeartbeat::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxCpuState(msg)) + Ok(SBP::MsgHeartbeat(msg)) } - 32513 => { - let mut msg = MsgLinuxMemState::parse(payload)?; + 65280 => { + let mut msg = MsgStartup::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxMemState(msg)) + Ok(SBP::MsgStartup(msg)) } - 32514 => { - let mut msg = MsgLinuxSysState::parse(payload)?; + 69 => { + let mut msg = MsgObsDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxSysState(msg)) + Ok(SBP::MsgObsDepA(msg)) } - 32515 => { - let mut msg = MsgLinuxProcessSocketCounts::parse(payload)?; + 67 => { + let mut msg = MsgObsDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxProcessSocketCounts(msg)) + Ok(SBP::MsgObsDepB(msg)) } - 32516 => { - let mut msg = MsgLinuxProcessSocketQueues::parse(payload)?; + 73 => { + let mut msg = MsgObsDepC::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxProcessSocketQueues(msg)) + Ok(SBP::MsgObsDepC(msg)) } - 32517 => { - let mut msg = MsgLinuxSocketUsage::parse(payload)?; + 144 => { + let mut msg = MsgIono::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxSocketUsage(msg)) + Ok(SBP::MsgIono(msg)) } - 32518 => { - let mut msg = MsgLinuxProcessFdCount::parse(payload)?; + 145 => { + let mut msg = MsgSvConfigurationGPSDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxProcessFdCount(msg)) + Ok(SBP::MsgSvConfigurationGPSDep(msg)) } - 32519 => { - let mut msg = MsgLinuxProcessFdSummary::parse(payload)?; + 150 => { + let mut msg = MsgGnssCapb::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxProcessFdSummary(msg)) + Ok(SBP::MsgGnssCapb(msg)) } - 230 => { - let mut msg = MsgFlashProgram::parse(payload)?; + 112 => { + let mut msg = MsgAlmanacGPSDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFlashProgram(msg)) + Ok(SBP::MsgAlmanacGPSDep(msg)) } - 224 => { - let mut msg = MsgFlashDone::parse(payload)?; + 114 => { + let mut msg = MsgAlmanacGPS::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFlashDone(msg)) + Ok(SBP::MsgAlmanacGPS(msg)) } - 231 => { - let mut msg = MsgFlashReadReq::parse(payload)?; + 146 => { + let mut msg = MsgGroupDelayDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFlashReadReq(msg)) + Ok(SBP::MsgGroupDelayDepA(msg)) } - 225 => { - let mut msg = MsgFlashReadResp::parse(payload)?; + 147 => { + let mut msg = MsgGroupDelayDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFlashReadResp(msg)) + Ok(SBP::MsgGroupDelayDepB(msg)) } - 226 => { - let mut msg = MsgFlashErase::parse(payload)?; + 148 => { + let mut msg = MsgGroupDelay::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFlashErase(msg)) + Ok(SBP::MsgGroupDelay(msg)) } - 227 => { - let mut msg = MsgStmFlashLockSector::parse(payload)?; + 117 => { + let mut msg = MsgGloBiases::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgStmFlashLockSector(msg)) + Ok(SBP::MsgGloBiases(msg)) } - 228 => { - let mut msg = MsgStmFlashUnlockSector::parse(payload)?; + 151 => { + let mut msg = MsgSvAzEl::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgStmFlashUnlockSector(msg)) + Ok(SBP::MsgSvAzEl(msg)) } - 232 => { - let mut msg = MsgStmUniqueIdReq::parse(payload)?; + 1600 => { + let mut msg = MsgOsr::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgStmUniqueIdReq(msg)) + Ok(SBP::MsgOsr(msg)) } - 229 => { - let mut msg = MsgStmUniqueIdResp::parse(payload)?; + 113 => { + let mut msg = MsgAlmanacGloDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgStmUniqueIdResp(msg)) + Ok(SBP::MsgAlmanacGloDep(msg)) } - 243 => { - let mut msg = MsgM25FlashWriteStatus::parse(payload)?; + 115 => { + let mut msg = MsgAlmanacGlo::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgM25FlashWriteStatus(msg)) + Ok(SBP::MsgAlmanacGlo(msg)) } _ => Ok(SBP::Unknown { msg_id: msg_id, diff --git a/rust/sbp/src/messages/navigation.rs b/rust/sbp/src/messages/navigation.rs index 9b03a11be0..13b5d196d3 100644 --- a/rust/sbp/src/messages/navigation.rs +++ b/rust/sbp/src/messages/navigation.rs @@ -12,24 +12,21 @@ // Automatically generated from yaml/swiftnav/sbp/navigation.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Geodetic navigation messages reporting GPS time, position, velocity, -/// and baseline position solutions. For position solutions, these -/// messages define several different position solutions: single-point -/// (SPP), RTK, and pseudo-absolute position solutions. -/// -/// The SPP is the standalone, absolute GPS position solution using only -/// a single receiver. The RTK solution is the differential GPS -/// solution, which can use either a fixed/integer or floating carrier -/// phase ambiguity. The pseudo-absolute position solution uses a -/// user-provided, well-surveyed base station position (if available) -/// and the RTK solution in tandem. -/// -/// When the inertial navigation mode indicates that the IMU is used, -/// all messages are reported in the vehicle body frame as defined by -/// device settings. By default, the vehicle body frame is configured to be -/// coincident with the antenna phase center. When there is no inertial -/// navigation, the solution will be reported at the phase center of the antenna. -/// There is no inertial navigation capability on Piksi Multi or Duro. +//! Geodetic navigation messages reporting GPS time, position, velocity, and +//! baseline position solutions. For position solutions, these messages define +//! several different position solutions: single-point (SPP), RTK, and pseudo- +//! absolute position solutions. The SPP is the standalone, absolute GPS +//! position solution using only a single receiver. The RTK solution is the +//! differential GPS solution, which can use either a fixed/integer or floating +//! carrier phase ambiguity. The pseudo-absolute position solution uses a user- +//! provided, well-surveyed base station position (if available) and the RTK +//! solution in tandem. When the inertial navigation mode indicates that the +//! IMU is used, all messages are reported in the vehicle body frame as defined +//! by device settings. By default, the vehicle body frame is configured to be +//! coincident with the antenna phase center. When there is no inertial +//! navigation, the solution will be reported at the phase center of the +//! antenna. There is no inertial navigation capability on Piksi Multi or Duro. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/ndb.rs b/rust/sbp/src/messages/ndb.rs index 5eda14842e..a884194fb6 100644 --- a/rust/sbp/src/messages/ndb.rs +++ b/rust/sbp/src/messages/ndb.rs @@ -12,7 +12,8 @@ // Automatically generated from yaml/swiftnav/sbp/ndb.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Messages for logging NDB events. +//! Messages for logging NDB events. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/observation.rs b/rust/sbp/src/messages/observation.rs index fe1e072fc2..54be91f833 100644 --- a/rust/sbp/src/messages/observation.rs +++ b/rust/sbp/src/messages/observation.rs @@ -12,7 +12,8 @@ // Automatically generated from yaml/swiftnav/sbp/observation.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Satellite observation messages from the device. +//! Satellite observation messages from the device. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/orientation.rs b/rust/sbp/src/messages/orientation.rs index f97154ec47..0959160fd7 100644 --- a/rust/sbp/src/messages/orientation.rs +++ b/rust/sbp/src/messages/orientation.rs @@ -12,7 +12,8 @@ // Automatically generated from yaml/swiftnav/sbp/orientation.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Orientation Messages +//! Orientation Messages + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/piksi.rs b/rust/sbp/src/messages/piksi.rs index fe4e24d0ce..e1a22e196c 100644 --- a/rust/sbp/src/messages/piksi.rs +++ b/rust/sbp/src/messages/piksi.rs @@ -12,9 +12,10 @@ // Automatically generated from yaml/swiftnav/sbp/piksi.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// System health, configuration, and diagnostic messages specific to -/// the Piksi L1 receiver, including a variety of legacy messages that -/// may no longer be used. +//! System health, configuration, and diagnostic messages specific to the Piksi +//! L1 receiver, including a variety of legacy messages that may no longer be +//! used. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/sbas.rs b/rust/sbp/src/messages/sbas.rs index c6fd4018a4..8b8e74350e 100644 --- a/rust/sbp/src/messages/sbas.rs +++ b/rust/sbp/src/messages/sbas.rs @@ -12,7 +12,8 @@ // Automatically generated from yaml/swiftnav/sbp/sbas.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// SBAS data +//! SBAS data + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/settings.rs b/rust/sbp/src/messages/settings.rs index b0bdece5d1..f45548977b 100644 --- a/rust/sbp/src/messages/settings.rs +++ b/rust/sbp/src/messages/settings.rs @@ -12,32 +12,31 @@ // Automatically generated from yaml/swiftnav/sbp/settings.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// -/// Messages for reading, writing, and discovering device settings. Settings -/// with a "string" field have multiple values in this field delimited with a -/// null character (the c style null terminator). For instance, when querying -/// the 'firmware_version' setting in the 'system_info' section, the following -/// array of characters needs to be sent for the string field in -/// MSG_SETTINGS_READ: "system_info\0firmware_version\0", where the delimiting -/// null characters are specified with the escape sequence '\0' and all -/// quotation marks should be omitted. -/// -/// -/// In the message descriptions below, the generic strings SECTION_SETTING and -/// SETTING are used to refer to the two strings that comprise the identifier -/// of an individual setting.In firmware_version example above, SECTION_SETTING -/// is the 'system_info', and the SETTING portion is 'firmware_version'. -/// -/// See the "Software Settings Manual" on support.swiftnav.com for detailed -/// documentation about all settings and sections available for each Swift -/// firmware version. Settings manuals are available for each firmware version -/// at the following link: [Piksi Multi Specifications](https://support.swiftnav.com/customer/en/portal/articles/2628580-piksi-multi-specifications#settings). -/// The latest settings document is also available at the following link: -/// [Latest settings document](http://swiftnav.com/latest/piksi-multi-settings) . -/// See lastly [settings.py](https://github.com/swift-nav/piksi_tools/blob/master/piksi_tools/settings.py) , -/// the open source python command line utility for reading, writing, and -/// saving settings in the piksi_tools repository on github as a helpful -/// reference and example. +//! Messages for reading, writing, and discovering device settings. Settings +//! with a "string" field have multiple values in this field delimited with a +//! null character (the c style null terminator). For instance, when querying +//! the 'firmware_version' setting in the 'system_info' section, the following +//! array of characters needs to be sent for the string field in +//! MSG_SETTINGS_READ: "system_info\0firmware_version\0", where the delimiting +//! null characters are specified with the escape sequence '\0' and all +//! quotation marks should be omitted. In the message descriptions below, +//! the generic strings SECTION_SETTING and SETTING are used to refer to the +//! two strings that comprise the identifier of an individual setting.In +//! firmware_version example above, SECTION_SETTING is the 'system_info', and +//! the SETTING portion is 'firmware_version'. See the "Software Settings +//! Manual" on support.swiftnav.com for detailed documentation about all +//! settings and sections available for each Swift firmware version. Settings +//! manuals are available for each firmware version at the following link: +//! @@https://support.swiftnav.com/customer/en/portal/articles/2628580-piksi- +//! multi-specifications#settings[Piksi Multi Specifications]. The latest +//! settings document is also available at the following link: +//! @@http://swiftnav.com/latest/piksi-multi-settings[Latest settings document] +//! . See lastly @@https://github.com/swift- +//! nav/piksi_tools/blob/master/piksi_tools/settings.py[settings.py] , the +//! open source python command line utility for reading, writing, and saving +//! settings in the piksi_tools repository on github as a helpful reference and +//! example. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/ssr.rs b/rust/sbp/src/messages/ssr.rs index 4ef50c7510..f49b1ee9e2 100644 --- a/rust/sbp/src/messages/ssr.rs +++ b/rust/sbp/src/messages/ssr.rs @@ -12,7 +12,8 @@ // Automatically generated from yaml/swiftnav/sbp/ssr.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Precise State Space Representation (SSR) corrections format +//! Precise State Space Representation (SSR) corrections format + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/system.rs b/rust/sbp/src/messages/system.rs index 0892bd990d..dcb53310c5 100644 --- a/rust/sbp/src/messages/system.rs +++ b/rust/sbp/src/messages/system.rs @@ -12,7 +12,8 @@ // Automatically generated from yaml/swiftnav/sbp/system.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Standardized system messages from Swift Navigation devices. +//! Standardized system messages from Swift Navigation devices. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/tracking.rs b/rust/sbp/src/messages/tracking.rs index 35dd913c10..fbddfeb161 100644 --- a/rust/sbp/src/messages/tracking.rs +++ b/rust/sbp/src/messages/tracking.rs @@ -12,7 +12,8 @@ // Automatically generated from yaml/swiftnav/sbp/tracking.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Satellite code and carrier-phase tracking messages from the device. +//! Satellite code and carrier-phase tracking messages from the device. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/user.rs b/rust/sbp/src/messages/user.rs index 94cbc1664b..2ac322c266 100644 --- a/rust/sbp/src/messages/user.rs +++ b/rust/sbp/src/messages/user.rs @@ -12,7 +12,8 @@ // Automatically generated from yaml/swiftnav/sbp/user.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Messages reserved for use by the user. +//! Messages reserved for use by the user. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/messages/vehicle.rs b/rust/sbp/src/messages/vehicle.rs index 54b3324a8b..311fb4bc55 100644 --- a/rust/sbp/src/messages/vehicle.rs +++ b/rust/sbp/src/messages/vehicle.rs @@ -12,7 +12,8 @@ // Automatically generated from yaml/swiftnav/sbp/vehicle.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -/// Messages from a vehicle. +//! Messages from a vehicle. + extern crate byteorder; #[allow(unused_imports)] use self::byteorder::{LittleEndian, ReadBytesExt}; diff --git a/rust/sbp/src/parser/mod.rs b/rust/sbp/src/parser/mod.rs index f6c5a58b65..f6c6217fbb 100644 --- a/rust/sbp/src/parser/mod.rs +++ b/rust/sbp/src/parser/mod.rs @@ -1,3 +1,5 @@ +//! Simple parsing functionality for extracting SBP messages from binary streams + extern crate byteorder; extern crate nom; use self::byteorder::{LittleEndian, ReadBytesExt}; From a56f123a91e24813bce4652cc83c570d707c4fcb Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Mon, 22 Jul 2019 20:16:18 -0700 Subject: [PATCH 24/25] Changed rust doc comments to keep message module description short --- .../resources/sbp_messages_template.rs | 2 +- rust/sbp/src/messages/bootload.rs | 8 +- rust/sbp/src/messages/ext_events.rs | 5 +- rust/sbp/src/messages/file_io.rs | 15 +- rust/sbp/src/messages/flash.rs | 10 +- rust/sbp/src/messages/linux.rs | 1 + rust/sbp/src/messages/logging.rs | 1 + rust/sbp/src/messages/mod.rs | 1220 ++++++++--------- rust/sbp/src/messages/navigation.rs | 31 +- rust/sbp/src/messages/ndb.rs | 1 + rust/sbp/src/messages/piksi.rs | 7 +- rust/sbp/src/messages/settings.rs | 39 +- rust/sbp/src/messages/tracking.rs | 1 + rust/sbp/src/messages/user.rs | 1 + 14 files changed, 682 insertions(+), 660 deletions(-) diff --git a/generator/sbpg/targets/resources/sbp_messages_template.rs b/generator/sbpg/targets/resources/sbp_messages_template.rs index 14fc63e3d8..ec85a42473 100644 --- a/generator/sbpg/targets/resources/sbp_messages_template.rs +++ b/generator/sbpg/targets/resources/sbp_messages_template.rs @@ -13,7 +13,7 @@ // with generate.py. Please do not hand edit! //****************************************************************************/ -//! (((description | replace("\n", " ") | wordwrap(width=75, wrapstring="\n //! ")))) +//! (((description | replace("\n", "\n//! ")))) extern crate byteorder; #[allow(unused_imports)] diff --git a/rust/sbp/src/messages/bootload.rs b/rust/sbp/src/messages/bootload.rs index 3158b94956..290080c43b 100644 --- a/rust/sbp/src/messages/bootload.rs +++ b/rust/sbp/src/messages/bootload.rs @@ -13,9 +13,11 @@ // with generate.py. Please do not hand edit! //****************************************************************************/ //! Messages for the bootloading configuration of a Piksi 2.3.1. This message -//! group does not apply to Piksi Multi. Note that some of these messages -//! share the same message type ID for both the host request and the device -//! response. +//! group does not apply to Piksi Multi. +//! +//! Note that some of these messages share the same message type ID for both the +//! host request and the device response. +//! extern crate byteorder; #[allow(unused_imports)] diff --git a/rust/sbp/src/messages/ext_events.rs b/rust/sbp/src/messages/ext_events.rs index 9ed6fccc19..0005a4df6a 100644 --- a/rust/sbp/src/messages/ext_events.rs +++ b/rust/sbp/src/messages/ext_events.rs @@ -12,8 +12,9 @@ // Automatically generated from yaml/swiftnav/sbp/ext_events.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -//! Messages reporting accurately-timestamped external events, e.g. camera -//! shutter time. +//! Messages reporting accurately-timestamped external events, +//! e.g. camera shutter time. +//! extern crate byteorder; #[allow(unused_imports)] diff --git a/rust/sbp/src/messages/file_io.rs b/rust/sbp/src/messages/file_io.rs index 1c891e6fd5..0a40b73e9f 100644 --- a/rust/sbp/src/messages/file_io.rs +++ b/rust/sbp/src/messages/file_io.rs @@ -12,12 +12,15 @@ // Automatically generated from yaml/swiftnav/sbp/file_io.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -//! Messages for using device's onboard flash filesystem functionality. This -//! allows data to be stored persistently in the device's program flash with -//! wear-levelling using a simple filesystem interface. The file system -//! interface (CFS) defines an abstract API for reading directories and for -//! reading and writing files. Note that some of these messages share the same -//! message type ID for both the host request and the device response. +//! Messages for using device's onboard flash filesystem +//! functionality. This allows data to be stored persistently in the +//! device's program flash with wear-levelling using a simple filesystem +//! interface. The file system interface (CFS) defines an abstract API +//! for reading directories and for reading and writing files. +//! +//! Note that some of these messages share the same message type ID for both the +//! host request and the device response. +//! extern crate byteorder; #[allow(unused_imports)] diff --git a/rust/sbp/src/messages/flash.rs b/rust/sbp/src/messages/flash.rs index be757b5373..709543bf29 100644 --- a/rust/sbp/src/messages/flash.rs +++ b/rust/sbp/src/messages/flash.rs @@ -12,10 +12,12 @@ // Automatically generated from yaml/swiftnav/sbp/flash.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -//! Messages for reading/writing the device's onboard flash memory. Many of -//! these messages target specific flash memory peripherals used in Swift -//! Navigation devices: the STM32 flash and the M25Pxx FPGA configuration flash -//! from Piksi 2.3.1. This module does not apply to Piksi Multi. +//! Messages for reading/writing the device's onboard flash memory. Many +//! of these messages target specific flash memory peripherals used in +//! Swift Navigation devices: the STM32 flash and the M25Pxx FPGA +//! configuration flash from Piksi 2.3.1. This module does not apply +//! to Piksi Multi. +//! extern crate byteorder; #[allow(unused_imports)] diff --git a/rust/sbp/src/messages/linux.rs b/rust/sbp/src/messages/linux.rs index 31959c4e18..d797d1abc8 100644 --- a/rust/sbp/src/messages/linux.rs +++ b/rust/sbp/src/messages/linux.rs @@ -13,6 +13,7 @@ // with generate.py. Please do not hand edit! //****************************************************************************/ //! Linux state monitoring. +//! extern crate byteorder; #[allow(unused_imports)] diff --git a/rust/sbp/src/messages/logging.rs b/rust/sbp/src/messages/logging.rs index 940452f95c..b21969b440 100644 --- a/rust/sbp/src/messages/logging.rs +++ b/rust/sbp/src/messages/logging.rs @@ -13,6 +13,7 @@ // with generate.py. Please do not hand edit! //****************************************************************************/ //! Logging and debugging messages from the device. +//! extern crate byteorder; #[allow(unused_imports)] diff --git a/rust/sbp/src/messages/mod.rs b/rust/sbp/src/messages/mod.rs index 06eb1833ef..5b46461445 100644 --- a/rust/sbp/src/messages/mod.rs +++ b/rust/sbp/src/messages/mod.rs @@ -217,57 +217,55 @@ pub enum SBP { sender_id: u16, payload: Vec, }, - MsgAcqSvProfile(MsgAcqSvProfile), - MsgAcqSvProfileDep(MsgAcqSvProfileDep), - MsgSbasRaw(MsgSbasRaw), - MsgOdometry(MsgOdometry), - MsgTrackingStateDetailedDepA(MsgTrackingStateDetailedDepA), - MsgTrackingStateDetailedDep(MsgTrackingStateDetailedDep), - MsgTrackingState(MsgTrackingState), - MsgMeasurementState(MsgMeasurementState), - MsgTrackingIq(MsgTrackingIq), - MsgTrackingIqDepB(MsgTrackingIqDepB), - MsgTrackingIqDepA(MsgTrackingIqDepA), - MsgTrackingStateDepA(MsgTrackingStateDepA), - MsgTrackingStateDepB(MsgTrackingStateDepB), - MsgExtEvent(MsgExtEvent), - MsgFlashProgram(MsgFlashProgram), - MsgFlashDone(MsgFlashDone), - MsgFlashReadReq(MsgFlashReadReq), - MsgFlashReadResp(MsgFlashReadResp), - MsgFlashErase(MsgFlashErase), - MsgStmFlashLockSector(MsgStmFlashLockSector), - MsgStmFlashUnlockSector(MsgStmFlashUnlockSector), - MsgStmUniqueIdReq(MsgStmUniqueIdReq), - MsgStmUniqueIdResp(MsgStmUniqueIdResp), - MsgM25FlashWriteStatus(MsgM25FlashWriteStatus), - MsgMagRaw(MsgMagRaw), - MsgAngularRate(MsgAngularRate), - MsgNdbEvent(MsgNdbEvent), - MsgSsrOrbitClock(MsgSsrOrbitClock), - MsgSsrOrbitClockDepA(MsgSsrOrbitClockDepA), - MsgSsrCodeBiases(MsgSsrCodeBiases), - MsgSsrPhaseBiases(MsgSsrPhaseBiases), - MsgSsrStecCorrection(MsgSsrStecCorrection), - MsgSsrGriddedCorrection(MsgSsrGriddedCorrection), - MsgSsrGridDefinition(MsgSsrGridDefinition), + MsgUartState(MsgUartState), + MsgUartStateDepa(MsgUartStateDepa), + MsgResetDep(MsgResetDep), + MsgCwResults(MsgCwResults), + MsgCwStart(MsgCwStart), + MsgResetFilters(MsgResetFilters), + MsgInitBaseDep(MsgInitBaseDep), + MsgThreadState(MsgThreadState), + MsgCommandOutput(MsgCommandOutput), + MsgNetworkStateReq(MsgNetworkStateReq), + MsgNetworkStateResp(MsgNetworkStateResp), + MsgSpecan(MsgSpecan), + MsgFrontEndGain(MsgFrontEndGain), MsgLinuxCpuState(MsgLinuxCpuState), + MsgNetworkBandwidthUsage(MsgNetworkBandwidthUsage), + MsgCellModemStatus(MsgCellModemStatus), + MsgSpecanDep(MsgSpecanDep), + MsgLinuxProcessSocketCounts(MsgLinuxProcessSocketCounts), + MsgLinuxProcessSocketQueues(MsgLinuxProcessSocketQueues), + MsgLinuxSocketUsage(MsgLinuxSocketUsage), MsgLinuxMemState(MsgLinuxMemState), MsgLinuxSysState(MsgLinuxSysState), - MsgLinuxProcessSocketCounts(MsgLinuxProcessSocketCounts), - MsgBaselineHeading(MsgBaselineHeading), - MsgOrientQuat(MsgOrientQuat), - MsgOrientEuler(MsgOrientEuler), - MsgImuRaw(MsgImuRaw), - MsgImuAux(MsgImuAux), + MsgLinuxProcessFdCount(MsgLinuxProcessFdCount), + MsgLinuxProcessFdSummary(MsgLinuxProcessFdSummary), + MsgStartup(MsgStartup), + MsgDgnssStatus(MsgDgnssStatus), + MsgHeartbeat(MsgHeartbeat), + MsgIarState(MsgIarState), + MsgMaskSatellite(MsgMaskSatellite), + MsgMaskSatelliteDep(MsgMaskSatelliteDep), + MsgDeviceMonitor(MsgDeviceMonitor), + MsgCommandReq(MsgCommandReq), + MsgCommandResp(MsgCommandResp), + MsgNdbEvent(MsgNdbEvent), + MsgAlmanac(MsgAlmanac), + MsgSetTime(MsgSetTime), + MsgReset(MsgReset), MsgObs(MsgObs), MsgBasePosLLH(MsgBasePosLLH), MsgBasePosECEF(MsgBasePosECEF), + MsgInsStatus(MsgInsStatus), + MsgCsacTelemetry(MsgCsacTelemetry), + MsgCsacTelemetryLabels(MsgCsacTelemetryLabels), + MsgExtEvent(MsgExtEvent), MsgEphemerisGPSDepE(MsgEphemerisGPSDepE), MsgEphemerisGPSDepF(MsgEphemerisGPSDepF), + MsgEphemerisGPS(MsgEphemerisGPS), MsgEphemerisQzss(MsgEphemerisQzss), MsgEphemerisBds(MsgEphemerisBds), - MsgEphemerisGPS(MsgEphemerisGPS), MsgEphemerisGalDepA(MsgEphemerisGalDepA), MsgEphemerisGal(MsgEphemerisGal), MsgEphemerisSbasDepA(MsgEphemerisSbasDepA), @@ -276,14 +274,70 @@ pub enum SBP { MsgEphemerisSbas(MsgEphemerisSbas), MsgEphemerisGloDepB(MsgEphemerisGloDepB), MsgEphemerisGloDepC(MsgEphemerisGloDepC), - MsgLinuxProcessSocketQueues(MsgLinuxProcessSocketQueues), - MsgLinuxSocketUsage(MsgLinuxSocketUsage), - MsgUtcTime(MsgUtcTime), - MsgDops(MsgDops), - MsgLinuxProcessFdCount(MsgLinuxProcessFdCount), - MsgLinuxProcessFdSummary(MsgLinuxProcessFdSummary), + MsgEphemerisGloDepD(MsgEphemerisGloDepD), + MsgAcqResultDepB(MsgAcqResultDepB), + MsgAcqResultDepA(MsgAcqResultDepA), + MsgAcqSvProfile(MsgAcqSvProfile), + MsgAcqSvProfileDep(MsgAcqSvProfileDep), + MsgSbasRaw(MsgSbasRaw), + MsgSettingsSave(MsgSettingsSave), + MsgSettingsWrite(MsgSettingsWrite), + MsgSettingsWriteResp(MsgSettingsWriteResp), + MsgSettingsReadReq(MsgSettingsReadReq), + MsgSettingsReadResp(MsgSettingsReadResp), + MsgSettingsReadByIndexReq(MsgSettingsReadByIndexReq), + MsgSettingsReadByIndexResp(MsgSettingsReadByIndexResp), + MsgSettingsReadByIndexDone(MsgSettingsReadByIndexDone), + MsgSettingsRegister(MsgSettingsRegister), + MsgSettingsRegisterResp(MsgSettingsRegisterResp), + MsgBootloaderHandshakeReq(MsgBootloaderHandshakeReq), + MsgBootloaderHandshakeResp(MsgBootloaderHandshakeResp), + MsgBootloaderJumpToApp(MsgBootloaderJumpToApp), + MsgNapDeviceDnaReq(MsgNapDeviceDnaReq), + MsgNapDeviceDnaResp(MsgNapDeviceDnaResp), + MsgBootloaderHandshakeDepA(MsgBootloaderHandshakeDepA), + MsgFileioReadReq(MsgFileioReadReq), + MsgFileioReadResp(MsgFileioReadResp), + MsgFileioReadDirReq(MsgFileioReadDirReq), + MsgFileioReadDirResp(MsgFileioReadDirResp), + MsgFileioRemove(MsgFileioRemove), + MsgFileioWriteReq(MsgFileioWriteReq), + MsgFileioWriteResp(MsgFileioWriteResp), + MsgFileioConfigReq(MsgFileioConfigReq), + MsgFileioConfigResp(MsgFileioConfigResp), + MsgTrackingIq(MsgTrackingIq), + MsgTrackingIqDepB(MsgTrackingIqDepB), + MsgTrackingIqDepA(MsgTrackingIqDepA), + MsgTrackingStateDepA(MsgTrackingStateDepA), + MsgTrackingStateDepB(MsgTrackingStateDepB), + MsgLog(MsgLog), + MsgFwd(MsgFwd), + MsgPrintDep(MsgPrintDep), + MsgImuRaw(MsgImuRaw), + MsgImuAux(MsgImuAux), + MsgMagRaw(MsgMagRaw), + MsgSsrOrbitClock(MsgSsrOrbitClock), + MsgSsrOrbitClockDepA(MsgSsrOrbitClockDepA), + MsgSsrCodeBiases(MsgSsrCodeBiases), + MsgSsrPhaseBiases(MsgSsrPhaseBiases), + MsgSsrStecCorrection(MsgSsrStecCorrection), + MsgSsrGriddedCorrection(MsgSsrGriddedCorrection), + MsgSsrGridDefinition(MsgSsrGridDefinition), MsgUserData(MsgUserData), - MsgGPSTime(MsgGPSTime), + MsgAcqResult(MsgAcqResult), + MsgAcqResultDepC(MsgAcqResultDepC), + MsgVelECEFDepA(MsgVelECEFDepA), + MsgVelNEDDepA(MsgVelNEDDepA), + MsgBaselineHeadingDepA(MsgBaselineHeadingDepA), + MsgOdometry(MsgOdometry), + MsgBaselineHeading(MsgBaselineHeading), + MsgOrientQuat(MsgOrientQuat), + MsgOrientEuler(MsgOrientEuler), + MsgAngularRate(MsgAngularRate), + MsgTrackingStateDetailedDepA(MsgTrackingStateDetailedDepA), + MsgTrackingStateDetailedDep(MsgTrackingStateDetailedDep), + MsgTrackingState(MsgTrackingState), + MsgMeasurementState(MsgMeasurementState), MsgPosECEF(MsgPosECEF), MsgPosECEFCov(MsgPosECEFCov), MsgPosLLH(MsgPosLLH), @@ -294,44 +348,6 @@ pub enum SBP { MsgVelECEFCov(MsgVelECEFCov), MsgVelNED(MsgVelNED), MsgVelNEDCov(MsgVelNEDCov), - MsgEphemerisGloDepD(MsgEphemerisGloDepD), - MsgEphemerisGlo(MsgEphemerisGlo), - MsgEphemerisDepD(MsgEphemerisDepD), - MsgEphemerisDepA(MsgEphemerisDepA), - MsgEphemerisDepB(MsgEphemerisDepB), - MsgEphemerisDepC(MsgEphemerisDepC), - MsgInsStatus(MsgInsStatus), - MsgCsacTelemetry(MsgCsacTelemetry), - MsgCsacTelemetryLabels(MsgCsacTelemetryLabels), - MsgAlmanac(MsgAlmanac), - MsgSetTime(MsgSetTime), - MsgReset(MsgReset), - MsgResetDep(MsgResetDep), - MsgCwResults(MsgCwResults), - MsgCwStart(MsgCwStart), - MsgResetFilters(MsgResetFilters), - MsgInitBaseDep(MsgInitBaseDep), - MsgThreadState(MsgThreadState), - MsgUartState(MsgUartState), - MsgUartStateDepa(MsgUartStateDepa), - MsgIarState(MsgIarState), - MsgMaskSatellite(MsgMaskSatellite), - MsgMaskSatelliteDep(MsgMaskSatelliteDep), - MsgDeviceMonitor(MsgDeviceMonitor), - MsgCommandReq(MsgCommandReq), - MsgCommandResp(MsgCommandResp), - MsgCommandOutput(MsgCommandOutput), - MsgNetworkStateReq(MsgNetworkStateReq), - MsgNetworkStateResp(MsgNetworkStateResp), - MsgNetworkBandwidthUsage(MsgNetworkBandwidthUsage), - MsgCellModemStatus(MsgCellModemStatus), - MsgSpecanDep(MsgSpecanDep), - MsgSpecan(MsgSpecan), - MsgFrontEndGain(MsgFrontEndGain), - MsgAcqResult(MsgAcqResult), - MsgAcqResultDepC(MsgAcqResultDepC), - MsgAcqResultDepB(MsgAcqResultDepB), - MsgAcqResultDepA(MsgAcqResultDepA), MsgVelBody(MsgVelBody), MsgAgeCorrections(MsgAgeCorrections), MsgGPSTimeDepA(MsgGPSTimeDepA), @@ -340,275 +356,229 @@ pub enum SBP { MsgPosLLHDepA(MsgPosLLHDepA), MsgBaselineECEFDepA(MsgBaselineECEFDepA), MsgBaselineNEDDepA(MsgBaselineNEDDepA), - MsgVelECEFDepA(MsgVelECEFDepA), - MsgVelNEDDepA(MsgVelNEDDepA), - MsgBaselineHeadingDepA(MsgBaselineHeadingDepA), - MsgFileioReadReq(MsgFileioReadReq), - MsgFileioReadResp(MsgFileioReadResp), - MsgFileioReadDirReq(MsgFileioReadDirReq), - MsgFileioReadDirResp(MsgFileioReadDirResp), - MsgFileioRemove(MsgFileioRemove), - MsgFileioWriteReq(MsgFileioWriteReq), - MsgFileioWriteResp(MsgFileioWriteResp), - MsgFileioConfigReq(MsgFileioConfigReq), - MsgFileioConfigResp(MsgFileioConfigResp), - MsgLog(MsgLog), - MsgFwd(MsgFwd), - MsgPrintDep(MsgPrintDep), - MsgSettingsSave(MsgSettingsSave), - MsgSettingsWrite(MsgSettingsWrite), - MsgSettingsWriteResp(MsgSettingsWriteResp), - MsgSettingsReadReq(MsgSettingsReadReq), - MsgSettingsReadResp(MsgSettingsReadResp), - MsgSettingsReadByIndexReq(MsgSettingsReadByIndexReq), - MsgSettingsReadByIndexResp(MsgSettingsReadByIndexResp), - MsgSettingsReadByIndexDone(MsgSettingsReadByIndexDone), - MsgSettingsRegister(MsgSettingsRegister), - MsgSettingsRegisterResp(MsgSettingsRegisterResp), - MsgBootloaderHandshakeReq(MsgBootloaderHandshakeReq), - MsgBootloaderHandshakeResp(MsgBootloaderHandshakeResp), - MsgBootloaderJumpToApp(MsgBootloaderJumpToApp), - MsgNapDeviceDnaReq(MsgNapDeviceDnaReq), - MsgBootloaderHandshakeDepA(MsgBootloaderHandshakeDepA), - MsgNapDeviceDnaResp(MsgNapDeviceDnaResp), - MsgDgnssStatus(MsgDgnssStatus), - MsgHeartbeat(MsgHeartbeat), - MsgStartup(MsgStartup), - MsgObsDepA(MsgObsDepA), - MsgObsDepB(MsgObsDepB), - MsgObsDepC(MsgObsDepC), - MsgIono(MsgIono), - MsgSvConfigurationGPSDep(MsgSvConfigurationGPSDep), MsgGnssCapb(MsgGnssCapb), - MsgAlmanacGPSDep(MsgAlmanacGPSDep), - MsgAlmanacGPS(MsgAlmanacGPS), MsgGroupDelayDepA(MsgGroupDelayDepA), MsgGroupDelayDepB(MsgGroupDelayDepB), MsgGroupDelay(MsgGroupDelay), + MsgAlmanacGPSDep(MsgAlmanacGPSDep), + MsgAlmanacGPS(MsgAlmanacGPS), + MsgAlmanacGloDep(MsgAlmanacGloDep), + MsgAlmanacGlo(MsgAlmanacGlo), MsgGloBiases(MsgGloBiases), MsgSvAzEl(MsgSvAzEl), MsgOsr(MsgOsr), - MsgAlmanacGloDep(MsgAlmanacGloDep), - MsgAlmanacGlo(MsgAlmanacGlo), + MsgFlashProgram(MsgFlashProgram), + MsgFlashDone(MsgFlashDone), + MsgFlashReadReq(MsgFlashReadReq), + MsgFlashReadResp(MsgFlashReadResp), + MsgFlashErase(MsgFlashErase), + MsgStmFlashLockSector(MsgStmFlashLockSector), + MsgStmFlashUnlockSector(MsgStmFlashUnlockSector), + MsgStmUniqueIdReq(MsgStmUniqueIdReq), + MsgStmUniqueIdResp(MsgStmUniqueIdResp), + MsgM25FlashWriteStatus(MsgM25FlashWriteStatus), + MsgGPSTime(MsgGPSTime), + MsgUtcTime(MsgUtcTime), + MsgDops(MsgDops), + MsgEphemerisGlo(MsgEphemerisGlo), + MsgEphemerisDepD(MsgEphemerisDepD), + MsgEphemerisDepA(MsgEphemerisDepA), + MsgEphemerisDepB(MsgEphemerisDepB), + MsgEphemerisDepC(MsgEphemerisDepC), + MsgObsDepA(MsgObsDepA), + MsgObsDepB(MsgObsDepB), + MsgObsDepC(MsgObsDepC), + MsgIono(MsgIono), + MsgSvConfigurationGPSDep(MsgSvConfigurationGPSDep), } impl SBP { pub fn parse(msg_id: u16, sender_id: u16, payload: &mut &[u8]) -> Result { let x: Result = match msg_id { - 46 => { - let mut msg = MsgAcqSvProfile::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqSvProfile(msg)) - } - 30 => { - let mut msg = MsgAcqSvProfileDep::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqSvProfileDep(msg)) - } - 30583 => { - let mut msg = MsgSbasRaw::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSbasRaw(msg)) - } - 2307 => { - let mut msg = MsgOdometry::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgOdometry(msg)) - } - 33 => { - let mut msg = MsgTrackingStateDetailedDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingStateDetailedDepA(msg)) - } - 17 => { - let mut msg = MsgTrackingStateDetailedDep::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingStateDetailedDep(msg)) - } - 65 => { - let mut msg = MsgTrackingState::parse(payload)?; + 29 => { + let mut msg = MsgUartState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingState(msg)) + Ok(SBP::MsgUartState(msg)) } - 97 => { - let mut msg = MsgMeasurementState::parse(payload)?; + 24 => { + let mut msg = MsgUartStateDepa::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgMeasurementState(msg)) + Ok(SBP::MsgUartStateDepa(msg)) } - 45 => { - let mut msg = MsgTrackingIq::parse(payload)?; + 178 => { + let mut msg = MsgResetDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingIq(msg)) + Ok(SBP::MsgResetDep(msg)) } - 44 => { - let mut msg = MsgTrackingIqDepB::parse(payload)?; + 192 => { + let mut msg = MsgCwResults::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingIqDepB(msg)) + Ok(SBP::MsgCwResults(msg)) } - 28 => { - let mut msg = MsgTrackingIqDepA::parse(payload)?; + 193 => { + let mut msg = MsgCwStart::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingIqDepA(msg)) + Ok(SBP::MsgCwStart(msg)) } - 22 => { - let mut msg = MsgTrackingStateDepA::parse(payload)?; + 34 => { + let mut msg = MsgResetFilters::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingStateDepA(msg)) + Ok(SBP::MsgResetFilters(msg)) } - 19 => { - let mut msg = MsgTrackingStateDepB::parse(payload)?; + 35 => { + let mut msg = MsgInitBaseDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgTrackingStateDepB(msg)) + Ok(SBP::MsgInitBaseDep(msg)) } - 257 => { - let mut msg = MsgExtEvent::parse(payload)?; + 23 => { + let mut msg = MsgThreadState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgExtEvent(msg)) + Ok(SBP::MsgThreadState(msg)) } - 230 => { - let mut msg = MsgFlashProgram::parse(payload)?; + 188 => { + let mut msg = MsgCommandOutput::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFlashProgram(msg)) + Ok(SBP::MsgCommandOutput(msg)) } - 224 => { - let mut msg = MsgFlashDone::parse(payload)?; + 186 => { + let mut msg = MsgNetworkStateReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFlashDone(msg)) + Ok(SBP::MsgNetworkStateReq(msg)) } - 231 => { - let mut msg = MsgFlashReadReq::parse(payload)?; + 187 => { + let mut msg = MsgNetworkStateResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFlashReadReq(msg)) + Ok(SBP::MsgNetworkStateResp(msg)) } - 225 => { - let mut msg = MsgFlashReadResp::parse(payload)?; + 81 => { + let mut msg = MsgSpecan::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFlashReadResp(msg)) + Ok(SBP::MsgSpecan(msg)) } - 226 => { - let mut msg = MsgFlashErase::parse(payload)?; + 191 => { + let mut msg = MsgFrontEndGain::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFlashErase(msg)) + Ok(SBP::MsgFrontEndGain(msg)) } - 227 => { - let mut msg = MsgStmFlashLockSector::parse(payload)?; + 32512 => { + let mut msg = MsgLinuxCpuState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgStmFlashLockSector(msg)) + Ok(SBP::MsgLinuxCpuState(msg)) } - 228 => { - let mut msg = MsgStmFlashUnlockSector::parse(payload)?; + 189 => { + let mut msg = MsgNetworkBandwidthUsage::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgStmFlashUnlockSector(msg)) + Ok(SBP::MsgNetworkBandwidthUsage(msg)) } - 232 => { - let mut msg = MsgStmUniqueIdReq::parse(payload)?; + 190 => { + let mut msg = MsgCellModemStatus::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgStmUniqueIdReq(msg)) + Ok(SBP::MsgCellModemStatus(msg)) } - 229 => { - let mut msg = MsgStmUniqueIdResp::parse(payload)?; + 80 => { + let mut msg = MsgSpecanDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgStmUniqueIdResp(msg)) + Ok(SBP::MsgSpecanDep(msg)) } - 243 => { - let mut msg = MsgM25FlashWriteStatus::parse(payload)?; + 32515 => { + let mut msg = MsgLinuxProcessSocketCounts::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgM25FlashWriteStatus(msg)) + Ok(SBP::MsgLinuxProcessSocketCounts(msg)) } - 2306 => { - let mut msg = MsgMagRaw::parse(payload)?; + 32516 => { + let mut msg = MsgLinuxProcessSocketQueues::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgMagRaw(msg)) + Ok(SBP::MsgLinuxProcessSocketQueues(msg)) } - 546 => { - let mut msg = MsgAngularRate::parse(payload)?; + 32517 => { + let mut msg = MsgLinuxSocketUsage::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAngularRate(msg)) + Ok(SBP::MsgLinuxSocketUsage(msg)) } - 1024 => { - let mut msg = MsgNdbEvent::parse(payload)?; + 32513 => { + let mut msg = MsgLinuxMemState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNdbEvent(msg)) + Ok(SBP::MsgLinuxMemState(msg)) } - 1501 => { - let mut msg = MsgSsrOrbitClock::parse(payload)?; + 32514 => { + let mut msg = MsgLinuxSysState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrOrbitClock(msg)) + Ok(SBP::MsgLinuxSysState(msg)) } - 1500 => { - let mut msg = MsgSsrOrbitClockDepA::parse(payload)?; + 32518 => { + let mut msg = MsgLinuxProcessFdCount::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrOrbitClockDepA(msg)) + Ok(SBP::MsgLinuxProcessFdCount(msg)) } - 1505 => { - let mut msg = MsgSsrCodeBiases::parse(payload)?; + 32519 => { + let mut msg = MsgLinuxProcessFdSummary::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrCodeBiases(msg)) + Ok(SBP::MsgLinuxProcessFdSummary(msg)) } - 1510 => { - let mut msg = MsgSsrPhaseBiases::parse(payload)?; + 65280 => { + let mut msg = MsgStartup::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrPhaseBiases(msg)) + Ok(SBP::MsgStartup(msg)) } - 1515 => { - let mut msg = MsgSsrStecCorrection::parse(payload)?; + 65282 => { + let mut msg = MsgDgnssStatus::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrStecCorrection(msg)) + Ok(SBP::MsgDgnssStatus(msg)) } - 1520 => { - let mut msg = MsgSsrGriddedCorrection::parse(payload)?; + 65535 => { + let mut msg = MsgHeartbeat::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrGriddedCorrection(msg)) + Ok(SBP::MsgHeartbeat(msg)) } - 1525 => { - let mut msg = MsgSsrGridDefinition::parse(payload)?; + 25 => { + let mut msg = MsgIarState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSsrGridDefinition(msg)) + Ok(SBP::MsgIarState(msg)) } - 32512 => { - let mut msg = MsgLinuxCpuState::parse(payload)?; + 43 => { + let mut msg = MsgMaskSatellite::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxCpuState(msg)) + Ok(SBP::MsgMaskSatellite(msg)) } - 32513 => { - let mut msg = MsgLinuxMemState::parse(payload)?; + 27 => { + let mut msg = MsgMaskSatelliteDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxMemState(msg)) + Ok(SBP::MsgMaskSatelliteDep(msg)) } - 32514 => { - let mut msg = MsgLinuxSysState::parse(payload)?; + 181 => { + let mut msg = MsgDeviceMonitor::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxSysState(msg)) + Ok(SBP::MsgDeviceMonitor(msg)) } - 32515 => { - let mut msg = MsgLinuxProcessSocketCounts::parse(payload)?; + 184 => { + let mut msg = MsgCommandReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxProcessSocketCounts(msg)) + Ok(SBP::MsgCommandReq(msg)) } - 527 => { - let mut msg = MsgBaselineHeading::parse(payload)?; + 185 => { + let mut msg = MsgCommandResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineHeading(msg)) + Ok(SBP::MsgCommandResp(msg)) } - 544 => { - let mut msg = MsgOrientQuat::parse(payload)?; + 1024 => { + let mut msg = MsgNdbEvent::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgOrientQuat(msg)) + Ok(SBP::MsgNdbEvent(msg)) } - 545 => { - let mut msg = MsgOrientEuler::parse(payload)?; + 105 => { + let mut msg = MsgAlmanac::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgOrientEuler(msg)) + Ok(SBP::MsgAlmanac(msg)) } - 2304 => { - let mut msg = MsgImuRaw::parse(payload)?; + 104 => { + let mut msg = MsgSetTime::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgImuRaw(msg)) + Ok(SBP::MsgSetTime(msg)) } - 2305 => { - let mut msg = MsgImuAux::parse(payload)?; + 182 => { + let mut msg = MsgReset::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgImuAux(msg)) + Ok(SBP::MsgReset(msg)) } 74 => { let mut msg = MsgObs::parse(payload)?; @@ -625,6 +595,26 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgBasePosECEF(msg)) } + 65283 => { + let mut msg = MsgInsStatus::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgInsStatus(msg)) + } + 65284 => { + let mut msg = MsgCsacTelemetry::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgCsacTelemetry(msg)) + } + 65285 => { + let mut msg = MsgCsacTelemetryLabels::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgCsacTelemetryLabels(msg)) + } + 257 => { + let mut msg = MsgExtEvent::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgExtEvent(msg)) + } 129 => { let mut msg = MsgEphemerisGPSDepE::parse(payload)?; msg.set_sender_id(sender_id); @@ -635,6 +625,11 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgEphemerisGPSDepF(msg)) } + 138 => { + let mut msg = MsgEphemerisGPS::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgEphemerisGPS(msg)) + } 142 => { let mut msg = MsgEphemerisQzss::parse(payload)?; msg.set_sender_id(sender_id); @@ -645,11 +640,6 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgEphemerisBds(msg)) } - 138 => { - let mut msg = MsgEphemerisGPS::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGPS(msg)) - } 149 => { let mut msg = MsgEphemerisGalDepA::parse(payload)?; msg.set_sender_id(sender_id); @@ -690,285 +680,375 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgEphemerisGloDepC(msg)) } - 32516 => { - let mut msg = MsgLinuxProcessSocketQueues::parse(payload)?; + 136 => { + let mut msg = MsgEphemerisGloDepD::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxProcessSocketQueues(msg)) + Ok(SBP::MsgEphemerisGloDepD(msg)) } - 32517 => { - let mut msg = MsgLinuxSocketUsage::parse(payload)?; + 20 => { + let mut msg = MsgAcqResultDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxSocketUsage(msg)) + Ok(SBP::MsgAcqResultDepB(msg)) } - 259 => { - let mut msg = MsgUtcTime::parse(payload)?; + 21 => { + let mut msg = MsgAcqResultDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgUtcTime(msg)) + Ok(SBP::MsgAcqResultDepA(msg)) } - 520 => { - let mut msg = MsgDops::parse(payload)?; + 46 => { + let mut msg = MsgAcqSvProfile::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgDops(msg)) + Ok(SBP::MsgAcqSvProfile(msg)) } - 32518 => { - let mut msg = MsgLinuxProcessFdCount::parse(payload)?; + 30 => { + let mut msg = MsgAcqSvProfileDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxProcessFdCount(msg)) + Ok(SBP::MsgAcqSvProfileDep(msg)) } - 32519 => { - let mut msg = MsgLinuxProcessFdSummary::parse(payload)?; + 30583 => { + let mut msg = MsgSbasRaw::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLinuxProcessFdSummary(msg)) + Ok(SBP::MsgSbasRaw(msg)) } - 2048 => { - let mut msg = MsgUserData::parse(payload)?; + 161 => { + let mut msg = MsgSettingsSave::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgUserData(msg)) + Ok(SBP::MsgSettingsSave(msg)) } - 258 => { - let mut msg = MsgGPSTime::parse(payload)?; + 160 => { + let mut msg = MsgSettingsWrite::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgGPSTime(msg)) + Ok(SBP::MsgSettingsWrite(msg)) } - 521 => { - let mut msg = MsgPosECEF::parse(payload)?; + 175 => { + let mut msg = MsgSettingsWriteResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPosECEF(msg)) + Ok(SBP::MsgSettingsWriteResp(msg)) } - 532 => { - let mut msg = MsgPosECEFCov::parse(payload)?; + 164 => { + let mut msg = MsgSettingsReadReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPosECEFCov(msg)) + Ok(SBP::MsgSettingsReadReq(msg)) } - 522 => { - let mut msg = MsgPosLLH::parse(payload)?; + 165 => { + let mut msg = MsgSettingsReadResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPosLLH(msg)) + Ok(SBP::MsgSettingsReadResp(msg)) } - 529 => { - let mut msg = MsgPosLLHCov::parse(payload)?; + 162 => { + let mut msg = MsgSettingsReadByIndexReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPosLLHCov(msg)) + Ok(SBP::MsgSettingsReadByIndexReq(msg)) } - 523 => { - let mut msg = MsgBaselineECEF::parse(payload)?; + 167 => { + let mut msg = MsgSettingsReadByIndexResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineECEF(msg)) + Ok(SBP::MsgSettingsReadByIndexResp(msg)) + } + 166 => { + let mut msg = MsgSettingsReadByIndexDone::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSettingsReadByIndexDone(msg)) + } + 174 => { + let mut msg = MsgSettingsRegister::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSettingsRegister(msg)) + } + 431 => { + let mut msg = MsgSettingsRegisterResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgSettingsRegisterResp(msg)) + } + 179 => { + let mut msg = MsgBootloaderHandshakeReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBootloaderHandshakeReq(msg)) + } + 180 => { + let mut msg = MsgBootloaderHandshakeResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBootloaderHandshakeResp(msg)) + } + 177 => { + let mut msg = MsgBootloaderJumpToApp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBootloaderJumpToApp(msg)) + } + 222 => { + let mut msg = MsgNapDeviceDnaReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgNapDeviceDnaReq(msg)) + } + 221 => { + let mut msg = MsgNapDeviceDnaResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgNapDeviceDnaResp(msg)) + } + 176 => { + let mut msg = MsgBootloaderHandshakeDepA::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgBootloaderHandshakeDepA(msg)) + } + 168 => { + let mut msg = MsgFileioReadReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadReq(msg)) + } + 163 => { + let mut msg = MsgFileioReadResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadResp(msg)) + } + 169 => { + let mut msg = MsgFileioReadDirReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadDirReq(msg)) + } + 170 => { + let mut msg = MsgFileioReadDirResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioReadDirResp(msg)) + } + 172 => { + let mut msg = MsgFileioRemove::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioRemove(msg)) + } + 173 => { + let mut msg = MsgFileioWriteReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioWriteReq(msg)) + } + 171 => { + let mut msg = MsgFileioWriteResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioWriteResp(msg)) + } + 4097 => { + let mut msg = MsgFileioConfigReq::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioConfigReq(msg)) + } + 4098 => { + let mut msg = MsgFileioConfigResp::parse(payload)?; + msg.set_sender_id(sender_id); + Ok(SBP::MsgFileioConfigResp(msg)) } - 524 => { - let mut msg = MsgBaselineNED::parse(payload)?; + 45 => { + let mut msg = MsgTrackingIq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineNED(msg)) + Ok(SBP::MsgTrackingIq(msg)) } - 525 => { - let mut msg = MsgVelECEF::parse(payload)?; + 44 => { + let mut msg = MsgTrackingIqDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgVelECEF(msg)) + Ok(SBP::MsgTrackingIqDepB(msg)) } - 533 => { - let mut msg = MsgVelECEFCov::parse(payload)?; + 28 => { + let mut msg = MsgTrackingIqDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgVelECEFCov(msg)) + Ok(SBP::MsgTrackingIqDepA(msg)) } - 526 => { - let mut msg = MsgVelNED::parse(payload)?; + 22 => { + let mut msg = MsgTrackingStateDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgVelNED(msg)) + Ok(SBP::MsgTrackingStateDepA(msg)) } - 530 => { - let mut msg = MsgVelNEDCov::parse(payload)?; + 19 => { + let mut msg = MsgTrackingStateDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgVelNEDCov(msg)) + Ok(SBP::MsgTrackingStateDepB(msg)) } - 136 => { - let mut msg = MsgEphemerisGloDepD::parse(payload)?; + 1025 => { + let mut msg = MsgLog::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGloDepD(msg)) + Ok(SBP::MsgLog(msg)) } - 139 => { - let mut msg = MsgEphemerisGlo::parse(payload)?; + 1026 => { + let mut msg = MsgFwd::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisGlo(msg)) + Ok(SBP::MsgFwd(msg)) } - 128 => { - let mut msg = MsgEphemerisDepD::parse(payload)?; + 16 => { + let mut msg = MsgPrintDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisDepD(msg)) + Ok(SBP::MsgPrintDep(msg)) } - 26 => { - let mut msg = MsgEphemerisDepA::parse(payload)?; + 2304 => { + let mut msg = MsgImuRaw::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisDepA(msg)) + Ok(SBP::MsgImuRaw(msg)) } - 70 => { - let mut msg = MsgEphemerisDepB::parse(payload)?; + 2305 => { + let mut msg = MsgImuAux::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisDepB(msg)) + Ok(SBP::MsgImuAux(msg)) } - 71 => { - let mut msg = MsgEphemerisDepC::parse(payload)?; + 2306 => { + let mut msg = MsgMagRaw::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgEphemerisDepC(msg)) + Ok(SBP::MsgMagRaw(msg)) } - 65283 => { - let mut msg = MsgInsStatus::parse(payload)?; + 1501 => { + let mut msg = MsgSsrOrbitClock::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgInsStatus(msg)) + Ok(SBP::MsgSsrOrbitClock(msg)) } - 65284 => { - let mut msg = MsgCsacTelemetry::parse(payload)?; + 1500 => { + let mut msg = MsgSsrOrbitClockDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCsacTelemetry(msg)) + Ok(SBP::MsgSsrOrbitClockDepA(msg)) } - 65285 => { - let mut msg = MsgCsacTelemetryLabels::parse(payload)?; + 1505 => { + let mut msg = MsgSsrCodeBiases::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCsacTelemetryLabels(msg)) + Ok(SBP::MsgSsrCodeBiases(msg)) } - 105 => { - let mut msg = MsgAlmanac::parse(payload)?; + 1510 => { + let mut msg = MsgSsrPhaseBiases::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanac(msg)) + Ok(SBP::MsgSsrPhaseBiases(msg)) } - 104 => { - let mut msg = MsgSetTime::parse(payload)?; + 1515 => { + let mut msg = MsgSsrStecCorrection::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSetTime(msg)) + Ok(SBP::MsgSsrStecCorrection(msg)) } - 182 => { - let mut msg = MsgReset::parse(payload)?; + 1520 => { + let mut msg = MsgSsrGriddedCorrection::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgReset(msg)) + Ok(SBP::MsgSsrGriddedCorrection(msg)) } - 178 => { - let mut msg = MsgResetDep::parse(payload)?; + 1525 => { + let mut msg = MsgSsrGridDefinition::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgResetDep(msg)) + Ok(SBP::MsgSsrGridDefinition(msg)) } - 192 => { - let mut msg = MsgCwResults::parse(payload)?; + 2048 => { + let mut msg = MsgUserData::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCwResults(msg)) + Ok(SBP::MsgUserData(msg)) } - 193 => { - let mut msg = MsgCwStart::parse(payload)?; + 47 => { + let mut msg = MsgAcqResult::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCwStart(msg)) + Ok(SBP::MsgAcqResult(msg)) } - 34 => { - let mut msg = MsgResetFilters::parse(payload)?; + 31 => { + let mut msg = MsgAcqResultDepC::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgResetFilters(msg)) + Ok(SBP::MsgAcqResultDepC(msg)) } - 35 => { - let mut msg = MsgInitBaseDep::parse(payload)?; + 516 => { + let mut msg = MsgVelECEFDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgInitBaseDep(msg)) + Ok(SBP::MsgVelECEFDepA(msg)) } - 23 => { - let mut msg = MsgThreadState::parse(payload)?; + 517 => { + let mut msg = MsgVelNEDDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgThreadState(msg)) + Ok(SBP::MsgVelNEDDepA(msg)) } - 29 => { - let mut msg = MsgUartState::parse(payload)?; + 519 => { + let mut msg = MsgBaselineHeadingDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgUartState(msg)) + Ok(SBP::MsgBaselineHeadingDepA(msg)) } - 24 => { - let mut msg = MsgUartStateDepa::parse(payload)?; + 2307 => { + let mut msg = MsgOdometry::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgUartStateDepa(msg)) + Ok(SBP::MsgOdometry(msg)) } - 25 => { - let mut msg = MsgIarState::parse(payload)?; + 527 => { + let mut msg = MsgBaselineHeading::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgIarState(msg)) + Ok(SBP::MsgBaselineHeading(msg)) } - 43 => { - let mut msg = MsgMaskSatellite::parse(payload)?; + 544 => { + let mut msg = MsgOrientQuat::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgMaskSatellite(msg)) + Ok(SBP::MsgOrientQuat(msg)) } - 27 => { - let mut msg = MsgMaskSatelliteDep::parse(payload)?; + 545 => { + let mut msg = MsgOrientEuler::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgMaskSatelliteDep(msg)) + Ok(SBP::MsgOrientEuler(msg)) } - 181 => { - let mut msg = MsgDeviceMonitor::parse(payload)?; + 546 => { + let mut msg = MsgAngularRate::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgDeviceMonitor(msg)) + Ok(SBP::MsgAngularRate(msg)) } - 184 => { - let mut msg = MsgCommandReq::parse(payload)?; + 33 => { + let mut msg = MsgTrackingStateDetailedDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCommandReq(msg)) + Ok(SBP::MsgTrackingStateDetailedDepA(msg)) } - 185 => { - let mut msg = MsgCommandResp::parse(payload)?; + 17 => { + let mut msg = MsgTrackingStateDetailedDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCommandResp(msg)) + Ok(SBP::MsgTrackingStateDetailedDep(msg)) } - 188 => { - let mut msg = MsgCommandOutput::parse(payload)?; + 65 => { + let mut msg = MsgTrackingState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCommandOutput(msg)) + Ok(SBP::MsgTrackingState(msg)) } - 186 => { - let mut msg = MsgNetworkStateReq::parse(payload)?; + 97 => { + let mut msg = MsgMeasurementState::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNetworkStateReq(msg)) + Ok(SBP::MsgMeasurementState(msg)) } - 187 => { - let mut msg = MsgNetworkStateResp::parse(payload)?; + 521 => { + let mut msg = MsgPosECEF::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNetworkStateResp(msg)) + Ok(SBP::MsgPosECEF(msg)) } - 189 => { - let mut msg = MsgNetworkBandwidthUsage::parse(payload)?; + 532 => { + let mut msg = MsgPosECEFCov::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNetworkBandwidthUsage(msg)) + Ok(SBP::MsgPosECEFCov(msg)) } - 190 => { - let mut msg = MsgCellModemStatus::parse(payload)?; + 522 => { + let mut msg = MsgPosLLH::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgCellModemStatus(msg)) + Ok(SBP::MsgPosLLH(msg)) } - 80 => { - let mut msg = MsgSpecanDep::parse(payload)?; + 529 => { + let mut msg = MsgPosLLHCov::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSpecanDep(msg)) + Ok(SBP::MsgPosLLHCov(msg)) } - 81 => { - let mut msg = MsgSpecan::parse(payload)?; + 523 => { + let mut msg = MsgBaselineECEF::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSpecan(msg)) + Ok(SBP::MsgBaselineECEF(msg)) } - 191 => { - let mut msg = MsgFrontEndGain::parse(payload)?; + 524 => { + let mut msg = MsgBaselineNED::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFrontEndGain(msg)) + Ok(SBP::MsgBaselineNED(msg)) } - 47 => { - let mut msg = MsgAcqResult::parse(payload)?; + 525 => { + let mut msg = MsgVelECEF::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqResult(msg)) + Ok(SBP::MsgVelECEF(msg)) } - 31 => { - let mut msg = MsgAcqResultDepC::parse(payload)?; + 533 => { + let mut msg = MsgVelECEFCov::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqResultDepC(msg)) + Ok(SBP::MsgVelECEFCov(msg)) } - 20 => { - let mut msg = MsgAcqResultDepB::parse(payload)?; + 526 => { + let mut msg = MsgVelNED::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqResultDepB(msg)) + Ok(SBP::MsgVelNED(msg)) } - 21 => { - let mut msg = MsgAcqResultDepA::parse(payload)?; + 530 => { + let mut msg = MsgVelNEDCov::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgAcqResultDepA(msg)) + Ok(SBP::MsgVelNEDCov(msg)) } 531 => { let mut msg = MsgVelBody::parse(payload)?; @@ -1010,175 +1090,150 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgBaselineNEDDepA(msg)) } - 516 => { - let mut msg = MsgVelECEFDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgVelECEFDepA(msg)) - } - 517 => { - let mut msg = MsgVelNEDDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgVelNEDDepA(msg)) - } - 519 => { - let mut msg = MsgBaselineHeadingDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgBaselineHeadingDepA(msg)) - } - 168 => { - let mut msg = MsgFileioReadReq::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioReadReq(msg)) - } - 163 => { - let mut msg = MsgFileioReadResp::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioReadResp(msg)) - } - 169 => { - let mut msg = MsgFileioReadDirReq::parse(payload)?; + 150 => { + let mut msg = MsgGnssCapb::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioReadDirReq(msg)) + Ok(SBP::MsgGnssCapb(msg)) } - 170 => { - let mut msg = MsgFileioReadDirResp::parse(payload)?; + 146 => { + let mut msg = MsgGroupDelayDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioReadDirResp(msg)) + Ok(SBP::MsgGroupDelayDepA(msg)) } - 172 => { - let mut msg = MsgFileioRemove::parse(payload)?; + 147 => { + let mut msg = MsgGroupDelayDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioRemove(msg)) + Ok(SBP::MsgGroupDelayDepB(msg)) } - 173 => { - let mut msg = MsgFileioWriteReq::parse(payload)?; + 148 => { + let mut msg = MsgGroupDelay::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioWriteReq(msg)) + Ok(SBP::MsgGroupDelay(msg)) } - 171 => { - let mut msg = MsgFileioWriteResp::parse(payload)?; + 112 => { + let mut msg = MsgAlmanacGPSDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioWriteResp(msg)) + Ok(SBP::MsgAlmanacGPSDep(msg)) } - 4097 => { - let mut msg = MsgFileioConfigReq::parse(payload)?; + 114 => { + let mut msg = MsgAlmanacGPS::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioConfigReq(msg)) + Ok(SBP::MsgAlmanacGPS(msg)) } - 4098 => { - let mut msg = MsgFileioConfigResp::parse(payload)?; + 113 => { + let mut msg = MsgAlmanacGloDep::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFileioConfigResp(msg)) + Ok(SBP::MsgAlmanacGloDep(msg)) } - 1025 => { - let mut msg = MsgLog::parse(payload)?; + 115 => { + let mut msg = MsgAlmanacGlo::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgLog(msg)) + Ok(SBP::MsgAlmanacGlo(msg)) } - 1026 => { - let mut msg = MsgFwd::parse(payload)?; + 117 => { + let mut msg = MsgGloBiases::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgFwd(msg)) + Ok(SBP::MsgGloBiases(msg)) } - 16 => { - let mut msg = MsgPrintDep::parse(payload)?; + 151 => { + let mut msg = MsgSvAzEl::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgPrintDep(msg)) + Ok(SBP::MsgSvAzEl(msg)) } - 161 => { - let mut msg = MsgSettingsSave::parse(payload)?; + 1600 => { + let mut msg = MsgOsr::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsSave(msg)) + Ok(SBP::MsgOsr(msg)) } - 160 => { - let mut msg = MsgSettingsWrite::parse(payload)?; + 230 => { + let mut msg = MsgFlashProgram::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsWrite(msg)) + Ok(SBP::MsgFlashProgram(msg)) } - 175 => { - let mut msg = MsgSettingsWriteResp::parse(payload)?; + 224 => { + let mut msg = MsgFlashDone::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsWriteResp(msg)) + Ok(SBP::MsgFlashDone(msg)) } - 164 => { - let mut msg = MsgSettingsReadReq::parse(payload)?; + 231 => { + let mut msg = MsgFlashReadReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsReadReq(msg)) + Ok(SBP::MsgFlashReadReq(msg)) } - 165 => { - let mut msg = MsgSettingsReadResp::parse(payload)?; + 225 => { + let mut msg = MsgFlashReadResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsReadResp(msg)) + Ok(SBP::MsgFlashReadResp(msg)) } - 162 => { - let mut msg = MsgSettingsReadByIndexReq::parse(payload)?; + 226 => { + let mut msg = MsgFlashErase::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsReadByIndexReq(msg)) + Ok(SBP::MsgFlashErase(msg)) } - 167 => { - let mut msg = MsgSettingsReadByIndexResp::parse(payload)?; + 227 => { + let mut msg = MsgStmFlashLockSector::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsReadByIndexResp(msg)) + Ok(SBP::MsgStmFlashLockSector(msg)) } - 166 => { - let mut msg = MsgSettingsReadByIndexDone::parse(payload)?; + 228 => { + let mut msg = MsgStmFlashUnlockSector::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsReadByIndexDone(msg)) + Ok(SBP::MsgStmFlashUnlockSector(msg)) } - 174 => { - let mut msg = MsgSettingsRegister::parse(payload)?; + 232 => { + let mut msg = MsgStmUniqueIdReq::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsRegister(msg)) + Ok(SBP::MsgStmUniqueIdReq(msg)) } - 431 => { - let mut msg = MsgSettingsRegisterResp::parse(payload)?; + 229 => { + let mut msg = MsgStmUniqueIdResp::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgSettingsRegisterResp(msg)) + Ok(SBP::MsgStmUniqueIdResp(msg)) } - 179 => { - let mut msg = MsgBootloaderHandshakeReq::parse(payload)?; + 243 => { + let mut msg = MsgM25FlashWriteStatus::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBootloaderHandshakeReq(msg)) + Ok(SBP::MsgM25FlashWriteStatus(msg)) } - 180 => { - let mut msg = MsgBootloaderHandshakeResp::parse(payload)?; + 258 => { + let mut msg = MsgGPSTime::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBootloaderHandshakeResp(msg)) + Ok(SBP::MsgGPSTime(msg)) } - 177 => { - let mut msg = MsgBootloaderJumpToApp::parse(payload)?; + 259 => { + let mut msg = MsgUtcTime::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBootloaderJumpToApp(msg)) + Ok(SBP::MsgUtcTime(msg)) } - 222 => { - let mut msg = MsgNapDeviceDnaReq::parse(payload)?; + 520 => { + let mut msg = MsgDops::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNapDeviceDnaReq(msg)) + Ok(SBP::MsgDops(msg)) } - 176 => { - let mut msg = MsgBootloaderHandshakeDepA::parse(payload)?; + 139 => { + let mut msg = MsgEphemerisGlo::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgBootloaderHandshakeDepA(msg)) + Ok(SBP::MsgEphemerisGlo(msg)) } - 221 => { - let mut msg = MsgNapDeviceDnaResp::parse(payload)?; + 128 => { + let mut msg = MsgEphemerisDepD::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgNapDeviceDnaResp(msg)) + Ok(SBP::MsgEphemerisDepD(msg)) } - 65282 => { - let mut msg = MsgDgnssStatus::parse(payload)?; + 26 => { + let mut msg = MsgEphemerisDepA::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgDgnssStatus(msg)) + Ok(SBP::MsgEphemerisDepA(msg)) } - 65535 => { - let mut msg = MsgHeartbeat::parse(payload)?; + 70 => { + let mut msg = MsgEphemerisDepB::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgHeartbeat(msg)) + Ok(SBP::MsgEphemerisDepB(msg)) } - 65280 => { - let mut msg = MsgStartup::parse(payload)?; + 71 => { + let mut msg = MsgEphemerisDepC::parse(payload)?; msg.set_sender_id(sender_id); - Ok(SBP::MsgStartup(msg)) + Ok(SBP::MsgEphemerisDepC(msg)) } 69 => { let mut msg = MsgObsDepA::parse(payload)?; @@ -1205,61 +1260,6 @@ impl SBP { msg.set_sender_id(sender_id); Ok(SBP::MsgSvConfigurationGPSDep(msg)) } - 150 => { - let mut msg = MsgGnssCapb::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgGnssCapb(msg)) - } - 112 => { - let mut msg = MsgAlmanacGPSDep::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanacGPSDep(msg)) - } - 114 => { - let mut msg = MsgAlmanacGPS::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanacGPS(msg)) - } - 146 => { - let mut msg = MsgGroupDelayDepA::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgGroupDelayDepA(msg)) - } - 147 => { - let mut msg = MsgGroupDelayDepB::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgGroupDelayDepB(msg)) - } - 148 => { - let mut msg = MsgGroupDelay::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgGroupDelay(msg)) - } - 117 => { - let mut msg = MsgGloBiases::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgGloBiases(msg)) - } - 151 => { - let mut msg = MsgSvAzEl::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgSvAzEl(msg)) - } - 1600 => { - let mut msg = MsgOsr::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgOsr(msg)) - } - 113 => { - let mut msg = MsgAlmanacGloDep::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanacGloDep(msg)) - } - 115 => { - let mut msg = MsgAlmanacGlo::parse(payload)?; - msg.set_sender_id(sender_id); - Ok(SBP::MsgAlmanacGlo(msg)) - } _ => Ok(SBP::Unknown { msg_id: msg_id, sender_id: sender_id, diff --git a/rust/sbp/src/messages/navigation.rs b/rust/sbp/src/messages/navigation.rs index 13b5d196d3..6f5f60fc09 100644 --- a/rust/sbp/src/messages/navigation.rs +++ b/rust/sbp/src/messages/navigation.rs @@ -12,20 +12,25 @@ // Automatically generated from yaml/swiftnav/sbp/navigation.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -//! Geodetic navigation messages reporting GPS time, position, velocity, and -//! baseline position solutions. For position solutions, these messages define -//! several different position solutions: single-point (SPP), RTK, and pseudo- -//! absolute position solutions. The SPP is the standalone, absolute GPS -//! position solution using only a single receiver. The RTK solution is the -//! differential GPS solution, which can use either a fixed/integer or floating -//! carrier phase ambiguity. The pseudo-absolute position solution uses a user- -//! provided, well-surveyed base station position (if available) and the RTK -//! solution in tandem. When the inertial navigation mode indicates that the -//! IMU is used, all messages are reported in the vehicle body frame as defined -//! by device settings. By default, the vehicle body frame is configured to be +//! Geodetic navigation messages reporting GPS time, position, velocity, +//! and baseline position solutions. For position solutions, these +//! messages define several different position solutions: single-point +//! (SPP), RTK, and pseudo-absolute position solutions. +//! +//! The SPP is the standalone, absolute GPS position solution using only +//! a single receiver. The RTK solution is the differential GPS +//! solution, which can use either a fixed/integer or floating carrier +//! phase ambiguity. The pseudo-absolute position solution uses a +//! user-provided, well-surveyed base station position (if available) +//! and the RTK solution in tandem. +//! +//! When the inertial navigation mode indicates that the IMU is used, +//! all messages are reported in the vehicle body frame as defined by +//! device settings. By default, the vehicle body frame is configured to be //! coincident with the antenna phase center. When there is no inertial -//! navigation, the solution will be reported at the phase center of the -//! antenna. There is no inertial navigation capability on Piksi Multi or Duro. +//! navigation, the solution will be reported at the phase center of the antenna. +//! There is no inertial navigation capability on Piksi Multi or Duro. +//! extern crate byteorder; #[allow(unused_imports)] diff --git a/rust/sbp/src/messages/ndb.rs b/rust/sbp/src/messages/ndb.rs index a884194fb6..936b045c48 100644 --- a/rust/sbp/src/messages/ndb.rs +++ b/rust/sbp/src/messages/ndb.rs @@ -13,6 +13,7 @@ // with generate.py. Please do not hand edit! //****************************************************************************/ //! Messages for logging NDB events. +//! extern crate byteorder; #[allow(unused_imports)] diff --git a/rust/sbp/src/messages/piksi.rs b/rust/sbp/src/messages/piksi.rs index e1a22e196c..efb11802fe 100644 --- a/rust/sbp/src/messages/piksi.rs +++ b/rust/sbp/src/messages/piksi.rs @@ -12,9 +12,10 @@ // Automatically generated from yaml/swiftnav/sbp/piksi.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -//! System health, configuration, and diagnostic messages specific to the Piksi -//! L1 receiver, including a variety of legacy messages that may no longer be -//! used. +//! System health, configuration, and diagnostic messages specific to +//! the Piksi L1 receiver, including a variety of legacy messages that +//! may no longer be used. +//! extern crate byteorder; #[allow(unused_imports)] diff --git a/rust/sbp/src/messages/settings.rs b/rust/sbp/src/messages/settings.rs index f45548977b..93138f71f2 100644 --- a/rust/sbp/src/messages/settings.rs +++ b/rust/sbp/src/messages/settings.rs @@ -12,30 +12,33 @@ // Automatically generated from yaml/swiftnav/sbp/settings.yaml // with generate.py. Please do not hand edit! //****************************************************************************/ -//! Messages for reading, writing, and discovering device settings. Settings +//! +//! Messages for reading, writing, and discovering device settings. Settings //! with a "string" field have multiple values in this field delimited with a //! null character (the c style null terminator). For instance, when querying //! the 'firmware_version' setting in the 'system_info' section, the following //! array of characters needs to be sent for the string field in //! MSG_SETTINGS_READ: "system_info\0firmware_version\0", where the delimiting //! null characters are specified with the escape sequence '\0' and all -//! quotation marks should be omitted. In the message descriptions below, -//! the generic strings SECTION_SETTING and SETTING are used to refer to the -//! two strings that comprise the identifier of an individual setting.In -//! firmware_version example above, SECTION_SETTING is the 'system_info', and -//! the SETTING portion is 'firmware_version'. See the "Software Settings -//! Manual" on support.swiftnav.com for detailed documentation about all -//! settings and sections available for each Swift firmware version. Settings -//! manuals are available for each firmware version at the following link: -//! @@https://support.swiftnav.com/customer/en/portal/articles/2628580-piksi- -//! multi-specifications#settings[Piksi Multi Specifications]. The latest -//! settings document is also available at the following link: -//! @@http://swiftnav.com/latest/piksi-multi-settings[Latest settings document] -//! . See lastly @@https://github.com/swift- -//! nav/piksi_tools/blob/master/piksi_tools/settings.py[settings.py] , the -//! open source python command line utility for reading, writing, and saving -//! settings in the piksi_tools repository on github as a helpful reference and -//! example. +//! quotation marks should be omitted. +//! +//! +//! In the message descriptions below, the generic strings SECTION_SETTING and +//! SETTING are used to refer to the two strings that comprise the identifier +//! of an individual setting.In firmware_version example above, SECTION_SETTING +//! is the 'system_info', and the SETTING portion is 'firmware_version'. +//! +//! See the "Software Settings Manual" on support.swiftnav.com for detailed +//! documentation about all settings and sections available for each Swift +//! firmware version. Settings manuals are available for each firmware version +//! at the following link: @@https://support.swiftnav.com/customer/en/portal/articles/2628580-piksi-multi-specifications#settings[Piksi Multi Specifications]. +//! The latest settings document is also available at the following link: +//! @@http://swiftnav.com/latest/piksi-multi-settings[Latest settings document] . +//! See lastly @@https://github.com/swift-nav/piksi_tools/blob/master/piksi_tools/settings.py[settings.py] , +//! the open source python command line utility for reading, writing, and +//! saving settings in the piksi_tools repository on github as a helpful +//! reference and example. +//! extern crate byteorder; #[allow(unused_imports)] diff --git a/rust/sbp/src/messages/tracking.rs b/rust/sbp/src/messages/tracking.rs index fbddfeb161..15a05325f9 100644 --- a/rust/sbp/src/messages/tracking.rs +++ b/rust/sbp/src/messages/tracking.rs @@ -13,6 +13,7 @@ // with generate.py. Please do not hand edit! //****************************************************************************/ //! Satellite code and carrier-phase tracking messages from the device. +//! extern crate byteorder; #[allow(unused_imports)] diff --git a/rust/sbp/src/messages/user.rs b/rust/sbp/src/messages/user.rs index 2ac322c266..41cf4dec65 100644 --- a/rust/sbp/src/messages/user.rs +++ b/rust/sbp/src/messages/user.rs @@ -13,6 +13,7 @@ // with generate.py. Please do not hand edit! //****************************************************************************/ //! Messages reserved for use by the user. +//! extern crate byteorder; #[allow(unused_imports)] From 52cf3518d9104a13b920734c906b2ced9f1ed594 Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Mon, 22 Jul 2019 20:17:12 -0700 Subject: [PATCH 25/25] Updated the Cargo file with more info --- rust/sbp/Cargo.toml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rust/sbp/Cargo.toml b/rust/sbp/Cargo.toml index 3d28c624c7..53484564a6 100644 --- a/rust/sbp/Cargo.toml +++ b/rust/sbp/Cargo.toml @@ -1,10 +1,16 @@ [package] name = "sbp" version = "0.1.0" -authors = ["Gareth McMullin "] description = "Rust native implementation of SBP (Swift Binary Protocol) for communicating with devices made by Swift Navigation" +authors = ["Swift Navigation "] +repository = "https://github.com/swift-nav/libsbp" +license = "LGPL-3.0" +categories = ["parsing"] [dependencies] byteorder = "1.2.1" crc16 = "*" -nom = "5.0.0-beta2" +nom = "5.0.0" + +[badges] +travis-ci = { repository = "swift-nav/libsbp" }