diff --git a/c/include/libsbp/imu.h b/c/include/libsbp/imu.h index f9c8c6abee..2e12d3c44f 100644 --- a/c/include/libsbp/imu.h +++ b/c/include/libsbp/imu.h @@ -36,7 +36,7 @@ SBP_PACK_START * device hardware and settings, are communicated via the MSG_IMU_AUX message. * If using "time since startup" time tags, the receiving end will expect a * `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise IMU measurements - * with GNSS. + * with GNSS. The timestamp must wrap around to zero when reaching one week (604800 seconds). * * The time-tagging mode should not change throughout a run. */ diff --git a/docs/sbp.pdf b/docs/sbp.pdf index 49e16c304c..61b958a5f4 100644 Binary files a/docs/sbp.pdf and b/docs/sbp.pdf differ diff --git a/haskell/src/SwiftNav/SBP/Imu.hs b/haskell/src/SwiftNav/SBP/Imu.hs index 4ad77f8cdb..1f8fa322b0 100644 --- a/haskell/src/SwiftNav/SBP/Imu.hs +++ b/haskell/src/SwiftNav/SBP/Imu.hs @@ -46,8 +46,9 @@ msgImuRaw = 0x0900 -- to the device hardware and settings, are communicated via the MSG_IMU_AUX -- message. If using "time since startup" time tags, the receiving end will -- expect a `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to --- synchronise IMU measurements with GNSS. The time-tagging mode should not --- change throughout a run. +-- synchronise IMU measurements with GNSS. The timestamp must wrap around to +-- zero when reaching one week (604800 seconds). The time-tagging mode should +-- not change throughout a run. data MsgImuRaw = MsgImuRaw { _msgImuRaw_tow :: !Word32 -- ^ Milliseconds since reference epoch and time status. diff --git a/java/src/com/swiftnav/sbp/imu/MsgImuRaw.java b/java/src/com/swiftnav/sbp/imu/MsgImuRaw.java index 1299b245df..642a5f7d66 100644 --- a/java/src/com/swiftnav/sbp/imu/MsgImuRaw.java +++ b/java/src/com/swiftnav/sbp/imu/MsgImuRaw.java @@ -34,7 +34,7 @@ * device hardware and settings, are communicated via the MSG_IMU_AUX message. * If using "time since startup" time tags, the receiving end will expect a * `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise IMU measurements - * with GNSS. + * with GNSS. The timestamp must wrap around to zero when reaching one week (604800 seconds). * * The time-tagging mode should not change throughout a run. */ diff --git a/javascript/sbp/imu.js b/javascript/sbp/imu.js index c3b6a708f9..3efc57c25f 100644 --- a/javascript/sbp/imu.js +++ b/javascript/sbp/imu.js @@ -32,7 +32,8 @@ var UInt64 = require('cuint').UINT64; * device hardware and settings, are communicated via the MSG_IMU_AUX message. If * using "time since startup" time tags, the receiving end will expect a * `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise IMU - * measurements with GNSS. The time-tagging mode should not change throughout a + * measurements with GNSS. The timestamp must wrap around to zero when reaching one + * week (604800 seconds). The time-tagging mode should not change throughout a * run. * * Fields in the SBP payload (`sbp.payload`): diff --git a/jsonschema/MsgGroupMeta.json b/jsonschema/MsgGroupMeta.json new file mode 100644 index 0000000000..69746fee5a --- /dev/null +++ b/jsonschema/MsgGroupMeta.json @@ -0,0 +1,32 @@ +{ + "copyright": [ + "Copyright (C) 2019 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." + ], + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "#MsgGroupMeta", + "title":"MsgGroupMeta", + "description":"This leading message lists the time metadata of the Solution Group.,\nIt also lists the atomic contents (i.e. types of messages included) of the Solution Group.\n", + "type": "object", + "properties": { + "wn": {"type": "integer"}, + "tom": {"type": "integer"}, + "ns_residual": {"type": "integer"}, + "flags": {"type": "integer"}, + "group_msgs": {"type": "array", "items": {"type": "integer"}} + }, + "required": [ + "wn", + "tom", + "ns_residual", + "flags", + "group_msgs" + ] +} \ No newline at end of file diff --git a/jsonschema/MsgImuRaw.json b/jsonschema/MsgImuRaw.json index 9a0179574e..72fb2703be 100644 --- a/jsonschema/MsgImuRaw.json +++ b/jsonschema/MsgImuRaw.json @@ -13,7 +13,7 @@ "$schema": "http://json-schema.org/draft-06/schema#", "$id": "#MsgImuRaw", "title":"MsgImuRaw", - "description":"Raw data from the Inertial Measurement Unit, containing accelerometer and,\ngyroscope readings. The sense of the measurements are to be aligned with ,\nthe indications on the device itself. Measurement units, which are specific to the,\ndevice hardware and settings, are communicated via the MSG_IMU_AUX message.,\nIf using \"time since startup\" time tags, the receiving end will expect a,\n`MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise IMU measurements,\nwith GNSS.,\n,\nThe time-tagging mode should not change throughout a run.\n", + "description":"Raw data from the Inertial Measurement Unit, containing accelerometer and,\ngyroscope readings. The sense of the measurements are to be aligned with ,\nthe indications on the device itself. Measurement units, which are specific to the,\ndevice hardware and settings, are communicated via the MSG_IMU_AUX message.,\nIf using \"time since startup\" time tags, the receiving end will expect a,\n`MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise IMU measurements,\nwith GNSS. The timestamp must wrap around to zero when reaching one week (604800 seconds).,\n,\nThe time-tagging mode should not change throughout a run.\n", "type": "object", "properties": { "tow": {"type": "integer"}, diff --git a/proto/imu.proto b/proto/imu.proto index 4634a58c9b..314b51668b 100644 --- a/proto/imu.proto +++ b/proto/imu.proto @@ -28,7 +28,7 @@ package swiftnav.sbp.imu; * device hardware and settings, are communicated via the MSG_IMU_AUX message. * If using "time since startup" time tags, the receiving end will expect a * `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise IMU measurements - * with GNSS. + * with GNSS. The timestamp must wrap around to zero when reaching one week (604800 seconds). * * The time-tagging mode should not change throughout a run. */ diff --git a/python/sbp/imu.py b/python/sbp/imu.py index a1f939ced9..f3751c247c 100644 --- a/python/sbp/imu.py +++ b/python/sbp/imu.py @@ -40,7 +40,7 @@ class MsgImuRaw(SBP): device hardware and settings, are communicated via the MSG_IMU_AUX message. If using "time since startup" time tags, the receiving end will expect a `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise IMU measurements -with GNSS. +with GNSS. The timestamp must wrap around to zero when reaching one week (604800 seconds). The time-tagging mode should not change throughout a run. diff --git a/python/sbp/jit/imu.py b/python/sbp/jit/imu.py index a030a69093..f81a46053e 100644 --- a/python/sbp/jit/imu.py +++ b/python/sbp/jit/imu.py @@ -42,7 +42,7 @@ class MsgImuRaw(SBP): device hardware and settings, are communicated via the MSG_IMU_AUX message. If using "time since startup" time tags, the receiving end will expect a `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise IMU measurements -with GNSS. +with GNSS. The timestamp must wrap around to zero when reaching one week (604800 seconds). The time-tagging mode should not change throughout a run. diff --git a/rust/sbp/src/messages/imu.rs b/rust/sbp/src/messages/imu.rs index 910c31e372..6a57860712 100644 --- a/rust/sbp/src/messages/imu.rs +++ b/rust/sbp/src/messages/imu.rs @@ -97,7 +97,7 @@ impl crate::serialize::SbpSerialize for MsgImuAux { /// device hardware and settings, are communicated via the MSG_IMU_AUX message. /// If using "time since startup" time tags, the receiving end will expect a /// `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise IMU measurements -/// with GNSS. +/// with GNSS. The timestamp must wrap around to zero when reaching one week (604800 seconds). /// /// The time-tagging mode should not change throughout a run. /// diff --git a/rust/sbp/tests/auto_check_sbp_acquisition_39.rs b/rust/sbp/tests/auto_check_sbp_acquisition_39.rs new file mode 100644 index 0000000000..ec15322efa --- /dev/null +++ b/rust/sbp/tests/auto_check_sbp_acquisition_39.rs @@ -0,0 +1,330 @@ +// +// Copyright (C) 2019 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. + +// This file was auto-generated from spec/tests/yaml/swiftnav/sbp/test_acquisition.yaml by generate.py. Do not modify by hand! + +extern crate sbp; +use sbp::messages::SBPMessage; + +mod common; +#[allow(unused_imports)] +use common::AlmostEq; + +#[test] +fn test_auto_check_sbp_acquisition_39() { + { + let payload: Vec = vec![ + 85, 21, 0, 195, 4, 13, 0, 0, 104, 65, 0, 192, 53, 68, 198, 199, 0, 70, 8, 2, 68, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgAcqResultDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x15, + "Incorrect message type, expected 0x15, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert!( + msg.cf.almost_eq(8.24194335937500000e+03), + "incorrect value for cf, expected 8.24194335937500000e+03, is {:e}", + msg.cf + ); + assert!( + msg.cp.almost_eq(7.27000000000000000e+02), + "incorrect value for cp, expected 7.27000000000000000e+02, is {:e}", + msg.cp + ); + assert_eq!( + msg.prn, 8, + "incorrect value for prn, expected 8, is {}", + msg.prn + ); + assert!( + msg.snr.almost_eq(1.45000000000000000e+01), + "incorrect value for snr, expected 1.45000000000000000e+01, is {:e}", + msg.snr + ); + } + _ => panic!("Invalid message type! Expected a MsgAcqResultDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 21, 0, 195, 4, 13, 205, 204, 116, 65, 0, 192, 179, 67, 33, 81, 59, 68, 9, 219, 27, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgAcqResultDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x15, + "Incorrect message type, expected 0x15, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert!( + msg.cf.almost_eq(7.49267639160156250e+02), + "incorrect value for cf, expected 7.49267639160156250e+02, is {:e}", + msg.cf + ); + assert!( + msg.cp.almost_eq(3.59500000000000000e+02), + "incorrect value for cp, expected 3.59500000000000000e+02, is {:e}", + msg.cp + ); + assert_eq!( + msg.prn, 9, + "incorrect value for prn, expected 9, is {}", + msg.prn + ); + assert!( + msg.snr.almost_eq(1.53000001907348633e+01), + "incorrect value for snr, expected 1.53000001907348633e+01, is {:e}", + msg.snr + ); + } + _ => panic!("Invalid message type! Expected a MsgAcqResultDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 21, 0, 195, 4, 13, 205, 204, 144, 65, 0, 0, 34, 66, 57, 237, 202, 197, 11, 150, 35, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgAcqResultDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x15, + "Incorrect message type, expected 0x15, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert!( + msg.cf.almost_eq(-6.49365283203125000e+03), + "incorrect value for cf, expected -6.49365283203125000e+03, is {:e}", + msg.cf + ); + assert!( + msg.cp.almost_eq(4.05000000000000000e+01), + "incorrect value for cp, expected 4.05000000000000000e+01, is {:e}", + msg.cp + ); + assert_eq!( + msg.prn, 11, + "incorrect value for prn, expected 11, is {}", + msg.prn + ); + assert!( + msg.snr.almost_eq(1.81000003814697266e+01), + "incorrect value for snr, expected 1.81000003814697266e+01, is {:e}", + msg.snr + ); + } + _ => panic!("Invalid message type! Expected a MsgAcqResultDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 21, 0, 195, 4, 13, 205, 204, 116, 65, 0, 32, 9, 68, 129, 193, 121, 196, 12, 146, + 118, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgAcqResultDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x15, + "Incorrect message type, expected 0x15, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert!( + msg.cf.almost_eq(-9.99023498535156250e+02), + "incorrect value for cf, expected -9.99023498535156250e+02, is {:e}", + msg.cf + ); + assert!( + msg.cp.almost_eq(5.48500000000000000e+02), + "incorrect value for cp, expected 5.48500000000000000e+02, is {:e}", + msg.cp + ); + assert_eq!( + msg.prn, 12, + "incorrect value for prn, expected 12, is {}", + msg.prn + ); + assert!( + msg.snr.almost_eq(1.53000001907348633e+01), + "incorrect value for snr, expected 1.53000001907348633e+01, is {:e}", + msg.snr + ); + } + _ => panic!("Invalid message type! Expected a MsgAcqResultDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 21, 0, 195, 4, 13, 205, 204, 116, 65, 0, 32, 67, 68, 228, 74, 148, 69, 14, 23, 75, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgAcqResultDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x15, + "Incorrect message type, expected 0x15, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert!( + msg.cf.almost_eq(4.74536132812500000e+03), + "incorrect value for cf, expected 4.74536132812500000e+03, is {:e}", + msg.cf + ); + assert!( + msg.cp.almost_eq(7.80500000000000000e+02), + "incorrect value for cp, expected 7.80500000000000000e+02, is {:e}", + msg.cp + ); + assert_eq!( + msg.prn, 14, + "incorrect value for prn, expected 14, is {}", + msg.prn + ); + assert!( + msg.snr.almost_eq(1.53000001907348633e+01), + "incorrect value for snr, expected 1.53000001907348633e+01, is {:e}", + msg.snr + ); + } + _ => panic!("Invalid message type! Expected a MsgAcqResultDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 21, 0, 195, 4, 13, 228, 56, 35, 67, 0, 32, 18, 68, 129, 193, 249, 195, 0, 204, 207, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgAcqResultDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x15, + "Incorrect message type, expected 0x15, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert!( + msg.cf.almost_eq(-4.99511749267578125e+02), + "incorrect value for cf, expected -4.99511749267578125e+02, is {:e}", + msg.cf + ); + assert!( + msg.cp.almost_eq(5.84500000000000000e+02), + "incorrect value for cp, expected 5.84500000000000000e+02, is {:e}", + msg.cp + ); + assert_eq!( + msg.prn, 0, + "incorrect value for prn, expected 0, is {}", + msg.prn + ); + assert!( + msg.snr.almost_eq(1.63222229003906250e+02), + "incorrect value for snr, expected 1.63222229003906250e+02, is {:e}", + msg.snr + ); + } + _ => panic!("Invalid message type! Expected a MsgAcqResultDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } +} diff --git a/rust/sbp/tests/auto_check_sbp_bootload_40.rs b/rust/sbp/tests/auto_check_sbp_bootload_40.rs new file mode 100644 index 0000000000..baa4f19866 --- /dev/null +++ b/rust/sbp/tests/auto_check_sbp_bootload_40.rs @@ -0,0 +1,117 @@ +// +// Copyright (C) 2019 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. + +// This file was auto-generated from spec/tests/yaml/swiftnav/sbp/test_bootload.yaml by generate.py. Do not modify by hand! + +extern crate sbp; +use sbp::messages::SBPMessage; + +mod common; +#[allow(unused_imports)] +use common::AlmostEq; + +#[test] +fn test_auto_check_sbp_bootload_40() { + { + let payload: Vec = vec![85, 180, 0, 0, 0, 9, 0, 0, 0, 0, 118, 49, 46, 50, 10, 201, 1]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgBootloaderHandshakeResp(msg) => { + assert_eq!( + msg.get_message_type(), + 0xb4, + "Incorrect message type, expected 0xb4, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x0, + "incorrect sender id, expected 0x0, is {}", + sender_id + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + Into::::into(msg.version.clone()), + "v1.2 +" + .to_string(), + "incorrect value for msg.version, expected string '{}', is '{}'", + "v1.2 +" + .to_string(), + msg.version + ); + } + _ => panic!("Invalid message type! Expected a MsgBootloaderHandshakeResp"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![85, 176, 0, 195, 4, 4, 118, 49, 46, 50, 1, 206]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgBootloaderHandshakeDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0xb0, + "Incorrect message type, expected 0xb0, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.handshake[0], 118, + "incorrect value for handshake[0], expected 118, is {}", + msg.handshake[0] + ); + assert_eq!( + msg.handshake[1], 49, + "incorrect value for handshake[1], expected 49, is {}", + msg.handshake[1] + ); + assert_eq!( + msg.handshake[2], 46, + "incorrect value for handshake[2], expected 46, is {}", + msg.handshake[2] + ); + assert_eq!( + msg.handshake[3], 50, + "incorrect value for handshake[3], expected 50, is {}", + msg.handshake[3] + ); + } + _ => panic!("Invalid message type! Expected a MsgBootloaderHandshakeDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } +} diff --git a/rust/sbp/tests/auto_check_sbp_ext_events_41.rs b/rust/sbp/tests/auto_check_sbp_ext_events_41.rs new file mode 100644 index 0000000000..4a6b97bf9f --- /dev/null +++ b/rust/sbp/tests/auto_check_sbp_ext_events_41.rs @@ -0,0 +1,79 @@ +// +// Copyright (C) 2019 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. + +// This file was auto-generated from spec/tests/yaml/swiftnav/sbp/test_ext_events.yaml by generate.py. Do not modify by hand! + +extern crate sbp; +use sbp::messages::SBPMessage; + +mod common; +#[allow(unused_imports)] +use common::AlmostEq; + +#[test] +fn test_auto_check_sbp_ext_events_41() { + { + let payload: Vec = vec![ + 85, 1, 1, 245, 6, 12, 48, 7, 199, 216, 49, 15, 202, 65, 15, 0, 3, 0, 62, 204, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgExtEvent(msg) => { + assert_eq!( + msg.get_message_type(), + 0x101, + "Incorrect message type, expected 0x101, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x6f5, + "incorrect sender id, expected 0x6f5, is {}", + sender_id + ); + assert_eq!( + msg.flags, 3, + "incorrect value for flags, expected 3, is {}", + msg.flags + ); + assert_eq!( + msg.ns_residual, 999882, + "incorrect value for ns_residual, expected 999882, is {}", + msg.ns_residual + ); + assert_eq!( + msg.pin, 0, + "incorrect value for pin, expected 0, is {}", + msg.pin + ); + assert_eq!( + msg.tow, 254924999, + "incorrect value for tow, expected 254924999, is {}", + msg.tow + ); + assert_eq!( + msg.wn, 1840, + "incorrect value for wn, expected 1840, is {}", + msg.wn + ); + } + _ => panic!("Invalid message type! Expected a MsgExtEvent"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } +} diff --git a/rust/sbp/tests/auto_check_sbp_logging_43.rs b/rust/sbp/tests/auto_check_sbp_logging_43.rs new file mode 100644 index 0000000000..3132aa8684 --- /dev/null +++ b/rust/sbp/tests/auto_check_sbp_logging_43.rs @@ -0,0 +1,72 @@ +// +// Copyright (C) 2019 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. + +// This file was auto-generated from spec/tests/yaml/swiftnav/sbp/test_msgFwd.yaml by generate.py. Do not modify by hand! + +extern crate sbp; +use sbp::messages::SBPMessage; + +mod common; +#[allow(unused_imports)] +use common::AlmostEq; + +#[test] +fn test_auto_check_sbp_logging_43() { + { + let payload: Vec = vec![ + 85, 2, 4, 66, 0, 18, 0, 0, 86, 81, 68, 47, 81, 103, 65, 69, 65, 65, 65, 65, 65, 69, 97, + 103, 125, 95, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgFwd(msg) => { + assert_eq!( + msg.get_message_type(), + 0x402, + "Incorrect message type, expected 0x402, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x42, + "incorrect sender id, expected 0x42, is {}", + sender_id + ); + assert_eq!( + Into::::into(msg.fwd_payload.clone()), + "VQD/QgAEAAAAAEag".to_string(), + "incorrect value for msg.fwd_payload, expected string '{}', is '{}'", + "VQD/QgAEAAAAAEag".to_string(), + msg.fwd_payload + ); + assert_eq!( + msg.protocol, 0, + "incorrect value for protocol, expected 0, is {}", + msg.protocol + ); + assert_eq!( + msg.source, 0, + "incorrect value for source, expected 0, is {}", + msg.source + ); + } + _ => panic!("Invalid message type! Expected a MsgFwd"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } +} diff --git a/rust/sbp/tests/auto_check_sbp_navigation_44.rs b/rust/sbp/tests/auto_check_sbp_navigation_44.rs new file mode 100644 index 0000000000..a16aba94e6 --- /dev/null +++ b/rust/sbp/tests/auto_check_sbp_navigation_44.rs @@ -0,0 +1,3173 @@ +// +// Copyright (C) 2019 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. + +// This file was auto-generated from spec/tests/yaml/swiftnav/sbp/test_navigation.yaml by generate.py. Do not modify by hand! + +extern crate sbp; +use sbp::messages::SBPMessage; + +mod common; +#[allow(unused_imports)] +use common::AlmostEq; + +#[test] +fn test_auto_check_sbp_navigation_44() { + { + let payload: Vec = vec![ + 85, 0, 1, 195, 4, 11, 46, 7, 212, 157, 67, 24, 111, 147, 252, 255, 0, 215, 190, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgGPSTimeDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x100, + "Incorrect message type, expected 0x100, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.ns_residual, -224401, + "incorrect value for ns_residual, expected -224401, is {}", + msg.ns_residual + ); + assert_eq!( + msg.tow, 407084500, + "incorrect value for tow, expected 407084500, is {}", + msg.tow + ); + assert_eq!( + msg.wn, 1838, + "incorrect value for wn, expected 1838, is {}", + msg.wn + ); + } + _ => panic!("Invalid message type! Expected a MsgGPSTimeDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 0, 1, 195, 4, 11, 46, 7, 56, 158, 67, 24, 109, 103, 3, 0, 0, 134, 89, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgGPSTimeDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x100, + "Incorrect message type, expected 0x100, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.ns_residual, 223085, + "incorrect value for ns_residual, expected 223085, is {}", + msg.ns_residual + ); + assert_eq!( + msg.tow, 407084600, + "incorrect value for tow, expected 407084600, is {}", + msg.tow + ); + assert_eq!( + msg.wn, 1838, + "incorrect value for wn, expected 1838, is {}", + msg.wn + ); + } + _ => panic!("Invalid message type! Expected a MsgGPSTimeDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 0, 1, 195, 4, 11, 46, 7, 156, 158, 67, 24, 233, 152, 252, 255, 0, 206, 241, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgGPSTimeDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x100, + "Incorrect message type, expected 0x100, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.ns_residual, -222999, + "incorrect value for ns_residual, expected -222999, is {}", + msg.ns_residual + ); + assert_eq!( + msg.tow, 407084700, + "incorrect value for tow, expected 407084700, is {}", + msg.tow + ); + assert_eq!( + msg.wn, 1838, + "incorrect value for wn, expected 1838, is {}", + msg.wn + ); + } + _ => panic!("Invalid message type! Expected a MsgGPSTimeDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 0, 1, 195, 4, 11, 46, 7, 0, 159, 67, 24, 240, 154, 3, 0, 0, 147, 98, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgGPSTimeDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x100, + "Incorrect message type, expected 0x100, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.ns_residual, 236272, + "incorrect value for ns_residual, expected 236272, is {}", + msg.ns_residual + ); + assert_eq!( + msg.tow, 407084800, + "incorrect value for tow, expected 407084800, is {}", + msg.tow + ); + assert_eq!( + msg.wn, 1838, + "incorrect value for wn, expected 1838, is {}", + msg.wn + ); + } + _ => panic!("Invalid message type! Expected a MsgGPSTimeDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 0, 1, 195, 4, 11, 46, 7, 100, 159, 67, 24, 144, 101, 252, 255, 0, 186, 152, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgGPSTimeDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x100, + "Incorrect message type, expected 0x100, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.ns_residual, -236144, + "incorrect value for ns_residual, expected -236144, is {}", + msg.ns_residual + ); + assert_eq!( + msg.tow, 407084900, + "incorrect value for tow, expected 407084900, is {}", + msg.tow + ); + assert_eq!( + msg.wn, 1838, + "incorrect value for wn, expected 1838, is {}", + msg.wn + ); + } + _ => panic!("Invalid message type! Expected a MsgGPSTimeDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 0, 1, 195, 4, 11, 46, 7, 46, 162, 68, 24, 205, 230, 250, 255, 0, 11, 225, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgGPSTimeDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x100, + "Incorrect message type, expected 0x100, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.ns_residual, -334131, + "incorrect value for ns_residual, expected -334131, is {}", + msg.ns_residual + ); + assert_eq!( + msg.tow, 407151150, + "incorrect value for tow, expected 407151150, is {}", + msg.tow + ); + assert_eq!( + msg.wn, 1838, + "incorrect value for wn, expected 1838, is {}", + msg.wn + ); + } + _ => panic!("Invalid message type! Expected a MsgGPSTimeDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 0, 2, 195, 4, 32, 212, 157, 67, 24, 153, 222, 105, 1, 252, 161, 68, 193, 254, 247, + 52, 112, 74, 67, 80, 193, 164, 207, 47, 146, 44, 163, 77, 65, 0, 0, 8, 0, 145, 4, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgPosECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x200, + "Incorrect message type, expected 0x200, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084500, + "incorrect value for tow, expected 407084500, is {}", + msg.tow + ); + assert!( + msg.x.almost_eq(-2.70437601104338141e+06), + "incorrect value for x, expected -2.70437601104338141e+06, is {:e}", + msg.x + ); + assert!( + msg.y.almost_eq(-4.26320975323295407e+06), + "incorrect value for y, expected -4.26320975323295407e+06, is {:e}", + msg.y + ); + assert!( + msg.z.almost_eq(3.88463314208407886e+06), + "incorrect value for z, expected 3.88463314208407886e+06, is {:e}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgPosECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 0, 2, 195, 4, 32, 56, 158, 67, 24, 215, 184, 223, 246, 251, 161, 68, 193, 36, 126, + 17, 39, 74, 67, 80, 193, 19, 179, 70, 80, 44, 163, 77, 65, 0, 0, 8, 0, 245, 66, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgPosECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x200, + "Incorrect message type, expected 0x200, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084600, + "incorrect value for tow, expected 407084600, is {}", + msg.tow + ); + assert!( + msg.x.almost_eq(-2.70437592870245455e+06), + "incorrect value for x, expected -2.70437592870245455e+06, is {:e}", + msg.x + ); + assert!( + msg.y.almost_eq(-4.26320861044267192e+06), + "incorrect value for y, expected -4.26320861044267192e+06, is {:e}", + msg.y + ); + assert!( + msg.z.almost_eq(3.88463262715757778e+06), + "incorrect value for z, expected 3.88463262715757778e+06, is {:e}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgPosECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 0, 2, 195, 4, 32, 156, 158, 67, 24, 73, 74, 214, 148, 251, 161, 68, 193, 213, 151, + 184, 215, 73, 67, 80, 193, 110, 99, 38, 164, 43, 163, 77, 65, 0, 0, 8, 0, 5, 223, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgPosECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x200, + "Incorrect message type, expected 0x200, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084700, + "incorrect value for tow, expected 407084700, is {}", + msg.tow + ); + assert!( + msg.x.almost_eq(-2.70437516278961720e+06), + "incorrect value for x, expected -2.70437516278961720e+06, is {:e}", + msg.x + ); + assert!( + msg.y.almost_eq(-4.26320737064166833e+06), + "incorrect value for y, expected -4.26320737064166833e+06, is {:e}", + msg.y + ); + assert!( + msg.z.almost_eq(3.88463128242152091e+06), + "incorrect value for z, expected 3.88463128242152091e+06, is {:e}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgPosECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 0, 2, 195, 4, 32, 0, 159, 67, 24, 177, 111, 112, 45, 252, 161, 68, 193, 213, 168, + 198, 253, 73, 67, 80, 193, 245, 12, 228, 12, 44, 163, 77, 65, 0, 0, 8, 0, 143, 212, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgPosECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x200, + "Incorrect message type, expected 0x200, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084800, + "incorrect value for tow, expected 407084800, is {}", + msg.tow + ); + assert!( + msg.x.almost_eq(-2.70437635499378340e+06), + "incorrect value for x, expected -2.70437635499378340e+06, is {:e}", + msg.x + ); + assert!( + msg.y.almost_eq(-4.26320796525021363e+06), + "incorrect value for y, expected -4.26320796525021363e+06, is {:e}", + msg.y + ); + assert!( + msg.z.almost_eq(3.88463210070955241e+06), + "incorrect value for z, expected 3.88463210070955241e+06, is {:e}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgPosECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 0, 2, 195, 4, 32, 100, 159, 67, 24, 67, 231, 72, 165, 251, 161, 68, 193, 150, 210, + 36, 212, 73, 67, 80, 193, 234, 33, 25, 189, 43, 163, 77, 65, 0, 0, 8, 0, 70, 221, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgPosECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x200, + "Incorrect message type, expected 0x200, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084900, + "incorrect value for tow, expected 407084900, is {}", + msg.tow + ); + assert!( + msg.x.almost_eq(-2.70437529128733417e+06), + "incorrect value for x, expected -2.70437529128733417e+06, is {:e}", + msg.x + ); + assert!( + msg.y.almost_eq(-4.26320731474747322e+06), + "incorrect value for y, expected -4.26320731474747322e+06, is {:e}", + msg.y + ); + assert!( + msg.z.almost_eq(3.88463147732948232e+06), + "incorrect value for z, expected 3.88463147732948232e+06, is {:e}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgPosECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 0, 2, 195, 4, 32, 46, 162, 68, 24, 224, 72, 131, 215, 251, 161, 68, 193, 180, 123, + 222, 94, 74, 67, 80, 193, 191, 3, 131, 193, 45, 163, 77, 65, 0, 0, 5, 0, 17, 221, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgPosECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x200, + "Incorrect message type, expected 0x200, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 5, + "incorrect value for n_sats, expected 5, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407151150, + "incorrect value for tow, expected 407151150, is {}", + msg.tow + ); + assert!( + msg.x.almost_eq(-2.70437568369399011e+06), + "incorrect value for x, expected -2.70437568369399011e+06, is {:e}", + msg.x + ); + assert!( + msg.y.almost_eq(-4.26320948232929781e+06), + "incorrect value for y, expected -4.26320948232929781e+06, is {:e}", + msg.y + ); + assert!( + msg.z.almost_eq(3.88463551181074930e+06), + "incorrect value for z, expected 3.88463551181074930e+06, is {:e}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgPosECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 2, 2, 195, 4, 20, 156, 21, 69, 24, 169, 231, 255, 255, 102, 208, 255, 255, 251, 28, + 0, 0, 0, 0, 6, 0, 146, 168, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgBaselineECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x202, + "Incorrect message type, expected 0x202, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 6, + "incorrect value for n_sats, expected 6, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407180700, + "incorrect value for tow, expected 407180700, is {}", + msg.tow + ); + assert_eq!( + msg.x, -6231, + "incorrect value for x, expected -6231, is {}", + msg.x + ); + assert_eq!( + msg.y, -12186, + "incorrect value for y, expected -12186, is {}", + msg.y + ); + assert_eq!( + msg.z, 7419, + "incorrect value for z, expected 7419, is {}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgBaselineECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 2, 2, 195, 4, 20, 0, 22, 69, 24, 169, 231, 255, 255, 103, 208, 255, 255, 252, 28, + 0, 0, 0, 0, 6, 0, 34, 116, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgBaselineECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x202, + "Incorrect message type, expected 0x202, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 6, + "incorrect value for n_sats, expected 6, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407180800, + "incorrect value for tow, expected 407180800, is {}", + msg.tow + ); + assert_eq!( + msg.x, -6231, + "incorrect value for x, expected -6231, is {}", + msg.x + ); + assert_eq!( + msg.y, -12185, + "incorrect value for y, expected -12185, is {}", + msg.y + ); + assert_eq!( + msg.z, 7420, + "incorrect value for z, expected 7420, is {}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgBaselineECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 2, 2, 195, 4, 20, 100, 22, 69, 24, 30, 224, 255, 255, 192, 183, 255, 255, 239, 53, + 0, 0, 0, 0, 6, 0, 225, 15, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgBaselineECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x202, + "Incorrect message type, expected 0x202, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 6, + "incorrect value for n_sats, expected 6, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407180900, + "incorrect value for tow, expected 407180900, is {}", + msg.tow + ); + assert_eq!( + msg.x, -8162, + "incorrect value for x, expected -8162, is {}", + msg.x + ); + assert_eq!( + msg.y, -18496, + "incorrect value for y, expected -18496, is {}", + msg.y + ); + assert_eq!( + msg.z, 13807, + "incorrect value for z, expected 13807, is {}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgBaselineECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 2, 2, 195, 4, 20, 200, 22, 69, 24, 28, 224, 255, 255, 191, 183, 255, 255, 242, 53, + 0, 0, 0, 0, 6, 0, 35, 100, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgBaselineECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x202, + "Incorrect message type, expected 0x202, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 6, + "incorrect value for n_sats, expected 6, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407181000, + "incorrect value for tow, expected 407181000, is {}", + msg.tow + ); + assert_eq!( + msg.x, -8164, + "incorrect value for x, expected -8164, is {}", + msg.x + ); + assert_eq!( + msg.y, -18497, + "incorrect value for y, expected -18497, is {}", + msg.y + ); + assert_eq!( + msg.z, 13810, + "incorrect value for z, expected 13810, is {}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgBaselineECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 2, 2, 195, 4, 20, 44, 23, 69, 24, 24, 227, 255, 255, 25, 195, 255, 255, 153, 59, 0, + 0, 0, 0, 6, 0, 66, 66, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgBaselineECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x202, + "Incorrect message type, expected 0x202, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 6, + "incorrect value for n_sats, expected 6, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407181100, + "incorrect value for tow, expected 407181100, is {}", + msg.tow + ); + assert_eq!( + msg.x, -7400, + "incorrect value for x, expected -7400, is {}", + msg.x + ); + assert_eq!( + msg.y, -15591, + "incorrect value for y, expected -15591, is {}", + msg.y + ); + assert_eq!( + msg.z, 15257, + "incorrect value for z, expected 15257, is {}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgBaselineECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 2, 2, 195, 4, 20, 144, 23, 69, 24, 23, 227, 255, 255, 25, 195, 255, 255, 153, 59, + 0, 0, 0, 0, 6, 0, 35, 135, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgBaselineECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x202, + "Incorrect message type, expected 0x202, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 6, + "incorrect value for n_sats, expected 6, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407181200, + "incorrect value for tow, expected 407181200, is {}", + msg.tow + ); + assert_eq!( + msg.x, -7401, + "incorrect value for x, expected -7401, is {}", + msg.x + ); + assert_eq!( + msg.y, -15591, + "incorrect value for y, expected -15591, is {}", + msg.y + ); + assert_eq!( + msg.z, 15257, + "incorrect value for z, expected 15257, is {}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgBaselineECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 3, 2, 195, 4, 22, 156, 21, 69, 24, 130, 246, 255, 255, 241, 4, 0, 0, 35, 196, 255, + 255, 0, 0, 0, 0, 6, 0, 250, 21, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgBaselineNEDDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x203, + "Incorrect message type, expected 0x203, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.d, -15325, + "incorrect value for d, expected -15325, is {}", + msg.d + ); + assert_eq!( + msg.e, 1265, + "incorrect value for e, expected 1265, is {}", + msg.e + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert_eq!( + msg.n, -2430, + "incorrect value for n, expected -2430, is {}", + msg.n + ); + assert_eq!( + msg.n_sats, 6, + "incorrect value for n_sats, expected 6, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407180700, + "incorrect value for tow, expected 407180700, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgBaselineNEDDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 3, 2, 195, 4, 22, 0, 22, 69, 24, 130, 246, 255, 255, 241, 4, 0, 0, 35, 196, 255, + 255, 0, 0, 0, 0, 6, 0, 240, 133, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgBaselineNEDDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x203, + "Incorrect message type, expected 0x203, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.d, -15325, + "incorrect value for d, expected -15325, is {}", + msg.d + ); + assert_eq!( + msg.e, 1265, + "incorrect value for e, expected 1265, is {}", + msg.e + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert_eq!( + msg.n, -2430, + "incorrect value for n, expected -2430, is {}", + msg.n + ); + assert_eq!( + msg.n_sats, 6, + "incorrect value for n_sats, expected 6, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407180800, + "incorrect value for tow, expected 407180800, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgBaselineNEDDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 3, 2, 195, 4, 22, 100, 22, 69, 24, 32, 251, 255, 255, 199, 11, 0, 0, 57, 161, 255, + 255, 0, 0, 0, 0, 6, 0, 12, 181, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgBaselineNEDDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x203, + "Incorrect message type, expected 0x203, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.d, -24263, + "incorrect value for d, expected -24263, is {}", + msg.d + ); + assert_eq!( + msg.e, 3015, + "incorrect value for e, expected 3015, is {}", + msg.e + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert_eq!( + msg.n, -1248, + "incorrect value for n, expected -1248, is {}", + msg.n + ); + assert_eq!( + msg.n_sats, 6, + "incorrect value for n_sats, expected 6, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407180900, + "incorrect value for tow, expected 407180900, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgBaselineNEDDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 3, 2, 195, 4, 22, 200, 22, 69, 24, 33, 251, 255, 255, 199, 11, 0, 0, 54, 161, 255, + 255, 0, 0, 0, 0, 6, 0, 86, 58, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgBaselineNEDDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x203, + "Incorrect message type, expected 0x203, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.d, -24266, + "incorrect value for d, expected -24266, is {}", + msg.d + ); + assert_eq!( + msg.e, 3015, + "incorrect value for e, expected 3015, is {}", + msg.e + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert_eq!( + msg.n, -1247, + "incorrect value for n, expected -1247, is {}", + msg.n + ); + assert_eq!( + msg.n_sats, 6, + "incorrect value for n_sats, expected 6, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407181000, + "incorrect value for tow, expected 407181000, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgBaselineNEDDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 3, 2, 195, 4, 22, 44, 23, 69, 24, 110, 6, 0, 0, 55, 8, 0, 0, 160, 166, 255, 255, 0, + 0, 0, 0, 6, 0, 51, 249, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgBaselineNEDDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x203, + "Incorrect message type, expected 0x203, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.d, -22880, + "incorrect value for d, expected -22880, is {}", + msg.d + ); + assert_eq!( + msg.e, 2103, + "incorrect value for e, expected 2103, is {}", + msg.e + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert_eq!( + msg.n, 1646, + "incorrect value for n, expected 1646, is {}", + msg.n + ); + assert_eq!( + msg.n_sats, 6, + "incorrect value for n_sats, expected 6, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407181100, + "incorrect value for tow, expected 407181100, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgBaselineNEDDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 3, 2, 195, 4, 22, 144, 23, 69, 24, 110, 6, 0, 0, 54, 8, 0, 0, 160, 166, 255, 255, + 0, 0, 0, 0, 6, 0, 206, 22, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgBaselineNEDDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x203, + "Incorrect message type, expected 0x203, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.d, -22880, + "incorrect value for d, expected -22880, is {}", + msg.d + ); + assert_eq!( + msg.e, 2102, + "incorrect value for e, expected 2102, is {}", + msg.e + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert_eq!( + msg.n, 1646, + "incorrect value for n, expected 1646, is {}", + msg.n + ); + assert_eq!( + msg.n_sats, 6, + "incorrect value for n_sats, expected 6, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407181200, + "incorrect value for tow, expected 407181200, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgBaselineNEDDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 4, 2, 195, 4, 20, 212, 157, 67, 24, 24, 0, 0, 0, 245, 255, 255, 255, 219, 255, 255, + 255, 0, 0, 8, 0, 68, 255, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgVelECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x204, + "Incorrect message type, expected 0x204, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084500, + "incorrect value for tow, expected 407084500, is {}", + msg.tow + ); + assert_eq!( + msg.x, 24, + "incorrect value for x, expected 24, is {}", + msg.x + ); + assert_eq!( + msg.y, -11, + "incorrect value for y, expected -11, is {}", + msg.y + ); + assert_eq!( + msg.z, -37, + "incorrect value for z, expected -37, is {}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgVelECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 4, 2, 195, 4, 20, 56, 158, 67, 24, 4, 0, 0, 0, 234, 255, 255, 255, 18, 0, 0, 0, 0, + 0, 8, 0, 214, 136, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgVelECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x204, + "Incorrect message type, expected 0x204, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084600, + "incorrect value for tow, expected 407084600, is {}", + msg.tow + ); + assert_eq!(msg.x, 4, "incorrect value for x, expected 4, is {}", msg.x); + assert_eq!( + msg.y, -22, + "incorrect value for y, expected -22, is {}", + msg.y + ); + assert_eq!( + msg.z, 18, + "incorrect value for z, expected 18, is {}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgVelECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 4, 2, 195, 4, 20, 156, 158, 67, 24, 230, 255, 255, 255, 4, 0, 0, 0, 1, 0, 0, 0, 0, + 0, 8, 0, 122, 159, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgVelECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x204, + "Incorrect message type, expected 0x204, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084700, + "incorrect value for tow, expected 407084700, is {}", + msg.tow + ); + assert_eq!( + msg.x, -26, + "incorrect value for x, expected -26, is {}", + msg.x + ); + assert_eq!(msg.y, 4, "incorrect value for y, expected 4, is {}", msg.y); + assert_eq!(msg.z, 1, "incorrect value for z, expected 1, is {}", msg.z); + } + _ => panic!("Invalid message type! Expected a MsgVelECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 4, 2, 195, 4, 20, 0, 159, 67, 24, 247, 255, 255, 255, 237, 255, 255, 255, 28, 0, 0, + 0, 0, 0, 8, 0, 232, 146, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgVelECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x204, + "Incorrect message type, expected 0x204, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084800, + "incorrect value for tow, expected 407084800, is {}", + msg.tow + ); + assert_eq!( + msg.x, -9, + "incorrect value for x, expected -9, is {}", + msg.x + ); + assert_eq!( + msg.y, -19, + "incorrect value for y, expected -19, is {}", + msg.y + ); + assert_eq!( + msg.z, 28, + "incorrect value for z, expected 28, is {}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgVelECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 4, 2, 195, 4, 20, 100, 159, 67, 24, 255, 255, 255, 255, 2, 0, 0, 0, 245, 255, 255, + 255, 0, 0, 8, 0, 171, 238, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgVelECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x204, + "Incorrect message type, expected 0x204, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084900, + "incorrect value for tow, expected 407084900, is {}", + msg.tow + ); + assert_eq!( + msg.x, -1, + "incorrect value for x, expected -1, is {}", + msg.x + ); + assert_eq!(msg.y, 2, "incorrect value for y, expected 2, is {}", msg.y); + assert_eq!( + msg.z, -11, + "incorrect value for z, expected -11, is {}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgVelECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 4, 2, 195, 4, 20, 46, 162, 68, 24, 207, 255, 255, 255, 185, 255, 255, 255, 65, 0, + 0, 0, 0, 0, 5, 0, 82, 154, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgVelECEFDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x204, + "Incorrect message type, expected 0x204, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.accuracy, 0, + "incorrect value for accuracy, expected 0, is {}", + msg.accuracy + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.n_sats, 5, + "incorrect value for n_sats, expected 5, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407151150, + "incorrect value for tow, expected 407151150, is {}", + msg.tow + ); + assert_eq!( + msg.x, -49, + "incorrect value for x, expected -49, is {}", + msg.x + ); + assert_eq!( + msg.y, -71, + "incorrect value for y, expected -71, is {}", + msg.y + ); + assert_eq!( + msg.z, 65, + "incorrect value for z, expected 65, is {}", + msg.z + ); + } + _ => panic!("Invalid message type! Expected a MsgVelECEFDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 5, 2, 195, 4, 22, 212, 157, 67, 24, 229, 255, 255, 255, 26, 0, 0, 0, 25, 0, 0, 0, + 0, 0, 0, 0, 8, 0, 132, 25, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgVelNEDDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x205, + "Incorrect message type, expected 0x205, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.d, 25, + "incorrect value for d, expected 25, is {}", + msg.d + ); + assert_eq!( + msg.e, 26, + "incorrect value for e, expected 26, is {}", + msg.e + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert_eq!( + msg.n, -27, + "incorrect value for n, expected -27, is {}", + msg.n + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084500, + "incorrect value for tow, expected 407084500, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgVelNEDDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 5, 2, 195, 4, 22, 56, 158, 67, 24, 4, 0, 0, 0, 15, 0, 0, 0, 232, 255, 255, 255, 0, + 0, 0, 0, 8, 0, 42, 14, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgVelNEDDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x205, + "Incorrect message type, expected 0x205, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.d, -24, + "incorrect value for d, expected -24, is {}", + msg.d + ); + assert_eq!( + msg.e, 15, + "incorrect value for e, expected 15, is {}", + msg.e + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert_eq!(msg.n, 4, "incorrect value for n, expected 4, is {}", msg.n); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084600, + "incorrect value for tow, expected 407084600, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgVelNEDDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 5, 2, 195, 4, 22, 156, 158, 67, 24, 251, 255, 255, 255, 232, 255, 255, 255, 247, + 255, 255, 255, 0, 0, 0, 0, 8, 0, 218, 148, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgVelNEDDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x205, + "Incorrect message type, expected 0x205, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.d, -9, + "incorrect value for d, expected -9, is {}", + msg.d + ); + assert_eq!( + msg.e, -24, + "incorrect value for e, expected -24, is {}", + msg.e + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert_eq!( + msg.n, -5, + "incorrect value for n, expected -5, is {}", + msg.n + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084700, + "incorrect value for tow, expected 407084700, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgVelNEDDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 5, 2, 195, 4, 22, 0, 159, 67, 24, 10, 0, 0, 0, 2, 0, 0, 0, 222, 255, 255, 255, 0, + 0, 0, 0, 8, 0, 148, 16, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgVelNEDDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x205, + "Incorrect message type, expected 0x205, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.d, -34, + "incorrect value for d, expected -34, is {}", + msg.d + ); + assert_eq!(msg.e, 2, "incorrect value for e, expected 2, is {}", msg.e); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert_eq!( + msg.n, 10, + "incorrect value for n, expected 10, is {}", + msg.n + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084800, + "incorrect value for tow, expected 407084800, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgVelNEDDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 5, 2, 195, 4, 22, 100, 159, 67, 24, 248, 255, 255, 255, 254, 255, 255, 255, 7, 0, + 0, 0, 0, 0, 0, 0, 8, 0, 255, 236, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgVelNEDDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x205, + "Incorrect message type, expected 0x205, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!(msg.d, 7, "incorrect value for d, expected 7, is {}", msg.d); + assert_eq!( + msg.e, -2, + "incorrect value for e, expected -2, is {}", + msg.e + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert_eq!( + msg.n, -8, + "incorrect value for n, expected -8, is {}", + msg.n + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084900, + "incorrect value for tow, expected 407084900, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgVelNEDDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 5, 2, 195, 4, 22, 46, 162, 68, 24, 255, 255, 255, 255, 253, 255, 255, 255, 148, + 255, 255, 255, 0, 0, 0, 0, 5, 0, 166, 189, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgVelNEDDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x205, + "Incorrect message type, expected 0x205, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.d, -108, + "incorrect value for d, expected -108, is {}", + msg.d + ); + assert_eq!( + msg.e, -3, + "incorrect value for e, expected -3, is {}", + msg.e + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert_eq!( + msg.n, -1, + "incorrect value for n, expected -1, is {}", + msg.n + ); + assert_eq!( + msg.n_sats, 5, + "incorrect value for n_sats, expected 5, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407151150, + "incorrect value for tow, expected 407151150, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgVelNEDDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 6, 2, 195, 4, 14, 212, 157, 67, 24, 247, 0, 215, 0, 123, 0, 17, 1, 44, 0, 206, 21, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgDopsDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x206, + "Incorrect message type, expected 0x206, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.gdop, 247, + "incorrect value for gdop, expected 247, is {}", + msg.gdop + ); + assert_eq!( + msg.hdop, 273, + "incorrect value for hdop, expected 273, is {}", + msg.hdop + ); + assert_eq!( + msg.pdop, 215, + "incorrect value for pdop, expected 215, is {}", + msg.pdop + ); + assert_eq!( + msg.tdop, 123, + "incorrect value for tdop, expected 123, is {}", + msg.tdop + ); + assert_eq!( + msg.tow, 407084500, + "incorrect value for tow, expected 407084500, is {}", + msg.tow + ); + assert_eq!( + msg.vdop, 44, + "incorrect value for vdop, expected 44, is {}", + msg.vdop + ); + } + _ => panic!("Invalid message type! Expected a MsgDopsDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 6, 2, 195, 4, 14, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 146, 12, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgDopsDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x206, + "Incorrect message type, expected 0x206, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.gdop, 65535, + "incorrect value for gdop, expected 65535, is {}", + msg.gdop + ); + assert_eq!( + msg.hdop, 0, + "incorrect value for hdop, expected 0, is {}", + msg.hdop + ); + assert_eq!( + msg.pdop, 65535, + "incorrect value for pdop, expected 65535, is {}", + msg.pdop + ); + assert_eq!( + msg.tdop, 0, + "incorrect value for tdop, expected 0, is {}", + msg.tdop + ); + assert_eq!( + msg.tow, 0, + "incorrect value for tow, expected 0, is {}", + msg.tow + ); + assert_eq!( + msg.vdop, 0, + "incorrect value for vdop, expected 0, is {}", + msg.vdop + ); + } + _ => panic!("Invalid message type! Expected a MsgDopsDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 6, 2, 195, 4, 14, 128, 165, 68, 24, 92, 1, 56, 1, 155, 0, 125, 2, 113, 0, 129, 93, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgDopsDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x206, + "Incorrect message type, expected 0x206, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.gdop, 348, + "incorrect value for gdop, expected 348, is {}", + msg.gdop + ); + assert_eq!( + msg.hdop, 637, + "incorrect value for hdop, expected 637, is {}", + msg.hdop + ); + assert_eq!( + msg.pdop, 312, + "incorrect value for pdop, expected 312, is {}", + msg.pdop + ); + assert_eq!( + msg.tdop, 155, + "incorrect value for tdop, expected 155, is {}", + msg.tdop + ); + assert_eq!( + msg.tow, 407152000, + "incorrect value for tow, expected 407152000, is {}", + msg.tow + ); + assert_eq!( + msg.vdop, 113, + "incorrect value for vdop, expected 113, is {}", + msg.vdop + ); + } + _ => panic!("Invalid message type! Expected a MsgDopsDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 6, 2, 195, 4, 14, 104, 169, 68, 24, 92, 1, 55, 1, 155, 0, 125, 2, 113, 0, 209, 128, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgDopsDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x206, + "Incorrect message type, expected 0x206, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.gdop, 348, + "incorrect value for gdop, expected 348, is {}", + msg.gdop + ); + assert_eq!( + msg.hdop, 637, + "incorrect value for hdop, expected 637, is {}", + msg.hdop + ); + assert_eq!( + msg.pdop, 311, + "incorrect value for pdop, expected 311, is {}", + msg.pdop + ); + assert_eq!( + msg.tdop, 155, + "incorrect value for tdop, expected 155, is {}", + msg.tdop + ); + assert_eq!( + msg.tow, 407153000, + "incorrect value for tow, expected 407153000, is {}", + msg.tow + ); + assert_eq!( + msg.vdop, 113, + "incorrect value for vdop, expected 113, is {}", + msg.vdop + ); + } + _ => panic!("Invalid message type! Expected a MsgDopsDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 6, 2, 195, 4, 14, 80, 173, 68, 24, 92, 1, 55, 1, 155, 0, 125, 2, 112, 0, 30, 6, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgDopsDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x206, + "Incorrect message type, expected 0x206, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.gdop, 348, + "incorrect value for gdop, expected 348, is {}", + msg.gdop + ); + assert_eq!( + msg.hdop, 637, + "incorrect value for hdop, expected 637, is {}", + msg.hdop + ); + assert_eq!( + msg.pdop, 311, + "incorrect value for pdop, expected 311, is {}", + msg.pdop + ); + assert_eq!( + msg.tdop, 155, + "incorrect value for tdop, expected 155, is {}", + msg.tdop + ); + assert_eq!( + msg.tow, 407154000, + "incorrect value for tow, expected 407154000, is {}", + msg.tow + ); + assert_eq!( + msg.vdop, 112, + "incorrect value for vdop, expected 112, is {}", + msg.vdop + ); + } + _ => panic!("Invalid message type! Expected a MsgDopsDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 6, 2, 195, 4, 14, 56, 177, 68, 24, 92, 1, 55, 1, 155, 0, 125, 2, 112, 0, 70, 67, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgDopsDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x206, + "Incorrect message type, expected 0x206, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.gdop, 348, + "incorrect value for gdop, expected 348, is {}", + msg.gdop + ); + assert_eq!( + msg.hdop, 637, + "incorrect value for hdop, expected 637, is {}", + msg.hdop + ); + assert_eq!( + msg.pdop, 311, + "incorrect value for pdop, expected 311, is {}", + msg.pdop + ); + assert_eq!( + msg.tdop, 155, + "incorrect value for tdop, expected 155, is {}", + msg.tdop + ); + assert_eq!( + msg.tow, 407155000, + "incorrect value for tow, expected 407155000, is {}", + msg.tow + ); + assert_eq!( + msg.vdop, 112, + "incorrect value for vdop, expected 112, is {}", + msg.vdop + ); + } + _ => panic!("Invalid message type! Expected a MsgDopsDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 1, 2, 195, 4, 34, 212, 157, 67, 24, 8, 23, 228, 8, 151, 225, 66, 64, 156, 174, 42, + 194, 230, 152, 94, 192, 153, 23, 72, 47, 196, 40, 16, 64, 0, 0, 0, 0, 8, 0, 237, 169, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgPosLLHDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x201, + "Incorrect message type, expected 0x201, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert!( + msg.height.almost_eq(4.03981088521495568e+00), + "incorrect value for height, expected 4.03981088521495568e+00, is {:e}", + msg.height + ); + assert!( + msg.lat.almost_eq(3.77624217141838585e+01), + "incorrect value for lat, expected 3.77624217141838585e+01, is {:e}", + msg.lat + ); + assert!( + msg.lon.almost_eq(-1.22389084378892619e+02), + "incorrect value for lon, expected -1.22389084378892619e+02, is {:e}", + msg.lon + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084500, + "incorrect value for tow, expected 407084500, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgPosLLHDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 1, 2, 195, 4, 34, 56, 158, 67, 24, 220, 109, 212, 24, 151, 225, 66, 64, 159, 231, + 254, 219, 230, 152, 94, 192, 128, 151, 67, 19, 233, 105, 7, 64, 0, 0, 0, 0, 8, 0, 152, + 11, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgPosLLHDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x201, + "Incorrect message type, expected 0x201, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert!( + msg.height.almost_eq(2.92671408700965685e+00), + "incorrect value for height, expected 2.92671408700965685e+00, is {:e}", + msg.height + ); + assert!( + msg.lat.almost_eq(3.77624236142398502e+01), + "incorrect value for lat, expected 3.77624236142398502e+01, is {:e}", + msg.lat + ); + assert!( + msg.lon.almost_eq(-1.22389090537004890e+02), + "incorrect value for lon, expected -1.22389090537004890e+02, is {:e}", + msg.lon + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084600, + "incorrect value for tow, expected 407084600, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgPosLLHDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 1, 2, 195, 4, 34, 156, 158, 67, 24, 13, 91, 237, 11, 151, 225, 66, 64, 75, 113, + 210, 220, 230, 152, 94, 192, 37, 6, 145, 188, 89, 112, 238, 63, 0, 0, 0, 0, 8, 0, 221, + 155, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgPosLLHDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x201, + "Incorrect message type, expected 0x201, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert!( + msg.height.almost_eq(9.51214664739556626e-01), + "incorrect value for height, expected 9.51214664739556626e-01, is {:e}", + msg.height + ); + assert!( + msg.lat.almost_eq(3.77624220761264056e+01), + "incorrect value for lat, expected 3.77624220761264056e+01, is {:e}", + msg.lat + ); + assert!( + msg.lon.almost_eq(-1.22389090734014800e+02), + "incorrect value for lon, expected -1.22389090734014800e+02, is {:e}", + msg.lon + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084700, + "incorrect value for tow, expected 407084700, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgPosLLHDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 1, 2, 195, 4, 34, 0, 159, 67, 24, 51, 183, 5, 8, 151, 225, 66, 64, 13, 226, 148, + 253, 230, 152, 94, 192, 187, 27, 11, 32, 69, 213, 2, 64, 0, 0, 0, 0, 8, 0, 82, 94, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgPosLLHDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x201, + "Incorrect message type, expected 0x201, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert!( + msg.height.almost_eq(2.35413575204753789e+00), + "incorrect value for height, expected 2.35413575204753789e+00, is {:e}", + msg.height + ); + assert!( + msg.lat.almost_eq(3.77624216106327353e+01), + "incorrect value for lat, expected 3.77624216106327353e+01, is {:e}", + msg.lat + ); + assert!( + msg.lon.almost_eq(-1.22389098544496122e+02), + "incorrect value for lon, expected -1.22389098544496122e+02, is {:e}", + msg.lon + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084800, + "incorrect value for tow, expected 407084800, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgPosLLHDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 1, 2, 195, 4, 34, 100, 159, 67, 24, 22, 77, 146, 22, 151, 225, 66, 64, 64, 134, + 105, 227, 230, 152, 94, 192, 37, 99, 114, 72, 31, 103, 241, 63, 0, 0, 0, 0, 8, 0, 70, + 60, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgPosLLHDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x201, + "Incorrect message type, expected 0x201, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert!( + msg.height.almost_eq(1.08767631816426413e+00), + "incorrect value for height, expected 1.08767631816426413e+00, is {:e}", + msg.height + ); + assert!( + msg.lat.almost_eq(3.77624233450280116e+01), + "incorrect value for lat, expected 3.77624233450280116e+01, is {:e}", + msg.lat + ); + assert!( + msg.lon.almost_eq(-1.22389092305232225e+02), + "incorrect value for lon, expected -1.22389092305232225e+02, is {:e}", + msg.lon + ); + assert_eq!( + msg.n_sats, 8, + "incorrect value for n_sats, expected 8, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407084900, + "incorrect value for tow, expected 407084900, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgPosLLHDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 1, 2, 195, 4, 34, 46, 162, 68, 24, 124, 245, 46, 169, 151, 225, 66, 64, 135, 149, + 234, 187, 230, 152, 94, 192, 194, 201, 115, 145, 166, 175, 20, 64, 0, 0, 0, 0, 5, 0, + 212, 121, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgPosLLHDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x201, + "Incorrect message type, expected 0x201, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + assert_eq!( + msg.h_accuracy, 0, + "incorrect value for h_accuracy, expected 0, is {}", + msg.h_accuracy + ); + assert!( + msg.height.almost_eq(5.17153384465422228e+00), + "incorrect value for height, expected 5.17153384465422228e+00, is {:e}", + msg.height + ); + assert!( + msg.lat.almost_eq(3.77624408225337618e+01), + "incorrect value for lat, expected 3.77624408225337618e+01, is {:e}", + msg.lat + ); + assert!( + msg.lon.almost_eq(-1.22389082888685252e+02), + "incorrect value for lon, expected -1.22389082888685252e+02, is {:e}", + msg.lon + ); + assert_eq!( + msg.n_sats, 5, + "incorrect value for n_sats, expected 5, is {}", + msg.n_sats + ); + assert_eq!( + msg.tow, 407151150, + "incorrect value for tow, expected 407151150, is {}", + msg.tow + ); + assert_eq!( + msg.v_accuracy, 0, + "incorrect value for v_accuracy, expected 0, is {}", + msg.v_accuracy + ); + } + _ => panic!("Invalid message type! Expected a MsgPosLLHDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } +} diff --git a/rust/sbp/tests/auto_check_sbp_observation_45.rs b/rust/sbp/tests/auto_check_sbp_observation_45.rs new file mode 100644 index 0000000000..898c45fcbb --- /dev/null +++ b/rust/sbp/tests/auto_check_sbp_observation_45.rs @@ -0,0 +1,2143 @@ +// +// Copyright (C) 2019 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. + +// This file was auto-generated from spec/tests/yaml/swiftnav/sbp/test_observation.yaml by generate.py. Do not modify by hand! + +extern crate sbp; +use sbp::messages::SBPMessage; + +mod common; +#[allow(unused_imports)] +use common::AlmostEq; + +#[test] +fn test_auto_check_sbp_observation_45() { + { + let payload: Vec = vec![ + 85, 69, 0, 195, 4, 98, 56, 158, 67, 24, 46, 7, 32, 56, 235, 249, 121, 244, 114, 255, + 255, 33, 46, 67, 218, 0, 238, 203, 70, 124, 22, 25, 3, 0, 98, 43, 184, 157, 2, 176, + 133, 197, 125, 126, 71, 253, 255, 185, 39, 68, 55, 3, 60, 173, 162, 131, 98, 231, 253, + 255, 139, 30, 33, 16, 10, 128, 178, 248, 136, 42, 113, 253, 255, 40, 20, 42, 71, 13, + 246, 246, 17, 135, 255, 51, 3, 0, 64, 27, 108, 249, 22, 210, 41, 114, 118, 131, 48, + 255, 255, 31, 52, 226, 58, 30, 23, 217, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgObsDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x45, + "Incorrect message type, expected 0x45, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.header.n_obs, 32, + "incorrect value for header.n_obs, expected 32, is {}", + msg.header.n_obs + ); + assert_eq!( + msg.header.t.tow, 407084600, + "incorrect value for header.t.tow, expected 407084600, is {}", + msg.header.t.tow + ); + assert_eq!( + msg.header.t.wn, 1838, + "incorrect value for header.t.wn, expected 1838, is {}", + msg.header.t.wn + ); + assert_eq!( + msg.obs[0].L.f, 33, + "incorrect value for obs[0].L.f, expected 33, is {}", + msg.obs[0].L.f + ); + assert_eq!( + msg.obs[0].L.i, -36108, + "incorrect value for obs[0].L.i, expected -36108, is {}", + msg.obs[0].L.i + ); + assert_eq!( + msg.obs[0].P, 2046421816, + "incorrect value for obs[0].P, expected 2046421816, is {}", + msg.obs[0].P + ); + assert_eq!( + msg.obs[0].cn0, 46, + "incorrect value for obs[0].cn0, expected 46, is {}", + msg.obs[0].cn0 + ); + assert_eq!( + msg.obs[0].lock, 55875, + "incorrect value for obs[0].lock, expected 55875, is {}", + msg.obs[0].lock + ); + assert_eq!( + msg.obs[0].prn, 0, + "incorrect value for obs[0].prn, expected 0, is {}", + msg.obs[0].prn + ); + assert_eq!( + msg.obs[1].L.f, 98, + "incorrect value for obs[1].L.f, expected 98, is {}", + msg.obs[1].L.f + ); + assert_eq!( + msg.obs[1].L.i, 203030, + "incorrect value for obs[1].L.i, expected 203030, is {}", + msg.obs[1].L.i + ); + assert_eq!( + msg.obs[1].P, 2085014510, + "incorrect value for obs[1].P, expected 2085014510, is {}", + msg.obs[1].P + ); + assert_eq!( + msg.obs[1].cn0, 43, + "incorrect value for obs[1].cn0, expected 43, is {}", + msg.obs[1].cn0 + ); + assert_eq!( + msg.obs[1].lock, 40376, + "incorrect value for obs[1].lock, expected 40376, is {}", + msg.obs[1].lock + ); + assert_eq!( + msg.obs[1].prn, 2, + "incorrect value for obs[1].prn, expected 2, is {}", + msg.obs[1].prn + ); + assert_eq!( + msg.obs[2].L.f, 185, + "incorrect value for obs[2].L.f, expected 185, is {}", + msg.obs[2].L.f + ); + assert_eq!( + msg.obs[2].L.i, -178306, + "incorrect value for obs[2].L.i, expected -178306, is {}", + msg.obs[2].L.i + ); + assert_eq!( + msg.obs[2].P, 2110096816, + "incorrect value for obs[2].P, expected 2110096816, is {}", + msg.obs[2].P + ); + assert_eq!( + msg.obs[2].cn0, 39, + "incorrect value for obs[2].cn0, expected 39, is {}", + msg.obs[2].cn0 + ); + assert_eq!( + msg.obs[2].lock, 14148, + "incorrect value for obs[2].lock, expected 14148, is {}", + msg.obs[2].lock + ); + assert_eq!( + msg.obs[2].prn, 3, + "incorrect value for obs[2].prn, expected 3, is {}", + msg.obs[2].prn + ); + assert_eq!( + msg.obs[3].L.f, 139, + "incorrect value for obs[3].L.f, expected 139, is {}", + msg.obs[3].L.f + ); + assert_eq!( + msg.obs[3].L.i, -137374, + "incorrect value for obs[3].L.i, expected -137374, is {}", + msg.obs[3].L.i + ); + assert_eq!( + msg.obs[3].P, 2208476476, + "incorrect value for obs[3].P, expected 2208476476, is {}", + msg.obs[3].P + ); + assert_eq!( + msg.obs[3].cn0, 30, + "incorrect value for obs[3].cn0, expected 30, is {}", + msg.obs[3].cn0 + ); + assert_eq!( + msg.obs[3].lock, 4129, + "incorrect value for obs[3].lock, expected 4129, is {}", + msg.obs[3].lock + ); + assert_eq!( + msg.obs[3].prn, 10, + "incorrect value for obs[3].prn, expected 10, is {}", + msg.obs[3].prn + ); + assert_eq!( + msg.obs[4].L.f, 40, + "incorrect value for obs[4].L.f, expected 40, is {}", + msg.obs[4].L.f + ); + assert_eq!( + msg.obs[4].L.i, -167638, + "incorrect value for obs[4].L.i, expected -167638, is {}", + msg.obs[4].L.i + ); + assert_eq!( + msg.obs[4].P, 2298000000, + "incorrect value for obs[4].P, expected 2298000000, is {}", + msg.obs[4].P + ); + assert_eq!( + msg.obs[4].cn0, 20, + "incorrect value for obs[4].cn0, expected 20, is {}", + msg.obs[4].cn0 + ); + assert_eq!( + msg.obs[4].lock, 18218, + "incorrect value for obs[4].lock, expected 18218, is {}", + msg.obs[4].lock + ); + assert_eq!( + msg.obs[4].prn, 13, + "incorrect value for obs[4].prn, expected 13, is {}", + msg.obs[4].prn + ); + assert_eq!( + msg.obs[5].L.f, 64, + "incorrect value for obs[5].L.f, expected 64, is {}", + msg.obs[5].L.f + ); + assert_eq!( + msg.obs[5].L.i, 209919, + "incorrect value for obs[5].L.i, expected 209919, is {}", + msg.obs[5].L.i + ); + assert_eq!( + msg.obs[5].P, 2266101494, + "incorrect value for obs[5].P, expected 2266101494, is {}", + msg.obs[5].P + ); + assert_eq!( + msg.obs[5].cn0, 27, + "incorrect value for obs[5].cn0, expected 27, is {}", + msg.obs[5].cn0 + ); + assert_eq!( + msg.obs[5].lock, 63852, + "incorrect value for obs[5].lock, expected 63852, is {}", + msg.obs[5].lock + ); + assert_eq!( + msg.obs[5].prn, 22, + "incorrect value for obs[5].prn, expected 22, is {}", + msg.obs[5].prn + ); + assert_eq!( + msg.obs[6].L.f, 31, + "incorrect value for obs[6].L.f, expected 31, is {}", + msg.obs[6].L.f + ); + assert_eq!( + msg.obs[6].L.i, -53117, + "incorrect value for obs[6].L.i, expected -53117, is {}", + msg.obs[6].L.i + ); + assert_eq!( + msg.obs[6].P, 1987193298, + "incorrect value for obs[6].P, expected 1987193298, is {}", + msg.obs[6].P + ); + assert_eq!( + msg.obs[6].cn0, 52, + "incorrect value for obs[6].cn0, expected 52, is {}", + msg.obs[6].cn0 + ); + assert_eq!( + msg.obs[6].lock, 15074, + "incorrect value for obs[6].lock, expected 15074, is {}", + msg.obs[6].lock + ); + assert_eq!( + msg.obs[6].prn, 30, + "incorrect value for obs[6].prn, expected 30, is {}", + msg.obs[6].prn + ); + } + _ => panic!("Invalid message type! Expected a MsgObsDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 69, 0, 195, 4, 20, 56, 158, 67, 24, 46, 7, 33, 84, 52, 164, 117, 102, 32, 0, 0, + 147, 62, 62, 250, 31, 234, 14, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgObsDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x45, + "Incorrect message type, expected 0x45, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.header.n_obs, 33, + "incorrect value for header.n_obs, expected 33, is {}", + msg.header.n_obs + ); + assert_eq!( + msg.header.t.tow, 407084600, + "incorrect value for header.t.tow, expected 407084600, is {}", + msg.header.t.tow + ); + assert_eq!( + msg.header.t.wn, 1838, + "incorrect value for header.t.wn, expected 1838, is {}", + msg.header.t.wn + ); + assert_eq!( + msg.obs[0].L.f, 147, + "incorrect value for obs[0].L.f, expected 147, is {}", + msg.obs[0].L.f + ); + assert_eq!( + msg.obs[0].L.i, 8294, + "incorrect value for obs[0].L.i, expected 8294, is {}", + msg.obs[0].L.i + ); + assert_eq!( + msg.obs[0].P, 1973695572, + "incorrect value for obs[0].P, expected 1973695572, is {}", + msg.obs[0].P + ); + assert_eq!( + msg.obs[0].cn0, 62, + "incorrect value for obs[0].cn0, expected 62, is {}", + msg.obs[0].cn0 + ); + assert_eq!( + msg.obs[0].lock, 64062, + "incorrect value for obs[0].lock, expected 64062, is {}", + msg.obs[0].lock + ); + assert_eq!( + msg.obs[0].prn, 31, + "incorrect value for obs[0].prn, expected 31, is {}", + msg.obs[0].prn + ); + } + _ => panic!("Invalid message type! Expected a MsgObsDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 69, 0, 195, 4, 98, 0, 159, 67, 24, 46, 7, 32, 32, 209, 249, 121, 145, 114, 255, + 255, 141, 45, 67, 218, 0, 177, 128, 70, 124, 79, 27, 3, 0, 159, 44, 184, 157, 2, 59, + 135, 197, 125, 175, 69, 253, 255, 77, 40, 68, 55, 3, 211, 172, 162, 131, 177, 229, 253, + 255, 20, 31, 33, 16, 10, 128, 178, 248, 136, 116, 111, 253, 255, 94, 21, 42, 71, 13, + 182, 173, 17, 135, 37, 54, 3, 0, 214, 27, 108, 249, 22, 91, 20, 114, 118, 240, 47, 255, + 255, 129, 52, 226, 58, 30, 200, 119, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgObsDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x45, + "Incorrect message type, expected 0x45, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.header.n_obs, 32, + "incorrect value for header.n_obs, expected 32, is {}", + msg.header.n_obs + ); + assert_eq!( + msg.header.t.tow, 407084800, + "incorrect value for header.t.tow, expected 407084800, is {}", + msg.header.t.tow + ); + assert_eq!( + msg.header.t.wn, 1838, + "incorrect value for header.t.wn, expected 1838, is {}", + msg.header.t.wn + ); + assert_eq!( + msg.obs[0].L.f, 141, + "incorrect value for obs[0].L.f, expected 141, is {}", + msg.obs[0].L.f + ); + assert_eq!( + msg.obs[0].L.i, -36207, + "incorrect value for obs[0].L.i, expected -36207, is {}", + msg.obs[0].L.i + ); + assert_eq!( + msg.obs[0].P, 2046415136, + "incorrect value for obs[0].P, expected 2046415136, is {}", + msg.obs[0].P + ); + assert_eq!( + msg.obs[0].cn0, 45, + "incorrect value for obs[0].cn0, expected 45, is {}", + msg.obs[0].cn0 + ); + assert_eq!( + msg.obs[0].lock, 55875, + "incorrect value for obs[0].lock, expected 55875, is {}", + msg.obs[0].lock + ); + assert_eq!( + msg.obs[0].prn, 0, + "incorrect value for obs[0].prn, expected 0, is {}", + msg.obs[0].prn + ); + assert_eq!( + msg.obs[1].L.f, 159, + "incorrect value for obs[1].L.f, expected 159, is {}", + msg.obs[1].L.f + ); + assert_eq!( + msg.obs[1].L.i, 203599, + "incorrect value for obs[1].L.i, expected 203599, is {}", + msg.obs[1].L.i + ); + assert_eq!( + msg.obs[1].P, 2084995249, + "incorrect value for obs[1].P, expected 2084995249, is {}", + msg.obs[1].P + ); + assert_eq!( + msg.obs[1].cn0, 44, + "incorrect value for obs[1].cn0, expected 44, is {}", + msg.obs[1].cn0 + ); + assert_eq!( + msg.obs[1].lock, 40376, + "incorrect value for obs[1].lock, expected 40376, is {}", + msg.obs[1].lock + ); + assert_eq!( + msg.obs[1].prn, 2, + "incorrect value for obs[1].prn, expected 2, is {}", + msg.obs[1].prn + ); + assert_eq!( + msg.obs[2].L.f, 77, + "incorrect value for obs[2].L.f, expected 77, is {}", + msg.obs[2].L.f + ); + assert_eq!( + msg.obs[2].L.i, -178769, + "incorrect value for obs[2].L.i, expected -178769, is {}", + msg.obs[2].L.i + ); + assert_eq!( + msg.obs[2].P, 2110097211, + "incorrect value for obs[2].P, expected 2110097211, is {}", + msg.obs[2].P + ); + assert_eq!( + msg.obs[2].cn0, 40, + "incorrect value for obs[2].cn0, expected 40, is {}", + msg.obs[2].cn0 + ); + assert_eq!( + msg.obs[2].lock, 14148, + "incorrect value for obs[2].lock, expected 14148, is {}", + msg.obs[2].lock + ); + assert_eq!( + msg.obs[2].prn, 3, + "incorrect value for obs[2].prn, expected 3, is {}", + msg.obs[2].prn + ); + assert_eq!( + msg.obs[3].L.f, 20, + "incorrect value for obs[3].L.f, expected 20, is {}", + msg.obs[3].L.f + ); + assert_eq!( + msg.obs[3].L.i, -137807, + "incorrect value for obs[3].L.i, expected -137807, is {}", + msg.obs[3].L.i + ); + assert_eq!( + msg.obs[3].P, 2208476371, + "incorrect value for obs[3].P, expected 2208476371, is {}", + msg.obs[3].P + ); + assert_eq!( + msg.obs[3].cn0, 31, + "incorrect value for obs[3].cn0, expected 31, is {}", + msg.obs[3].cn0 + ); + assert_eq!( + msg.obs[3].lock, 4129, + "incorrect value for obs[3].lock, expected 4129, is {}", + msg.obs[3].lock + ); + assert_eq!( + msg.obs[3].prn, 10, + "incorrect value for obs[3].prn, expected 10, is {}", + msg.obs[3].prn + ); + assert_eq!( + msg.obs[4].L.f, 94, + "incorrect value for obs[4].L.f, expected 94, is {}", + msg.obs[4].L.f + ); + assert_eq!( + msg.obs[4].L.i, -168076, + "incorrect value for obs[4].L.i, expected -168076, is {}", + msg.obs[4].L.i + ); + assert_eq!( + msg.obs[4].P, 2298000000, + "incorrect value for obs[4].P, expected 2298000000, is {}", + msg.obs[4].P + ); + assert_eq!( + msg.obs[4].cn0, 21, + "incorrect value for obs[4].cn0, expected 21, is {}", + msg.obs[4].cn0 + ); + assert_eq!( + msg.obs[4].lock, 18218, + "incorrect value for obs[4].lock, expected 18218, is {}", + msg.obs[4].lock + ); + assert_eq!( + msg.obs[4].prn, 13, + "incorrect value for obs[4].prn, expected 13, is {}", + msg.obs[4].prn + ); + assert_eq!( + msg.obs[5].L.f, 214, + "incorrect value for obs[5].L.f, expected 214, is {}", + msg.obs[5].L.f + ); + assert_eq!( + msg.obs[5].L.i, 210469, + "incorrect value for obs[5].L.i, expected 210469, is {}", + msg.obs[5].L.i + ); + assert_eq!( + msg.obs[5].P, 2266082742, + "incorrect value for obs[5].P, expected 2266082742, is {}", + msg.obs[5].P + ); + assert_eq!( + msg.obs[5].cn0, 27, + "incorrect value for obs[5].cn0, expected 27, is {}", + msg.obs[5].cn0 + ); + assert_eq!( + msg.obs[5].lock, 63852, + "incorrect value for obs[5].lock, expected 63852, is {}", + msg.obs[5].lock + ); + assert_eq!( + msg.obs[5].prn, 22, + "incorrect value for obs[5].prn, expected 22, is {}", + msg.obs[5].prn + ); + assert_eq!( + msg.obs[6].L.f, 129, + "incorrect value for obs[6].L.f, expected 129, is {}", + msg.obs[6].L.f + ); + assert_eq!( + msg.obs[6].L.i, -53264, + "incorrect value for obs[6].L.i, expected -53264, is {}", + msg.obs[6].L.i + ); + assert_eq!( + msg.obs[6].P, 1987187803, + "incorrect value for obs[6].P, expected 1987187803, is {}", + msg.obs[6].P + ); + assert_eq!( + msg.obs[6].cn0, 52, + "incorrect value for obs[6].cn0, expected 52, is {}", + msg.obs[6].cn0 + ); + assert_eq!( + msg.obs[6].lock, 15074, + "incorrect value for obs[6].lock, expected 15074, is {}", + msg.obs[6].lock + ); + assert_eq!( + msg.obs[6].prn, 30, + "incorrect value for obs[6].prn, expected 30, is {}", + msg.obs[6].prn + ); + } + _ => panic!("Invalid message type! Expected a MsgObsDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 69, 0, 195, 4, 20, 0, 159, 67, 24, 46, 7, 33, 49, 19, 164, 117, 120, 32, 0, 0, 222, + 63, 62, 250, 31, 11, 231, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgObsDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x45, + "Incorrect message type, expected 0x45, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.header.n_obs, 33, + "incorrect value for header.n_obs, expected 33, is {}", + msg.header.n_obs + ); + assert_eq!( + msg.header.t.tow, 407084800, + "incorrect value for header.t.tow, expected 407084800, is {}", + msg.header.t.tow + ); + assert_eq!( + msg.header.t.wn, 1838, + "incorrect value for header.t.wn, expected 1838, is {}", + msg.header.t.wn + ); + assert_eq!( + msg.obs[0].L.f, 222, + "incorrect value for obs[0].L.f, expected 222, is {}", + msg.obs[0].L.f + ); + assert_eq!( + msg.obs[0].L.i, 8312, + "incorrect value for obs[0].L.i, expected 8312, is {}", + msg.obs[0].L.i + ); + assert_eq!( + msg.obs[0].P, 1973687089, + "incorrect value for obs[0].P, expected 1973687089, is {}", + msg.obs[0].P + ); + assert_eq!( + msg.obs[0].cn0, 63, + "incorrect value for obs[0].cn0, expected 63, is {}", + msg.obs[0].cn0 + ); + assert_eq!( + msg.obs[0].lock, 64062, + "incorrect value for obs[0].lock, expected 64062, is {}", + msg.obs[0].lock + ); + assert_eq!( + msg.obs[0].prn, 31, + "incorrect value for obs[0].prn, expected 31, is {}", + msg.obs[0].prn + ); + } + _ => panic!("Invalid message type! Expected a MsgObsDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 69, 0, 195, 4, 72, 96, 162, 68, 24, 46, 7, 16, 87, 132, 217, 121, 121, 148, 255, + 255, 189, 43, 175, 147, 0, 132, 64, 200, 125, 106, 31, 254, 255, 1, 41, 14, 177, 3, + 128, 178, 248, 136, 70, 68, 254, 255, 166, 18, 184, 133, 13, 24, 127, 178, 134, 6, 25, + 2, 0, 249, 28, 33, 96, 22, 170, 104, 86, 118, 67, 112, 255, 255, 203, 56, 208, 88, 30, + 43, 107, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgObsDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x45, + "Incorrect message type, expected 0x45, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.header.n_obs, 16, + "incorrect value for header.n_obs, expected 16, is {}", + msg.header.n_obs + ); + assert_eq!( + msg.header.t.tow, 407151200, + "incorrect value for header.t.tow, expected 407151200, is {}", + msg.header.t.tow + ); + assert_eq!( + msg.header.t.wn, 1838, + "incorrect value for header.t.wn, expected 1838, is {}", + msg.header.t.wn + ); + assert_eq!( + msg.obs[0].L.f, 189, + "incorrect value for obs[0].L.f, expected 189, is {}", + msg.obs[0].L.f + ); + assert_eq!( + msg.obs[0].L.i, -27527, + "incorrect value for obs[0].L.i, expected -27527, is {}", + msg.obs[0].L.i + ); + assert_eq!( + msg.obs[0].P, 2044298327, + "incorrect value for obs[0].P, expected 2044298327, is {}", + msg.obs[0].P + ); + assert_eq!( + msg.obs[0].cn0, 43, + "incorrect value for obs[0].cn0, expected 43, is {}", + msg.obs[0].cn0 + ); + assert_eq!( + msg.obs[0].lock, 37807, + "incorrect value for obs[0].lock, expected 37807, is {}", + msg.obs[0].lock + ); + assert_eq!( + msg.obs[0].prn, 0, + "incorrect value for obs[0].prn, expected 0, is {}", + msg.obs[0].prn + ); + assert_eq!( + msg.obs[1].L.f, 1, + "incorrect value for obs[1].L.f, expected 1, is {}", + msg.obs[1].L.f + ); + assert_eq!( + msg.obs[1].L.i, -123030, + "incorrect value for obs[1].L.i, expected -123030, is {}", + msg.obs[1].L.i + ); + assert_eq!( + msg.obs[1].P, 2110275716, + "incorrect value for obs[1].P, expected 2110275716, is {}", + msg.obs[1].P + ); + assert_eq!( + msg.obs[1].cn0, 41, + "incorrect value for obs[1].cn0, expected 41, is {}", + msg.obs[1].cn0 + ); + assert_eq!( + msg.obs[1].lock, 45326, + "incorrect value for obs[1].lock, expected 45326, is {}", + msg.obs[1].lock + ); + assert_eq!( + msg.obs[1].prn, 3, + "incorrect value for obs[1].prn, expected 3, is {}", + msg.obs[1].prn + ); + assert_eq!( + msg.obs[2].L.f, 166, + "incorrect value for obs[2].L.f, expected 166, is {}", + msg.obs[2].L.f + ); + assert_eq!( + msg.obs[2].L.i, -113594, + "incorrect value for obs[2].L.i, expected -113594, is {}", + msg.obs[2].L.i + ); + assert_eq!( + msg.obs[2].P, 2298000000, + "incorrect value for obs[2].P, expected 2298000000, is {}", + msg.obs[2].P + ); + assert_eq!( + msg.obs[2].cn0, 18, + "incorrect value for obs[2].cn0, expected 18, is {}", + msg.obs[2].cn0 + ); + assert_eq!( + msg.obs[2].lock, 34232, + "incorrect value for obs[2].lock, expected 34232, is {}", + msg.obs[2].lock + ); + assert_eq!( + msg.obs[2].prn, 13, + "incorrect value for obs[2].prn, expected 13, is {}", + msg.obs[2].prn + ); + assert_eq!( + msg.obs[3].L.f, 249, + "incorrect value for obs[3].L.f, expected 249, is {}", + msg.obs[3].L.f + ); + assert_eq!( + msg.obs[3].L.i, 137478, + "incorrect value for obs[3].L.i, expected 137478, is {}", + msg.obs[3].L.i + ); + assert_eq!( + msg.obs[3].P, 2259844888, + "incorrect value for obs[3].P, expected 2259844888, is {}", + msg.obs[3].P + ); + assert_eq!( + msg.obs[3].cn0, 28, + "incorrect value for obs[3].cn0, expected 28, is {}", + msg.obs[3].cn0 + ); + assert_eq!( + msg.obs[3].lock, 24609, + "incorrect value for obs[3].lock, expected 24609, is {}", + msg.obs[3].lock + ); + assert_eq!( + msg.obs[3].prn, 22, + "incorrect value for obs[3].prn, expected 22, is {}", + msg.obs[3].prn + ); + assert_eq!( + msg.obs[4].L.f, 203, + "incorrect value for obs[4].L.f, expected 203, is {}", + msg.obs[4].L.f + ); + assert_eq!( + msg.obs[4].L.i, -36797, + "incorrect value for obs[4].L.i, expected -36797, is {}", + msg.obs[4].L.i + ); + assert_eq!( + msg.obs[4].P, 1985374378, + "incorrect value for obs[4].P, expected 1985374378, is {}", + msg.obs[4].P + ); + assert_eq!( + msg.obs[4].cn0, 56, + "incorrect value for obs[4].cn0, expected 56, is {}", + msg.obs[4].cn0 + ); + assert_eq!( + msg.obs[4].lock, 22736, + "incorrect value for obs[4].lock, expected 22736, is {}", + msg.obs[4].lock + ); + assert_eq!( + msg.obs[4].prn, 30, + "incorrect value for obs[4].prn, expected 30, is {}", + msg.obs[4].prn + ); + } + _ => panic!("Invalid message type! Expected a MsgObsDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 69, 0, 195, 4, 72, 40, 163, 68, 24, 46, 7, 16, 132, 107, 217, 121, 14, 148, 255, + 255, 1, 44, 175, 147, 0, 129, 66, 200, 125, 148, 29, 254, 255, 153, 41, 14, 177, 3, + 128, 178, 248, 136, 143, 66, 254, 255, 222, 18, 184, 133, 13, 158, 53, 178, 134, 42, + 27, 2, 0, 237, 30, 33, 96, 22, 38, 83, 86, 118, 168, 111, 255, 255, 45, 56, 208, 88, + 30, 1, 175, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgObsDepA(msg) => { + assert_eq!( + msg.get_message_type(), + 0x45, + "Incorrect message type, expected 0x45, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.header.n_obs, 16, + "incorrect value for header.n_obs, expected 16, is {}", + msg.header.n_obs + ); + assert_eq!( + msg.header.t.tow, 407151400, + "incorrect value for header.t.tow, expected 407151400, is {}", + msg.header.t.tow + ); + assert_eq!( + msg.header.t.wn, 1838, + "incorrect value for header.t.wn, expected 1838, is {}", + msg.header.t.wn + ); + assert_eq!( + msg.obs[0].L.f, 1, + "incorrect value for obs[0].L.f, expected 1, is {}", + msg.obs[0].L.f + ); + assert_eq!( + msg.obs[0].L.i, -27634, + "incorrect value for obs[0].L.i, expected -27634, is {}", + msg.obs[0].L.i + ); + assert_eq!( + msg.obs[0].P, 2044291972, + "incorrect value for obs[0].P, expected 2044291972, is {}", + msg.obs[0].P + ); + assert_eq!( + msg.obs[0].cn0, 44, + "incorrect value for obs[0].cn0, expected 44, is {}", + msg.obs[0].cn0 + ); + assert_eq!( + msg.obs[0].lock, 37807, + "incorrect value for obs[0].lock, expected 37807, is {}", + msg.obs[0].lock + ); + assert_eq!( + msg.obs[0].prn, 0, + "incorrect value for obs[0].prn, expected 0, is {}", + msg.obs[0].prn + ); + assert_eq!( + msg.obs[1].L.f, 153, + "incorrect value for obs[1].L.f, expected 153, is {}", + msg.obs[1].L.f + ); + assert_eq!( + msg.obs[1].L.i, -123500, + "incorrect value for obs[1].L.i, expected -123500, is {}", + msg.obs[1].L.i + ); + assert_eq!( + msg.obs[1].P, 2110276225, + "incorrect value for obs[1].P, expected 2110276225, is {}", + msg.obs[1].P + ); + assert_eq!( + msg.obs[1].cn0, 41, + "incorrect value for obs[1].cn0, expected 41, is {}", + msg.obs[1].cn0 + ); + assert_eq!( + msg.obs[1].lock, 45326, + "incorrect value for obs[1].lock, expected 45326, is {}", + msg.obs[1].lock + ); + assert_eq!( + msg.obs[1].prn, 3, + "incorrect value for obs[1].prn, expected 3, is {}", + msg.obs[1].prn + ); + assert_eq!( + msg.obs[2].L.f, 222, + "incorrect value for obs[2].L.f, expected 222, is {}", + msg.obs[2].L.f + ); + assert_eq!( + msg.obs[2].L.i, -114033, + "incorrect value for obs[2].L.i, expected -114033, is {}", + msg.obs[2].L.i + ); + assert_eq!( + msg.obs[2].P, 2298000000, + "incorrect value for obs[2].P, expected 2298000000, is {}", + msg.obs[2].P + ); + assert_eq!( + msg.obs[2].cn0, 18, + "incorrect value for obs[2].cn0, expected 18, is {}", + msg.obs[2].cn0 + ); + assert_eq!( + msg.obs[2].lock, 34232, + "incorrect value for obs[2].lock, expected 34232, is {}", + msg.obs[2].lock + ); + assert_eq!( + msg.obs[2].prn, 13, + "incorrect value for obs[2].prn, expected 13, is {}", + msg.obs[2].prn + ); + assert_eq!( + msg.obs[3].L.f, 237, + "incorrect value for obs[3].L.f, expected 237, is {}", + msg.obs[3].L.f + ); + assert_eq!( + msg.obs[3].L.i, 138026, + "incorrect value for obs[3].L.i, expected 138026, is {}", + msg.obs[3].L.i + ); + assert_eq!( + msg.obs[3].P, 2259826078, + "incorrect value for obs[3].P, expected 2259826078, is {}", + msg.obs[3].P + ); + assert_eq!( + msg.obs[3].cn0, 30, + "incorrect value for obs[3].cn0, expected 30, is {}", + msg.obs[3].cn0 + ); + assert_eq!( + msg.obs[3].lock, 24609, + "incorrect value for obs[3].lock, expected 24609, is {}", + msg.obs[3].lock + ); + assert_eq!( + msg.obs[3].prn, 22, + "incorrect value for obs[3].prn, expected 22, is {}", + msg.obs[3].prn + ); + assert_eq!( + msg.obs[4].L.f, 45, + "incorrect value for obs[4].L.f, expected 45, is {}", + msg.obs[4].L.f + ); + assert_eq!( + msg.obs[4].L.i, -36952, + "incorrect value for obs[4].L.i, expected -36952, is {}", + msg.obs[4].L.i + ); + assert_eq!( + msg.obs[4].P, 1985368870, + "incorrect value for obs[4].P, expected 1985368870, is {}", + msg.obs[4].P + ); + assert_eq!( + msg.obs[4].cn0, 56, + "incorrect value for obs[4].cn0, expected 56, is {}", + msg.obs[4].cn0 + ); + assert_eq!( + msg.obs[4].lock, 22736, + "incorrect value for obs[4].lock, expected 22736, is {}", + msg.obs[4].lock + ); + assert_eq!( + msg.obs[4].prn, 30, + "incorrect value for obs[4].prn, expected 30, is {}", + msg.obs[4].prn + ); + } + _ => panic!("Invalid message type! Expected a MsgObsDepA"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 0, 60, 190, 0, 0, 0, 0, 0, 186, 82, 192, 0, 0, + 0, 0, 0, 76, 109, 64, 0, 0, 0, 0, 0, 132, 208, 190, 0, 0, 0, 0, 0, 254, 220, 62, 0, 0, + 0, 0, 0, 0, 113, 62, 0, 0, 0, 0, 0, 0, 133, 190, 28, 36, 25, 81, 223, 254, 52, 62, 220, + 116, 216, 39, 33, 189, 3, 64, 0, 0, 0, 156, 177, 204, 134, 63, 0, 0, 160, 220, 182, 33, + 180, 64, 152, 225, 192, 44, 254, 76, 238, 191, 41, 150, 24, 2, 148, 156, 65, 190, 252, + 90, 119, 48, 15, 215, 240, 63, 124, 127, 115, 94, 208, 16, 238, 63, 165, 115, 52, 74, + 97, 167, 246, 189, 0, 0, 0, 0, 192, 180, 229, 190, 0, 0, 0, 0, 0, 0, 112, 189, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, + 1, 1, 3, 0, 225, 156, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgEphemerisDepB(msg) => { + assert_eq!( + msg.get_message_type(), + 0x46, + "Incorrect message type, expected 0x46, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert!( + msg.af0.almost_eq(-1.03502534329891205e-05), + "incorrect value for af0, expected -1.03502534329891205e-05, is {:e}", + msg.af0 + ); + assert!( + msg.af1.almost_eq(-9.09494701772928238e-13), + "incorrect value for af1, expected -9.09494701772928238e-13, is {:e}", + msg.af1 + ); + assert!( + msg.af2.almost_eq(0.00000000000000000e+00), + "incorrect value for af2, expected 0.00000000000000000e+00, is {:e}", + msg.af2 + ); + assert!( + msg.c_ic.almost_eq(6.33299350738525391e-08), + "incorrect value for c_ic, expected 6.33299350738525391e-08, is {:e}", + msg.c_ic + ); + assert!( + msg.c_is.almost_eq(-1.56462192535400391e-07), + "incorrect value for c_is, expected -1.56462192535400391e-07, is {:e}", + msg.c_is + ); + assert!( + msg.c_rc.almost_eq(2.34375000000000000e+02), + "incorrect value for c_rc, expected 2.34375000000000000e+02, is {:e}", + msg.c_rc + ); + assert!( + msg.c_rs.almost_eq(-7.49062500000000000e+01), + "incorrect value for c_rs, expected -7.49062500000000000e+01, is {:e}", + msg.c_rs + ); + assert!( + msg.c_uc.almost_eq(-3.93763184547424316e-06), + "incorrect value for c_uc, expected -3.93763184547424316e-06, is {:e}", + msg.c_uc + ); + assert!( + msg.c_us.almost_eq(6.91227614879608154e-06), + "incorrect value for c_us, expected 6.91227614879608154e-06, is {:e}", + msg.c_us + ); + assert!( + msg.dn.almost_eq(4.88841790794180047e-09), + "incorrect value for dn, expected 4.88841790794180047e-09, is {:e}", + msg.dn + ); + assert!( + msg.ecc.almost_eq(1.11326099140569568e-02), + "incorrect value for ecc, expected 1.11326099140569568e-02, is {:e}", + msg.ecc + ); + assert_eq!( + msg.healthy, 1, + "incorrect value for healthy, expected 1, is {}", + msg.healthy + ); + assert!( + msg.inc.almost_eq(9.39552483057908727e-01), + "incorrect value for inc, expected 9.39552483057908727e-01, is {:e}", + msg.inc + ); + assert!( + msg.inc_dot.almost_eq(-3.29656588662985413e-10), + "incorrect value for inc_dot, expected -3.29656588662985413e-10, is {:e}", + msg.inc_dot + ); + assert_eq!( + msg.iode, 0, + "incorrect value for iode, expected 0, is {}", + msg.iode + ); + assert!( + msg.m0.almost_eq(2.46734839562723884e+00), + "incorrect value for m0, expected 2.46734839562723884e+00, is {:e}", + msg.m0 + ); + assert!( + msg.omega0.almost_eq(-9.46898543747965782e-01), + "incorrect value for omega0, expected -9.46898543747965782e-01, is {:e}", + msg.omega0 + ); + assert!( + msg.omegadot.almost_eq(-8.20105589261047769e-09), + "incorrect value for omegadot, expected -8.20105589261047769e-09, is {:e}", + msg.omegadot + ); + assert_eq!( + msg.prn, 3, + "incorrect value for prn, expected 3, is {}", + msg.prn + ); + assert!( + msg.sqrta.almost_eq(5.15371430397033691e+03), + "incorrect value for sqrta, expected 5.15371430397033691e+03, is {:e}", + msg.sqrta + ); + assert!( + msg.tgd.almost_eq(-6.51925802230834961e-09), + "incorrect value for tgd, expected -6.51925802230834961e-09, is {:e}", + msg.tgd + ); + assert!( + msg.toc_tow.almost_eq(4.10400000000000000e+05), + "incorrect value for toc_tow, expected 4.10400000000000000e+05, is {:e}", + msg.toc_tow + ); + assert_eq!( + msg.toc_wn, 1838, + "incorrect value for toc_wn, expected 1838, is {}", + msg.toc_wn + ); + assert!( + msg.toe_tow.almost_eq(4.10400000000000000e+05), + "incorrect value for toe_tow, expected 4.10400000000000000e+05, is {:e}", + msg.toe_tow + ); + assert_eq!( + msg.toe_wn, 1838, + "incorrect value for toe_wn, expected 1838, is {}", + msg.toe_wn + ); + assert_eq!( + msg.valid, 1, + "incorrect value for valid, expected 1, is {}", + msg.valid + ); + assert!( + msg.w.almost_eq(1.05250472004053020e+00), + "incorrect value for w, expected 1.05250472004053020e+00, is {:e}", + msg.w + ); + } + _ => panic!("Invalid message type! Expected a MsgEphemerisDepB"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 0, 68, 190, 0, 0, 0, 0, 0, 72, 66, 64, 0, 0, 0, + 0, 128, 188, 115, 64, 0, 0, 0, 0, 0, 80, 193, 62, 0, 0, 0, 0, 0, 164, 204, 62, 0, 0, 0, + 0, 0, 0, 130, 62, 0, 0, 0, 0, 0, 0, 128, 62, 72, 181, 127, 6, 208, 225, 52, 62, 158, + 174, 129, 91, 27, 105, 249, 191, 0, 0, 0, 96, 204, 57, 128, 63, 0, 0, 160, 35, 146, 33, + 180, 64, 247, 169, 1, 36, 133, 206, 243, 63, 79, 11, 109, 92, 156, 208, 65, 190, 103, + 78, 3, 253, 223, 147, 255, 191, 164, 214, 90, 250, 218, 240, 238, 63, 94, 239, 187, 37, + 36, 10, 242, 61, 0, 0, 0, 0, 176, 91, 19, 63, 0, 0, 0, 0, 0, 0, 137, 189, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 1, + 1, 13, 0, 180, 21, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgEphemerisDepB(msg) => { + assert_eq!( + msg.get_message_type(), + 0x46, + "Incorrect message type, expected 0x46, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert!( + msg.af0.almost_eq(7.38454982638359070e-05), + "incorrect value for af0, expected 7.38454982638359070e-05, is {:e}", + msg.af0 + ); + assert!( + msg.af1.almost_eq(-2.84217094304040074e-12), + "incorrect value for af1, expected -2.84217094304040074e-12, is {:e}", + msg.af1 + ); + assert!( + msg.af2.almost_eq(0.00000000000000000e+00), + "incorrect value for af2, expected 0.00000000000000000e+00, is {:e}", + msg.af2 + ); + assert!( + msg.c_ic.almost_eq(1.34110450744628906e-07), + "incorrect value for c_ic, expected 1.34110450744628906e-07, is {:e}", + msg.c_ic + ); + assert!( + msg.c_is.almost_eq(1.19209289550781250e-07), + "incorrect value for c_is, expected 1.19209289550781250e-07, is {:e}", + msg.c_is + ); + assert!( + msg.c_rc.almost_eq(3.15781250000000000e+02), + "incorrect value for c_rc, expected 3.15781250000000000e+02, is {:e}", + msg.c_rc + ); + assert!( + msg.c_rs.almost_eq(3.65625000000000000e+01), + "incorrect value for c_rs, expected 3.65625000000000000e+01, is {:e}", + msg.c_rs + ); + assert!( + msg.c_uc.almost_eq(2.06381082534790039e-06), + "incorrect value for c_uc, expected 2.06381082534790039e-06, is {:e}", + msg.c_uc + ); + assert!( + msg.c_us.almost_eq(3.41422855854034424e-06), + "incorrect value for c_us, expected 3.41422855854034424e-06, is {:e}", + msg.c_us + ); + assert!( + msg.dn.almost_eq(4.86198823561129038e-09), + "incorrect value for dn, expected 4.86198823561129038e-09, is {:e}", + msg.dn + ); + assert!( + msg.ecc.almost_eq(7.92274158447980881e-03), + "incorrect value for ecc, expected 7.92274158447980881e-03, is {:e}", + msg.ecc + ); + assert_eq!( + msg.healthy, 1, + "incorrect value for healthy, expected 1, is {}", + msg.healthy + ); + assert!( + msg.inc.almost_eq(9.66901291822712228e-01), + "incorrect value for inc, expected 9.66901291822712228e-01, is {:e}", + msg.inc + ); + assert!( + msg.inc_dot.almost_eq(2.62510934634121662e-10), + "incorrect value for inc_dot, expected 2.62510934634121662e-10, is {:e}", + msg.inc_dot + ); + assert_eq!( + msg.iode, 0, + "incorrect value for iode, expected 0, is {}", + msg.iode + ); + assert!( + msg.m0.almost_eq(-1.58816085572008303e+00), + "incorrect value for m0, expected -1.58816085572008303e+00, is {:e}", + msg.m0 + ); + assert!( + msg.omega0.almost_eq(1.23791994156874607e+00), + "incorrect value for omega0, expected 1.23791994156874607e+00, is {:e}", + msg.omega0 + ); + assert!( + msg.omegadot.almost_eq(-8.29570269217244098e-09), + "incorrect value for omegadot, expected -8.29570269217244098e-09, is {:e}", + msg.omegadot + ); + assert_eq!( + msg.prn, 13, + "incorrect value for prn, expected 13, is {}", + msg.prn + ); + assert!( + msg.sqrta.almost_eq(5.15357085609436035e+03), + "incorrect value for sqrta, expected 5.15357085609436035e+03, is {:e}", + msg.sqrta + ); + assert!( + msg.tgd.almost_eq(-9.31322574615478516e-09), + "incorrect value for tgd, expected -9.31322574615478516e-09, is {:e}", + msg.tgd + ); + assert!( + msg.toc_tow.almost_eq(4.10400000000000000e+05), + "incorrect value for toc_tow, expected 4.10400000000000000e+05, is {:e}", + msg.toc_tow + ); + assert_eq!( + msg.toc_wn, 1838, + "incorrect value for toc_wn, expected 1838, is {}", + msg.toc_wn + ); + assert!( + msg.toe_tow.almost_eq(4.10400000000000000e+05), + "incorrect value for toe_tow, expected 4.10400000000000000e+05, is {:e}", + msg.toe_tow + ); + assert_eq!( + msg.toe_wn, 1838, + "incorrect value for toe_wn, expected 1838, is {}", + msg.toe_wn + ); + assert_eq!( + msg.valid, 1, + "incorrect value for valid, expected 1, is {}", + msg.valid + ); + assert!( + msg.w.almost_eq(-1.97360228379411651e+00), + "incorrect value for w, expected -1.97360228379411651e+00, is {:e}", + msg.w + ); + } + _ => panic!("Invalid message type! Expected a MsgEphemerisDepB"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 0, 56, 62, 0, 0, 0, 0, 0, 40, 81, 192, 0, 0, 0, + 0, 0, 129, 109, 64, 0, 0, 0, 0, 0, 28, 205, 190, 0, 0, 0, 0, 0, 76, 223, 62, 0, 0, 0, + 0, 0, 0, 105, 190, 0, 0, 0, 0, 0, 0, 92, 190, 134, 161, 223, 255, 243, 43, 51, 62, 146, + 176, 113, 142, 234, 164, 5, 64, 0, 0, 0, 56, 175, 140, 112, 63, 0, 0, 192, 90, 171, 33, + 180, 64, 36, 38, 237, 255, 200, 160, 237, 191, 204, 92, 63, 154, 49, 91, 65, 190, 125, + 94, 251, 132, 52, 61, 216, 63, 2, 139, 28, 27, 231, 199, 238, 63, 124, 183, 4, 180, + 194, 30, 247, 189, 0, 0, 0, 0, 0, 104, 222, 190, 0, 0, 0, 0, 0, 0, 96, 61, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 1, + 1, 0, 0, 222, 152, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgEphemerisDepB(msg) => { + assert_eq!( + msg.get_message_type(), + 0x46, + "Incorrect message type, expected 0x46, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert!( + msg.af0.almost_eq(-7.24941492080688477e-06), + "incorrect value for af0, expected -7.24941492080688477e-06, is {:e}", + msg.af0 + ); + assert!( + msg.af1.almost_eq(4.54747350886464119e-13), + "incorrect value for af1, expected 4.54747350886464119e-13, is {:e}", + msg.af1 + ); + assert!( + msg.af2.almost_eq(0.00000000000000000e+00), + "incorrect value for af2, expected 0.00000000000000000e+00, is {:e}", + msg.af2 + ); + assert!( + msg.c_ic.almost_eq(-4.65661287307739258e-08), + "incorrect value for c_ic, expected -4.65661287307739258e-08, is {:e}", + msg.c_ic + ); + assert!( + msg.c_is.almost_eq(-2.60770320892333984e-08), + "incorrect value for c_is, expected -2.60770320892333984e-08, is {:e}", + msg.c_is + ); + assert!( + msg.c_rc.almost_eq(2.36031250000000000e+02), + "incorrect value for c_rc, expected 2.36031250000000000e+02, is {:e}", + msg.c_rc + ); + assert!( + msg.c_rs.almost_eq(-6.86250000000000000e+01), + "incorrect value for c_rs, expected -6.86250000000000000e+01, is {:e}", + msg.c_rs + ); + assert!( + msg.c_uc.almost_eq(-3.47010791301727295e-06), + "incorrect value for c_uc, expected -3.47010791301727295e-06, is {:e}", + msg.c_uc + ); + assert!( + msg.c_us.almost_eq(7.46175646781921387e-06), + "incorrect value for c_us, expected 7.46175646781921387e-06, is {:e}", + msg.c_us + ); + assert!( + msg.dn.almost_eq(4.46375736198265652e-09), + "incorrect value for dn, expected 4.46375736198265652e-09, is {:e}", + msg.dn + ); + assert!( + msg.ecc.almost_eq(4.04041714500635862e-03), + "incorrect value for ecc, expected 4.04041714500635862e-03, is {:e}", + msg.ecc + ); + assert_eq!( + msg.healthy, 1, + "incorrect value for healthy, expected 1, is {}", + msg.healthy + ); + assert!( + msg.inc.almost_eq(9.61902192070141604e-01), + "incorrect value for inc, expected 9.61902192070141604e-01, is {:e}", + msg.inc + ); + assert!( + msg.inc_dot.almost_eq(-3.36442585612711049e-10), + "incorrect value for inc_dot, expected -3.36442585612711049e-10, is {:e}", + msg.inc_dot + ); + assert_eq!( + msg.iode, 0, + "incorrect value for iode, expected 0, is {}", + msg.iode + ); + assert!( + msg.m0.almost_eq(2.70552550587132945e+00), + "incorrect value for m0, expected 2.70552550587132945e+00, is {:e}", + msg.m0 + ); + assert!( + msg.omega0.almost_eq(-9.25877094131639655e-01), + "incorrect value for omega0, expected -9.25877094131639655e-01, is {:e}", + msg.omega0 + ); + assert!( + msg.omegadot.almost_eq(-8.08212236712318227e-09), + "incorrect value for omegadot, expected -8.08212236712318227e-09, is {:e}", + msg.omegadot + ); + assert_eq!( + msg.prn, 0, + "incorrect value for prn, expected 0, is {}", + msg.prn + ); + assert!( + msg.sqrta.almost_eq(5.15366935348510742e+03), + "incorrect value for sqrta, expected 5.15366935348510742e+03, is {:e}", + msg.sqrta + ); + assert!( + msg.tgd.almost_eq(5.58793544769287109e-09), + "incorrect value for tgd, expected 5.58793544769287109e-09, is {:e}", + msg.tgd + ); + assert!( + msg.toc_tow.almost_eq(4.10400000000000000e+05), + "incorrect value for toc_tow, expected 4.10400000000000000e+05, is {:e}", + msg.toc_tow + ); + assert_eq!( + msg.toc_wn, 1838, + "incorrect value for toc_wn, expected 1838, is {}", + msg.toc_wn + ); + assert!( + msg.toe_tow.almost_eq(4.10400000000000000e+05), + "incorrect value for toe_tow, expected 4.10400000000000000e+05, is {:e}", + msg.toe_tow + ); + assert_eq!( + msg.toe_wn, 1838, + "incorrect value for toe_wn, expected 1838, is {}", + msg.toe_wn + ); + assert_eq!( + msg.valid, 1, + "incorrect value for valid, expected 1, is {}", + msg.valid + ); + assert!( + msg.w.almost_eq(3.78735666146418570e-01), + "incorrect value for w, expected 3.78735666146418570e-01, is {:e}", + msg.w + ); + } + _ => panic!("Invalid message type! Expected a MsgEphemerisDepB"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 0, 68, 190, 0, 0, 0, 0, 0, 72, 66, 64, 0, 0, 0, + 0, 128, 188, 115, 64, 0, 0, 0, 0, 0, 80, 193, 62, 0, 0, 0, 0, 0, 164, 204, 62, 0, 0, 0, + 0, 0, 0, 130, 62, 0, 0, 0, 0, 0, 0, 128, 62, 72, 181, 127, 6, 208, 225, 52, 62, 158, + 174, 129, 91, 27, 105, 249, 191, 0, 0, 0, 96, 204, 57, 128, 63, 0, 0, 160, 35, 146, 33, + 180, 64, 247, 169, 1, 36, 133, 206, 243, 63, 79, 11, 109, 92, 156, 208, 65, 190, 103, + 78, 3, 253, 223, 147, 255, 191, 164, 214, 90, 250, 218, 240, 238, 63, 94, 239, 187, 37, + 36, 10, 242, 61, 0, 0, 0, 0, 176, 91, 19, 63, 0, 0, 0, 0, 0, 0, 137, 189, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 1, + 1, 13, 0, 180, 21, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgEphemerisDepB(msg) => { + assert_eq!( + msg.get_message_type(), + 0x46, + "Incorrect message type, expected 0x46, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert!( + msg.af0.almost_eq(7.38454982638359070e-05), + "incorrect value for af0, expected 7.38454982638359070e-05, is {:e}", + msg.af0 + ); + assert!( + msg.af1.almost_eq(-2.84217094304040074e-12), + "incorrect value for af1, expected -2.84217094304040074e-12, is {:e}", + msg.af1 + ); + assert!( + msg.af2.almost_eq(0.00000000000000000e+00), + "incorrect value for af2, expected 0.00000000000000000e+00, is {:e}", + msg.af2 + ); + assert!( + msg.c_ic.almost_eq(1.34110450744628906e-07), + "incorrect value for c_ic, expected 1.34110450744628906e-07, is {:e}", + msg.c_ic + ); + assert!( + msg.c_is.almost_eq(1.19209289550781250e-07), + "incorrect value for c_is, expected 1.19209289550781250e-07, is {:e}", + msg.c_is + ); + assert!( + msg.c_rc.almost_eq(3.15781250000000000e+02), + "incorrect value for c_rc, expected 3.15781250000000000e+02, is {:e}", + msg.c_rc + ); + assert!( + msg.c_rs.almost_eq(3.65625000000000000e+01), + "incorrect value for c_rs, expected 3.65625000000000000e+01, is {:e}", + msg.c_rs + ); + assert!( + msg.c_uc.almost_eq(2.06381082534790039e-06), + "incorrect value for c_uc, expected 2.06381082534790039e-06, is {:e}", + msg.c_uc + ); + assert!( + msg.c_us.almost_eq(3.41422855854034424e-06), + "incorrect value for c_us, expected 3.41422855854034424e-06, is {:e}", + msg.c_us + ); + assert!( + msg.dn.almost_eq(4.86198823561129038e-09), + "incorrect value for dn, expected 4.86198823561129038e-09, is {:e}", + msg.dn + ); + assert!( + msg.ecc.almost_eq(7.92274158447980881e-03), + "incorrect value for ecc, expected 7.92274158447980881e-03, is {:e}", + msg.ecc + ); + assert_eq!( + msg.healthy, 1, + "incorrect value for healthy, expected 1, is {}", + msg.healthy + ); + assert!( + msg.inc.almost_eq(9.66901291822712228e-01), + "incorrect value for inc, expected 9.66901291822712228e-01, is {:e}", + msg.inc + ); + assert!( + msg.inc_dot.almost_eq(2.62510934634121662e-10), + "incorrect value for inc_dot, expected 2.62510934634121662e-10, is {:e}", + msg.inc_dot + ); + assert_eq!( + msg.iode, 0, + "incorrect value for iode, expected 0, is {}", + msg.iode + ); + assert!( + msg.m0.almost_eq(-1.58816085572008303e+00), + "incorrect value for m0, expected -1.58816085572008303e+00, is {:e}", + msg.m0 + ); + assert!( + msg.omega0.almost_eq(1.23791994156874607e+00), + "incorrect value for omega0, expected 1.23791994156874607e+00, is {:e}", + msg.omega0 + ); + assert!( + msg.omegadot.almost_eq(-8.29570269217244098e-09), + "incorrect value for omegadot, expected -8.29570269217244098e-09, is {:e}", + msg.omegadot + ); + assert_eq!( + msg.prn, 13, + "incorrect value for prn, expected 13, is {}", + msg.prn + ); + assert!( + msg.sqrta.almost_eq(5.15357085609436035e+03), + "incorrect value for sqrta, expected 5.15357085609436035e+03, is {:e}", + msg.sqrta + ); + assert!( + msg.tgd.almost_eq(-9.31322574615478516e-09), + "incorrect value for tgd, expected -9.31322574615478516e-09, is {:e}", + msg.tgd + ); + assert!( + msg.toc_tow.almost_eq(4.10400000000000000e+05), + "incorrect value for toc_tow, expected 4.10400000000000000e+05, is {:e}", + msg.toc_tow + ); + assert_eq!( + msg.toc_wn, 1838, + "incorrect value for toc_wn, expected 1838, is {}", + msg.toc_wn + ); + assert!( + msg.toe_tow.almost_eq(4.10400000000000000e+05), + "incorrect value for toe_tow, expected 4.10400000000000000e+05, is {:e}", + msg.toe_tow + ); + assert_eq!( + msg.toe_wn, 1838, + "incorrect value for toe_wn, expected 1838, is {}", + msg.toe_wn + ); + assert_eq!( + msg.valid, 1, + "incorrect value for valid, expected 1, is {}", + msg.valid + ); + assert!( + msg.w.almost_eq(-1.97360228379411651e+00), + "incorrect value for w, expected -1.97360228379411651e+00, is {:e}", + msg.w + ); + } + _ => panic!("Invalid message type! Expected a MsgEphemerisDepB"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 128, 85, 190, 0, 0, 0, 0, 0, 156, 69, 64, 0, 0, + 0, 0, 128, 19, 115, 64, 0, 0, 0, 0, 0, 160, 193, 62, 0, 0, 0, 0, 0, 152, 207, 62, 0, 0, + 0, 0, 0, 0, 97, 190, 0, 0, 0, 0, 0, 192, 139, 190, 26, 26, 13, 149, 16, 152, 54, 62, + 104, 7, 46, 214, 75, 84, 5, 192, 0, 0, 0, 128, 230, 82, 132, 63, 0, 0, 160, 252, 162, + 33, 180, 64, 73, 6, 130, 54, 217, 171, 242, 63, 81, 224, 163, 123, 238, 42, 66, 190, + 206, 43, 141, 67, 243, 157, 5, 192, 113, 179, 153, 187, 43, 92, 238, 63, 254, 236, 31, + 43, 224, 157, 244, 61, 0, 0, 0, 0, 232, 4, 26, 191, 0, 0, 0, 0, 0, 0, 134, 189, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 0, 0, 0, 0, 128, 12, 25, 65, 46, + 7, 1, 1, 22, 0, 99, 61, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgEphemerisDepB(msg) => { + assert_eq!( + msg.get_message_type(), + 0x46, + "Incorrect message type, expected 0x46, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert!( + msg.af0.almost_eq(-9.92552377283573151e-05), + "incorrect value for af0, expected -9.92552377283573151e-05, is {:e}", + msg.af0 + ); + assert!( + msg.af1.almost_eq(-2.50111042987555265e-12), + "incorrect value for af1, expected -2.50111042987555265e-12, is {:e}", + msg.af1 + ); + assert!( + msg.af2.almost_eq(0.00000000000000000e+00), + "incorrect value for af2, expected 0.00000000000000000e+00, is {:e}", + msg.af2 + ); + assert!( + msg.c_ic.almost_eq(-3.16649675369262695e-08), + "incorrect value for c_ic, expected -3.16649675369262695e-08, is {:e}", + msg.c_ic + ); + assert!( + msg.c_is.almost_eq(-2.06753611564636230e-07), + "incorrect value for c_is, expected -2.06753611564636230e-07, is {:e}", + msg.c_is + ); + assert!( + msg.c_rc.almost_eq(3.05218750000000000e+02), + "incorrect value for c_rc, expected 3.05218750000000000e+02, is {:e}", + msg.c_rc + ); + assert!( + msg.c_rs.almost_eq(4.32187500000000000e+01), + "incorrect value for c_rs, expected 4.32187500000000000e+01, is {:e}", + msg.c_rs + ); + assert!( + msg.c_uc.almost_eq(2.10106372833251953e-06), + "incorrect value for c_uc, expected 2.10106372833251953e-06, is {:e}", + msg.c_uc + ); + assert!( + msg.c_us.almost_eq(3.76626849174499512e-06), + "incorrect value for c_us, expected 3.76626849174499512e-06, is {:e}", + msg.c_us + ); + assert!( + msg.dn.almost_eq(5.26057626697411973e-09), + "incorrect value for dn, expected 5.26057626697411973e-09, is {:e}", + msg.dn + ); + assert!( + msg.ecc.almost_eq(9.92374494671821594e-03), + "incorrect value for ecc, expected 9.92374494671821594e-03, is {:e}", + msg.ecc + ); + assert_eq!( + msg.healthy, 1, + "incorrect value for healthy, expected 1, is {}", + msg.healthy + ); + assert!( + msg.inc.almost_eq(9.48751322180767187e-01), + "incorrect value for inc, expected 9.48751322180767187e-01, is {:e}", + msg.inc + ); + assert!( + msg.inc_dot.almost_eq(3.00012496724710486e-10), + "incorrect value for inc_dot, expected 3.00012496724710486e-10, is {:e}", + msg.inc_dot + ); + assert_eq!( + msg.iode, 0, + "incorrect value for iode, expected 0, is {}", + msg.iode + ); + assert!( + msg.m0.almost_eq(-2.66616027191132687e+00), + "incorrect value for m0, expected -2.66616027191132687e+00, is {:e}", + msg.m0 + ); + assert!( + msg.omega0.almost_eq(1.16695519725944252e+00), + "incorrect value for omega0, expected 1.16695519725944252e+00, is {:e}", + msg.omega0 + ); + assert!( + msg.omegadot.almost_eq(-8.45999524990263948e-09), + "incorrect value for omegadot, expected -8.45999524990263948e-09, is {:e}", + msg.omegadot + ); + assert_eq!( + msg.prn, 22, + "incorrect value for prn, expected 22, is {}", + msg.prn + ); + assert!( + msg.sqrta.almost_eq(5.15363666725158691e+03), + "incorrect value for sqrta, expected 5.15363666725158691e+03, is {:e}", + msg.sqrta + ); + assert!( + msg.tgd.almost_eq(-2.00234353542327881e-08), + "incorrect value for tgd, expected -2.00234353542327881e-08, is {:e}", + msg.tgd + ); + assert!( + msg.toc_tow.almost_eq(4.10400000000000000e+05), + "incorrect value for toc_tow, expected 4.10400000000000000e+05, is {:e}", + msg.toc_tow + ); + assert_eq!( + msg.toc_wn, 1838, + "incorrect value for toc_wn, expected 1838, is {}", + msg.toc_wn + ); + assert!( + msg.toe_tow.almost_eq(4.10400000000000000e+05), + "incorrect value for toe_tow, expected 4.10400000000000000e+05, is {:e}", + msg.toe_tow + ); + assert_eq!( + msg.toe_wn, 1838, + "incorrect value for toe_wn, expected 1838, is {}", + msg.toe_wn + ); + assert_eq!( + msg.valid, 1, + "incorrect value for valid, expected 1, is {}", + msg.valid + ); + assert!( + msg.w.almost_eq(-2.70212414526529354e+00), + "incorrect value for w, expected -2.70212414526529354e+00, is {:e}", + msg.w + ); + } + _ => panic!("Invalid message type! Expected a MsgEphemerisDepB"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 0, 77, 190, 0, 0, 0, 0, 0, 122, 83, 192, 0, 0, + 0, 0, 0, 233, 110, 64, 0, 0, 0, 0, 0, 60, 207, 190, 0, 0, 0, 0, 0, 28, 222, 62, 0, 0, + 0, 0, 0, 128, 120, 62, 0, 0, 0, 0, 0, 0, 108, 62, 10, 230, 183, 140, 214, 230, 50, 62, + 54, 86, 196, 164, 252, 10, 255, 63, 0, 0, 0, 36, 247, 191, 128, 63, 0, 0, 160, 5, 193, + 33, 180, 64, 186, 138, 81, 129, 88, 239, 1, 64, 94, 210, 120, 170, 106, 25, 65, 190, + 103, 213, 32, 155, 227, 194, 224, 191, 156, 47, 104, 93, 101, 55, 239, 63, 196, 83, + 100, 254, 51, 54, 4, 190, 0, 0, 0, 0, 50, 242, 52, 63, 0, 0, 0, 0, 0, 0, 114, 189, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 0, 0, 0, 0, 128, 12, 25, 65, + 46, 7, 1, 1, 30, 0, 170, 33, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgEphemerisDepB(msg) => { + assert_eq!( + msg.get_message_type(), + 0x46, + "Incorrect message type, expected 0x46, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert!( + msg.af0.almost_eq(3.19611746817827225e-04), + "incorrect value for af0, expected 3.19611746817827225e-04, is {:e}", + msg.af0 + ); + assert!( + msg.af1.almost_eq(-1.02318153949454427e-12), + "incorrect value for af1, expected -1.02318153949454427e-12, is {:e}", + msg.af1 + ); + assert!( + msg.af2.almost_eq(0.00000000000000000e+00), + "incorrect value for af2, expected 0.00000000000000000e+00, is {:e}", + msg.af2 + ); + assert!( + msg.c_ic.almost_eq(9.12696123123168945e-08), + "incorrect value for c_ic, expected 9.12696123123168945e-08, is {:e}", + msg.c_ic + ); + assert!( + msg.c_is.almost_eq(5.21540641784667969e-08), + "incorrect value for c_is, expected 5.21540641784667969e-08, is {:e}", + msg.c_is + ); + assert!( + msg.c_rc.almost_eq(2.47281250000000000e+02), + "incorrect value for c_rc, expected 2.47281250000000000e+02, is {:e}", + msg.c_rc + ); + assert!( + msg.c_rs.almost_eq(-7.79062500000000000e+01), + "incorrect value for c_rs, expected -7.79062500000000000e+01, is {:e}", + msg.c_rs + ); + assert!( + msg.c_uc.almost_eq(-3.72342765331268311e-06), + "incorrect value for c_uc, expected -3.72342765331268311e-06, is {:e}", + msg.c_uc + ); + assert!( + msg.c_us.almost_eq(7.17863440513610840e-06), + "incorrect value for c_us, expected 7.17863440513610840e-06, is {:e}", + msg.c_us + ); + assert!( + msg.dn.almost_eq(4.40089760076414576e-09), + "incorrect value for dn, expected 4.40089760076414576e-09, is {:e}", + msg.dn + ); + assert!( + msg.ecc.almost_eq(8.17864493001252413e-03), + "incorrect value for ecc, expected 8.17864493001252413e-03, is {:e}", + msg.ecc + ); + assert_eq!( + msg.healthy, 1, + "incorrect value for healthy, expected 1, is {}", + msg.healthy + ); + assert!( + msg.inc.almost_eq(9.75512201724530126e-01), + "incorrect value for inc, expected 9.75512201724530126e-01, is {:e}", + msg.inc + ); + assert!( + msg.inc_dot.almost_eq(-5.88238788220950205e-10), + "incorrect value for inc_dot, expected -5.88238788220950205e-10, is {:e}", + msg.inc_dot + ); + assert_eq!( + msg.iode, 0, + "incorrect value for iode, expected 0, is {}", + msg.iode + ); + assert!( + msg.m0.almost_eq(1.94018234598241923e+00), + "incorrect value for m0, expected 1.94018234598241923e+00, is {:e}", + msg.m0 + ); + assert!( + msg.omega0.almost_eq(2.24186802892776615e+00), + "incorrect value for omega0, expected 2.24186802892776615e+00, is {:e}", + msg.omega0 + ); + assert!( + msg.omegadot.almost_eq(-7.96247452616749420e-09), + "incorrect value for omegadot, expected -7.96247452616749420e-09, is {:e}", + msg.omegadot + ); + assert_eq!( + msg.prn, 30, + "incorrect value for prn, expected 30, is {}", + msg.prn + ); + assert!( + msg.sqrta.almost_eq(5.15375399208068848e+03), + "incorrect value for sqrta, expected 5.15375399208068848e+03, is {:e}", + msg.sqrta + ); + assert!( + msg.tgd.almost_eq(-1.35041773319244385e-08), + "incorrect value for tgd, expected -1.35041773319244385e-08, is {:e}", + msg.tgd + ); + assert!( + msg.toc_tow.almost_eq(4.10400000000000000e+05), + "incorrect value for toc_tow, expected 4.10400000000000000e+05, is {:e}", + msg.toc_tow + ); + assert_eq!( + msg.toc_wn, 1838, + "incorrect value for toc_wn, expected 1838, is {}", + msg.toc_wn + ); + assert!( + msg.toe_tow.almost_eq(4.10400000000000000e+05), + "incorrect value for toe_tow, expected 4.10400000000000000e+05, is {:e}", + msg.toe_tow + ); + assert_eq!( + msg.toe_wn, 1838, + "incorrect value for toe_wn, expected 1838, is {}", + msg.toe_wn + ); + assert_eq!( + msg.valid, 1, + "incorrect value for valid, expected 1, is {}", + msg.valid + ); + assert!( + msg.w.almost_eq(-5.23790171608806143e-01), + "incorrect value for w, expected -5.23790171608806143e-01, is {:e}", + msg.w + ); + } + _ => panic!("Invalid message type! Expected a MsgEphemerisDepB"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } +} diff --git a/rust/sbp/tests/auto_check_sbp_piksi_46.rs b/rust/sbp/tests/auto_check_sbp_piksi_46.rs new file mode 100644 index 0000000000..3d6aaf9e58 Binary files /dev/null and b/rust/sbp/tests/auto_check_sbp_piksi_46.rs differ diff --git a/rust/sbp/tests/auto_check_sbp_system_38.rs b/rust/sbp/tests/auto_check_sbp_system_38.rs new file mode 100644 index 0000000000..24f4b97b4c --- /dev/null +++ b/rust/sbp/tests/auto_check_sbp_system_38.rs @@ -0,0 +1,67 @@ +// +// Copyright (C) 2019 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. + +// This file was auto-generated from spec/tests/yaml/swiftnav/sbp/system/test_MsgStartup.yaml by generate.py. Do not modify by hand! + +extern crate sbp; +use sbp::messages::SBPMessage; + +mod common; +#[allow(unused_imports)] +use common::AlmostEq; + +#[test] +fn test_auto_check_sbp_system_38() { + { + let payload: Vec = vec![85, 0, 255, 66, 0, 4, 0, 0, 0, 0, 70, 160]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgStartup(msg) => { + assert_eq!( + msg.get_message_type(), + 0xff00, + "Incorrect message type, expected 0xff00, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x42, + "incorrect sender id, expected 0x42, is {}", + sender_id + ); + assert_eq!( + msg.cause, 0, + "incorrect value for cause, expected 0, is {}", + msg.cause + ); + assert_eq!( + msg.reserved, 0, + "incorrect value for reserved, expected 0, is {}", + msg.reserved + ); + assert_eq!( + msg.startup_type, 0, + "incorrect value for startup_type, expected 0, is {}", + msg.startup_type + ); + } + _ => panic!("Invalid message type! Expected a MsgStartup"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } +} diff --git a/rust/sbp/tests/auto_check_sbp_system_47.rs b/rust/sbp/tests/auto_check_sbp_system_47.rs new file mode 100644 index 0000000000..0538c2ea76 --- /dev/null +++ b/rust/sbp/tests/auto_check_sbp_system_47.rs @@ -0,0 +1,91 @@ +// +// Copyright (C) 2019 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. + +// This file was auto-generated from spec/tests/yaml/swiftnav/sbp/test_system.yaml by generate.py. Do not modify by hand! + +extern crate sbp; +use sbp::messages::SBPMessage; + +mod common; +#[allow(unused_imports)] +use common::AlmostEq; + +#[test] +fn test_auto_check_sbp_system_47() { + { + let payload: Vec = vec![85, 0, 255, 195, 4, 4, 0, 0, 0, 0, 127, 181]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgStartup(msg) => { + assert_eq!( + msg.get_message_type(), + 0xff00, + "Incorrect message type, expected 0xff00, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.reserved, 0, + "incorrect value for reserved, expected 0, is {}", + msg.reserved + ); + } + _ => panic!("Invalid message type! Expected a MsgStartup"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![85, 255, 255, 195, 4, 4, 0, 0, 0, 0, 66, 57]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgHeartbeat(msg) => { + assert_eq!( + msg.get_message_type(), + 0xffff, + "Incorrect message type, expected 0xffff, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x4c3, + "incorrect sender id, expected 0x4c3, is {}", + sender_id + ); + assert_eq!( + msg.flags, 0, + "incorrect value for flags, expected 0, is {}", + msg.flags + ); + } + _ => panic!("Invalid message type! Expected a MsgHeartbeat"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } +} diff --git a/rust/sbp/tests/auto_check_sbp_tracking_50.rs b/rust/sbp/tests/auto_check_sbp_tracking_50.rs new file mode 100644 index 0000000000..f0ff58765b --- /dev/null +++ b/rust/sbp/tests/auto_check_sbp_tracking_50.rs @@ -0,0 +1,793 @@ +// +// Copyright (C) 2019 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. + +// This file was auto-generated from spec/tests/yaml/swiftnav/sbp/tracking/test_MsgTrackingStateDetailedDep.yaml by generate.py. Do not modify by hand! + +extern crate sbp; +use sbp::messages::SBPMessage; + +mod common; +#[allow(unused_imports)] +use common::AlmostEq; + +#[test] +fn test_auto_check_sbp_tracking_50() { + { + let payload: Vec = vec![ + 85, 17, 0, 59, 103, 55, 163, 151, 112, 215, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 39, 5, 0, 0, 169, 177, 208, 54, 15, 0, 0, 0, 85, 61, 0, 0, 39, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 40, 0, 108, 1, 0, 11, 0, 0, 9, 166, 214, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgTrackingStateDetailedDep(msg) => { + assert_eq!( + msg.get_message_type(), + 0x11, + "Incorrect message type, expected 0x11, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x673b, + "incorrect sender id, expected 0x673b, is {}", + sender_id + ); + assert_eq!( + msg.L.f, 169, + "incorrect value for L.f, expected 169, is {}", + msg.L.f + ); + assert_eq!( + msg.L.i, 1319, + "incorrect value for L.i, expected 1319, is {}", + msg.L.i + ); + assert_eq!(msg.P, 0, "incorrect value for P, expected 0, is {}", msg.P); + assert_eq!( + msg.P_std, 0, + "incorrect value for P_std, expected 0, is {}", + msg.P_std + ); + assert_eq!( + msg.acceleration, 108, + "incorrect value for acceleration, expected 108, is {}", + msg.acceleration + ); + assert_eq!( + msg.clock_drift, 0, + "incorrect value for clock_drift, expected 0, is {}", + msg.clock_drift + ); + assert_eq!( + msg.clock_offset, 0, + "incorrect value for clock_offset, expected 0, is {}", + msg.clock_offset + ); + assert_eq!( + msg.cn0, 177, + "incorrect value for cn0, expected 177, is {}", + msg.cn0 + ); + assert_eq!( + msg.corr_spacing, 40, + "incorrect value for corr_spacing, expected 40, is {}", + msg.corr_spacing + ); + assert_eq!( + msg.doppler, 15701, + "incorrect value for doppler, expected 15701, is {}", + msg.doppler + ); + assert_eq!( + msg.doppler_std, 39, + "incorrect value for doppler_std, expected 39, is {}", + msg.doppler_std + ); + assert_eq!( + msg.lock, 14032, + "incorrect value for lock, expected 14032, is {}", + msg.lock + ); + assert_eq!( + msg.misc_flags, 9, + "incorrect value for misc_flags, expected 9, is {}", + msg.misc_flags + ); + assert_eq!( + msg.nav_flags, 0, + "incorrect value for nav_flags, expected 0, is {}", + msg.nav_flags + ); + assert_eq!( + msg.pset_flags, 0, + "incorrect value for pset_flags, expected 0, is {}", + msg.pset_flags + ); + assert_eq!( + msg.recv_time, 7909447587, + "incorrect value for recv_time, expected 7909447587, is {}", + msg.recv_time + ); + assert_eq!( + msg.sid.code, 0, + "incorrect value for sid.code, expected 0, is {}", + msg.sid.code + ); + assert_eq!( + msg.sid.reserved, 0, + "incorrect value for sid.reserved, expected 0, is {}", + msg.sid.reserved + ); + assert_eq!( + msg.sid.sat, 15, + "incorrect value for sid.sat, expected 15, is {}", + msg.sid.sat + ); + assert_eq!( + msg.sync_flags, 1, + "incorrect value for sync_flags, expected 1, is {}", + msg.sync_flags + ); + assert_eq!( + msg.tot.tow, 0, + "incorrect value for tot.tow, expected 0, is {}", + msg.tot.tow + ); + assert_eq!( + msg.tot.wn, 0, + "incorrect value for tot.wn, expected 0, is {}", + msg.tot.wn + ); + assert_eq!( + msg.tow_flags, 0, + "incorrect value for tow_flags, expected 0, is {}", + msg.tow_flags + ); + assert_eq!( + msg.track_flags, 11, + "incorrect value for track_flags, expected 11, is {}", + msg.track_flags + ); + assert_eq!( + msg.uptime, 1, + "incorrect value for uptime, expected 1, is {}", + msg.uptime + ); + } + _ => panic!("Invalid message type! Expected a MsgTrackingStateDetailedDep"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 17, 0, 59, 103, 55, 97, 251, 61, 245, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 18, 7, 0, 0, 14, 175, 208, 54, 15, 0, 0, 0, 51, 61, 0, 0, 30, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 40, 0, 224, 1, 0, 11, 0, 0, 9, 136, 179, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgTrackingStateDetailedDep(msg) => { + assert_eq!( + msg.get_message_type(), + 0x11, + "Incorrect message type, expected 0x11, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x673b, + "incorrect sender id, expected 0x673b, is {}", + sender_id + ); + assert_eq!( + msg.L.f, 14, + "incorrect value for L.f, expected 14, is {}", + msg.L.f + ); + assert_eq!( + msg.L.i, 1810, + "incorrect value for L.i, expected 1810, is {}", + msg.L.i + ); + assert_eq!(msg.P, 0, "incorrect value for P, expected 0, is {}", msg.P); + assert_eq!( + msg.P_std, 0, + "incorrect value for P_std, expected 0, is {}", + msg.P_std + ); + assert_eq!( + msg.acceleration, -32, + "incorrect value for acceleration, expected -32, is {}", + msg.acceleration + ); + assert_eq!( + msg.clock_drift, 0, + "incorrect value for clock_drift, expected 0, is {}", + msg.clock_drift + ); + assert_eq!( + msg.clock_offset, 0, + "incorrect value for clock_offset, expected 0, is {}", + msg.clock_offset + ); + assert_eq!( + msg.cn0, 175, + "incorrect value for cn0, expected 175, is {}", + msg.cn0 + ); + assert_eq!( + msg.corr_spacing, 40, + "incorrect value for corr_spacing, expected 40, is {}", + msg.corr_spacing + ); + assert_eq!( + msg.doppler, 15667, + "incorrect value for doppler, expected 15667, is {}", + msg.doppler + ); + assert_eq!( + msg.doppler_std, 30, + "incorrect value for doppler_std, expected 30, is {}", + msg.doppler_std + ); + assert_eq!( + msg.lock, 14032, + "incorrect value for lock, expected 14032, is {}", + msg.lock + ); + assert_eq!( + msg.misc_flags, 9, + "incorrect value for misc_flags, expected 9, is {}", + msg.misc_flags + ); + assert_eq!( + msg.nav_flags, 0, + "incorrect value for nav_flags, expected 0, is {}", + msg.nav_flags + ); + assert_eq!( + msg.pset_flags, 0, + "incorrect value for pset_flags, expected 0, is {}", + msg.pset_flags + ); + assert_eq!( + msg.recv_time, 8409447265, + "incorrect value for recv_time, expected 8409447265, is {}", + msg.recv_time + ); + assert_eq!( + msg.sid.code, 0, + "incorrect value for sid.code, expected 0, is {}", + msg.sid.code + ); + assert_eq!( + msg.sid.reserved, 0, + "incorrect value for sid.reserved, expected 0, is {}", + msg.sid.reserved + ); + assert_eq!( + msg.sid.sat, 15, + "incorrect value for sid.sat, expected 15, is {}", + msg.sid.sat + ); + assert_eq!( + msg.sync_flags, 1, + "incorrect value for sync_flags, expected 1, is {}", + msg.sync_flags + ); + assert_eq!( + msg.tot.tow, 0, + "incorrect value for tot.tow, expected 0, is {}", + msg.tot.tow + ); + assert_eq!( + msg.tot.wn, 0, + "incorrect value for tot.wn, expected 0, is {}", + msg.tot.wn + ); + assert_eq!( + msg.tow_flags, 0, + "incorrect value for tow_flags, expected 0, is {}", + msg.tow_flags + ); + assert_eq!( + msg.track_flags, 11, + "incorrect value for track_flags, expected 11, is {}", + msg.track_flags + ); + assert_eq!( + msg.uptime, 1, + "incorrect value for uptime, expected 1, is {}", + msg.uptime + ); + } + _ => panic!("Invalid message type! Expected a MsgTrackingStateDetailedDep"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 17, 0, 59, 103, 55, 139, 218, 236, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 250, 8, 0, 0, 8, 179, 208, 54, 15, 0, 0, 0, 67, 61, 0, 0, 22, 0, 2, 0, 0, 0, 0, 0, + 0, 0, 40, 0, 27, 1, 0, 11, 0, 2, 9, 217, 159, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgTrackingStateDetailedDep(msg) => { + assert_eq!( + msg.get_message_type(), + 0x11, + "Incorrect message type, expected 0x11, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x673b, + "incorrect sender id, expected 0x673b, is {}", + sender_id + ); + assert_eq!( + msg.L.f, 8, + "incorrect value for L.f, expected 8, is {}", + msg.L.f + ); + assert_eq!( + msg.L.i, 2298, + "incorrect value for L.i, expected 2298, is {}", + msg.L.i + ); + assert_eq!(msg.P, 0, "incorrect value for P, expected 0, is {}", msg.P); + assert_eq!( + msg.P_std, 0, + "incorrect value for P_std, expected 0, is {}", + msg.P_std + ); + assert_eq!( + msg.acceleration, 27, + "incorrect value for acceleration, expected 27, is {}", + msg.acceleration + ); + assert_eq!( + msg.clock_drift, 0, + "incorrect value for clock_drift, expected 0, is {}", + msg.clock_drift + ); + assert_eq!( + msg.clock_offset, 0, + "incorrect value for clock_offset, expected 0, is {}", + msg.clock_offset + ); + assert_eq!( + msg.cn0, 179, + "incorrect value for cn0, expected 179, is {}", + msg.cn0 + ); + assert_eq!( + msg.corr_spacing, 40, + "incorrect value for corr_spacing, expected 40, is {}", + msg.corr_spacing + ); + assert_eq!( + msg.doppler, 15683, + "incorrect value for doppler, expected 15683, is {}", + msg.doppler + ); + assert_eq!( + msg.doppler_std, 22, + "incorrect value for doppler_std, expected 22, is {}", + msg.doppler_std + ); + assert_eq!( + msg.lock, 14032, + "incorrect value for lock, expected 14032, is {}", + msg.lock + ); + assert_eq!( + msg.misc_flags, 9, + "incorrect value for misc_flags, expected 9, is {}", + msg.misc_flags + ); + assert_eq!( + msg.nav_flags, 0, + "incorrect value for nav_flags, expected 0, is {}", + msg.nav_flags + ); + assert_eq!( + msg.pset_flags, 2, + "incorrect value for pset_flags, expected 2, is {}", + msg.pset_flags + ); + assert_eq!( + msg.recv_time, 8907446923, + "incorrect value for recv_time, expected 8907446923, is {}", + msg.recv_time + ); + assert_eq!( + msg.sid.code, 0, + "incorrect value for sid.code, expected 0, is {}", + msg.sid.code + ); + assert_eq!( + msg.sid.reserved, 0, + "incorrect value for sid.reserved, expected 0, is {}", + msg.sid.reserved + ); + assert_eq!( + msg.sid.sat, 15, + "incorrect value for sid.sat, expected 15, is {}", + msg.sid.sat + ); + assert_eq!( + msg.sync_flags, 1, + "incorrect value for sync_flags, expected 1, is {}", + msg.sync_flags + ); + assert_eq!( + msg.tot.tow, 0, + "incorrect value for tot.tow, expected 0, is {}", + msg.tot.tow + ); + assert_eq!( + msg.tot.wn, 0, + "incorrect value for tot.wn, expected 0, is {}", + msg.tot.wn + ); + assert_eq!( + msg.tow_flags, 0, + "incorrect value for tow_flags, expected 0, is {}", + msg.tow_flags + ); + assert_eq!( + msg.track_flags, 11, + "incorrect value for track_flags, expected 11, is {}", + msg.track_flags + ); + assert_eq!( + msg.uptime, 2, + "incorrect value for uptime, expected 2, is {}", + msg.uptime + ); + } + _ => panic!("Invalid message type! Expected a MsgTrackingStateDetailedDep"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 17, 0, 59, 103, 55, 255, 251, 170, 48, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 226, 10, 0, 0, 125, 181, 208, 54, 15, 0, 0, 0, 29, 61, 0, 0, 10, 0, 2, 0, 0, 0, 0, + 0, 0, 0, 40, 0, 220, 1, 0, 11, 0, 3, 9, 66, 95, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgTrackingStateDetailedDep(msg) => { + assert_eq!( + msg.get_message_type(), + 0x11, + "Incorrect message type, expected 0x11, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x673b, + "incorrect sender id, expected 0x673b, is {}", + sender_id + ); + assert_eq!( + msg.L.f, 125, + "incorrect value for L.f, expected 125, is {}", + msg.L.f + ); + assert_eq!( + msg.L.i, 2786, + "incorrect value for L.i, expected 2786, is {}", + msg.L.i + ); + assert_eq!(msg.P, 0, "incorrect value for P, expected 0, is {}", msg.P); + assert_eq!( + msg.P_std, 0, + "incorrect value for P_std, expected 0, is {}", + msg.P_std + ); + assert_eq!( + msg.acceleration, -36, + "incorrect value for acceleration, expected -36, is {}", + msg.acceleration + ); + assert_eq!( + msg.clock_drift, 0, + "incorrect value for clock_drift, expected 0, is {}", + msg.clock_drift + ); + assert_eq!( + msg.clock_offset, 0, + "incorrect value for clock_offset, expected 0, is {}", + msg.clock_offset + ); + assert_eq!( + msg.cn0, 181, + "incorrect value for cn0, expected 181, is {}", + msg.cn0 + ); + assert_eq!( + msg.corr_spacing, 40, + "incorrect value for corr_spacing, expected 40, is {}", + msg.corr_spacing + ); + assert_eq!( + msg.doppler, 15645, + "incorrect value for doppler, expected 15645, is {}", + msg.doppler + ); + assert_eq!( + msg.doppler_std, 10, + "incorrect value for doppler_std, expected 10, is {}", + msg.doppler_std + ); + assert_eq!( + msg.lock, 14032, + "incorrect value for lock, expected 14032, is {}", + msg.lock + ); + assert_eq!( + msg.misc_flags, 9, + "incorrect value for misc_flags, expected 9, is {}", + msg.misc_flags + ); + assert_eq!( + msg.nav_flags, 0, + "incorrect value for nav_flags, expected 0, is {}", + msg.nav_flags + ); + assert_eq!( + msg.pset_flags, 3, + "incorrect value for pset_flags, expected 3, is {}", + msg.pset_flags + ); + assert_eq!( + msg.recv_time, 9406446591, + "incorrect value for recv_time, expected 9406446591, is {}", + msg.recv_time + ); + assert_eq!( + msg.sid.code, 0, + "incorrect value for sid.code, expected 0, is {}", + msg.sid.code + ); + assert_eq!( + msg.sid.reserved, 0, + "incorrect value for sid.reserved, expected 0, is {}", + msg.sid.reserved + ); + assert_eq!( + msg.sid.sat, 15, + "incorrect value for sid.sat, expected 15, is {}", + msg.sid.sat + ); + assert_eq!( + msg.sync_flags, 1, + "incorrect value for sync_flags, expected 1, is {}", + msg.sync_flags + ); + assert_eq!( + msg.tot.tow, 0, + "incorrect value for tot.tow, expected 0, is {}", + msg.tot.tow + ); + assert_eq!( + msg.tot.wn, 0, + "incorrect value for tot.wn, expected 0, is {}", + msg.tot.wn + ); + assert_eq!( + msg.tow_flags, 0, + "incorrect value for tow_flags, expected 0, is {}", + msg.tow_flags + ); + assert_eq!( + msg.track_flags, 11, + "incorrect value for track_flags, expected 11, is {}", + msg.track_flags + ); + assert_eq!( + msg.uptime, 2, + "incorrect value for uptime, expected 2, is {}", + msg.uptime + ); + } + _ => panic!("Invalid message type! Expected a MsgTrackingStateDetailedDep"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } + { + let payload: Vec = vec![ + 85, 17, 0, 59, 103, 55, 189, 95, 120, 78, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 203, 12, 0, 0, 64, 184, 208, 54, 15, 0, 0, 0, 24, 61, 0, 0, 4, 0, 3, 0, 0, 0, 0, 0, + 0, 0, 40, 0, 2, 1, 0, 11, 0, 3, 9, 194, 206, + ]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgTrackingStateDetailedDep(msg) => { + assert_eq!( + msg.get_message_type(), + 0x11, + "Incorrect message type, expected 0x11, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x673b, + "incorrect sender id, expected 0x673b, is {}", + sender_id + ); + assert_eq!( + msg.L.f, 64, + "incorrect value for L.f, expected 64, is {}", + msg.L.f + ); + assert_eq!( + msg.L.i, 3275, + "incorrect value for L.i, expected 3275, is {}", + msg.L.i + ); + assert_eq!(msg.P, 0, "incorrect value for P, expected 0, is {}", msg.P); + assert_eq!( + msg.P_std, 0, + "incorrect value for P_std, expected 0, is {}", + msg.P_std + ); + assert_eq!( + msg.acceleration, 2, + "incorrect value for acceleration, expected 2, is {}", + msg.acceleration + ); + assert_eq!( + msg.clock_drift, 0, + "incorrect value for clock_drift, expected 0, is {}", + msg.clock_drift + ); + assert_eq!( + msg.clock_offset, 0, + "incorrect value for clock_offset, expected 0, is {}", + msg.clock_offset + ); + assert_eq!( + msg.cn0, 184, + "incorrect value for cn0, expected 184, is {}", + msg.cn0 + ); + assert_eq!( + msg.corr_spacing, 40, + "incorrect value for corr_spacing, expected 40, is {}", + msg.corr_spacing + ); + assert_eq!( + msg.doppler, 15640, + "incorrect value for doppler, expected 15640, is {}", + msg.doppler + ); + assert_eq!( + msg.doppler_std, 4, + "incorrect value for doppler_std, expected 4, is {}", + msg.doppler_std + ); + assert_eq!( + msg.lock, 14032, + "incorrect value for lock, expected 14032, is {}", + msg.lock + ); + assert_eq!( + msg.misc_flags, 9, + "incorrect value for misc_flags, expected 9, is {}", + msg.misc_flags + ); + assert_eq!( + msg.nav_flags, 0, + "incorrect value for nav_flags, expected 0, is {}", + msg.nav_flags + ); + assert_eq!( + msg.pset_flags, 3, + "incorrect value for pset_flags, expected 3, is {}", + msg.pset_flags + ); + assert_eq!( + msg.recv_time, 9906446269, + "incorrect value for recv_time, expected 9906446269, is {}", + msg.recv_time + ); + assert_eq!( + msg.sid.code, 0, + "incorrect value for sid.code, expected 0, is {}", + msg.sid.code + ); + assert_eq!( + msg.sid.reserved, 0, + "incorrect value for sid.reserved, expected 0, is {}", + msg.sid.reserved + ); + assert_eq!( + msg.sid.sat, 15, + "incorrect value for sid.sat, expected 15, is {}", + msg.sid.sat + ); + assert_eq!( + msg.sync_flags, 1, + "incorrect value for sync_flags, expected 1, is {}", + msg.sync_flags + ); + assert_eq!( + msg.tot.tow, 0, + "incorrect value for tot.tow, expected 0, is {}", + msg.tot.tow + ); + assert_eq!( + msg.tot.wn, 0, + "incorrect value for tot.wn, expected 0, is {}", + msg.tot.wn + ); + assert_eq!( + msg.tow_flags, 0, + "incorrect value for tow_flags, expected 0, is {}", + msg.tow_flags + ); + assert_eq!( + msg.track_flags, 11, + "incorrect value for track_flags, expected 11, is {}", + msg.track_flags + ); + assert_eq!( + msg.uptime, 3, + "incorrect value for uptime, expected 3, is {}", + msg.uptime + ); + } + _ => panic!("Invalid message type! Expected a MsgTrackingStateDetailedDep"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } +} diff --git a/rust/sbp/tests/auto_check_sbp_vehicle_51.rs b/rust/sbp/tests/auto_check_sbp_vehicle_51.rs new file mode 100644 index 0000000000..112cf247f9 --- /dev/null +++ b/rust/sbp/tests/auto_check_sbp_vehicle_51.rs @@ -0,0 +1,67 @@ +// +// Copyright (C) 2019 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. + +// This file was auto-generated from spec/tests/yaml/swiftnav/sbp/vehicle/test_MsgOdometry.yaml by generate.py. Do not modify by hand! + +extern crate sbp; +use sbp::messages::SBPMessage; + +mod common; +#[allow(unused_imports)] +use common::AlmostEq; + +#[test] +fn test_auto_check_sbp_vehicle_51() { + { + let payload: Vec = vec![85, 3, 9, 66, 0, 9, 8, 0, 0, 0, 7, 0, 0, 0, 1, 52, 99]; + + // Test the round trip payload parsing + let mut parser = sbp::parser::Parser::new(); + let msg_result = parser.parse(&mut &payload[..]); + assert!(msg_result.is_ok()); + let sbp_msg = msg_result.unwrap(); + match &sbp_msg { + sbp::messages::SBP::MsgOdometry(msg) => { + assert_eq!( + msg.get_message_type(), + 0x903, + "Incorrect message type, expected 0x903, is {}", + msg.get_message_type() + ); + let sender_id = msg.get_sender_id().unwrap(); + assert_eq!( + sender_id, 0x42, + "incorrect sender id, expected 0x42, is {}", + sender_id + ); + assert_eq!( + msg.flags, 1, + "incorrect value for flags, expected 1, is {}", + msg.flags + ); + assert_eq!( + msg.tow, 8, + "incorrect value for tow, expected 8, is {}", + msg.tow + ); + assert_eq!( + msg.velocity, 7, + "incorrect value for velocity, expected 7, is {}", + msg.velocity + ); + } + _ => panic!("Invalid message type! Expected a MsgOdometry"), + }; + + let frame = sbp::framer::to_frame(sbp_msg.as_sbp_message()).unwrap(); + assert_eq!(frame, payload); + } +} diff --git a/spec/yaml/swiftnav/sbp/imu.yaml b/spec/yaml/swiftnav/sbp/imu.yaml index 92c8532e95..a9dea5de62 100644 --- a/spec/yaml/swiftnav/sbp/imu.yaml +++ b/spec/yaml/swiftnav/sbp/imu.yaml @@ -26,7 +26,7 @@ definitions: device hardware and settings, are communicated via the MSG_IMU_AUX message. If using "time since startup" time tags, the receiving end will expect a `MSG_GNSS_TIME_OFFSET` when a PVT fix becomes available to synchronise IMU measurements - with GNSS. + with GNSS. The timestamp must wrap around to zero when reaching one week (604800 seconds). The time-tagging mode should not change throughout a run. fields: diff --git a/spec/yaml/swiftnav/sbp/system.yaml b/spec/yaml/swiftnav/sbp/system.yaml index 58331d261d..fd3f069f7c 100644 --- a/spec/yaml/swiftnav/sbp/system.yaml +++ b/spec/yaml/swiftnav/sbp/system.yaml @@ -188,6 +188,8 @@ definitions: - 1: Dynamically aligning - 2: Ready - 3: GNSS Outage exceeds max duration + - 4: FastStart seeding + - 5: FastStart validating - MSG_CSAC_TELEMETRY: id: 0xFF04