From 3b5aa8c1eb76938152c682662d3ebc30f1497da8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 4 Jan 2023 14:39:56 +0100 Subject: [PATCH] cargo update and completed new send API --- Cargo.lock | 98 +++++++++++++++--------------- satrs-core/src/pus/verification.rs | 69 ++++++++++++++++++++- 2 files changed, 117 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ac9f18c..b1729d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,9 +204,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.83" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf07d07d6531bfcdbe9b8b739b104610c6508dcc4d63b410585faf338241daf" +checksum = "5add3fc1717409d029b20c5b6903fc0c0b02fa6741d820054f4a2efa5e5816fd" dependencies = [ "cc", "cxxbridge-flags", @@ -216,9 +216,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.83" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2eb5b96ecdc99f72657332953d4d9c50135af1bac34277801cc3937906ebd39" +checksum = "b4c87959ba14bc6fbc61df77c3fcfe180fc32b93538c4f1031dd802ccb5f2ff0" dependencies = [ "cc", "codespan-reporting", @@ -231,15 +231,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.83" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac040a39517fd1674e0f32177648334b0f4074625b5588a64519804ba0553b12" +checksum = "69a3e162fde4e594ed2b07d0f83c6c67b745e7f28ce58c6df5e6b6bef99dfb59" [[package]] name = "cxxbridge-macro" -version = "1.0.83" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1362b0ddcfc4eb0a1f57b68bd77dd99f0e826958a96abd0ae9bd092e114ffed6" +checksum = "3e7e2adeb6a0d4a282e581096b06e1791532b7d576dcde5ccd9382acf55db8e6" dependencies = [ "proc-macro2", "quote", @@ -259,9 +259,9 @@ dependencies = [ [[package]] name = "dissimilar" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c97b9233581d84b8e1e689cdd3a47b6f69770084fc246e86a7f78b0d9c1d4a5" +checksum = "bd5f0c7e4bd266b8ab2550e6238d2e74977c23c15536ac7be45e9c95e2e3fbbb" [[package]] name = "downcast-rs" @@ -271,9 +271,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "dyn-clone" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" +checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" [[package]] name = "embed-doc-image" @@ -327,9 +327,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" dependencies = [ "libc", ] @@ -366,9 +366,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "js-sys" @@ -387,15 +387,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.138" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "link-cplusplus" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" dependencies = [ "cc", ] @@ -458,9 +458,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ "hermit-abi", "libc", @@ -468,9 +468,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "parking_lot_core" @@ -487,9 +487,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1c2c742266c2f1041c914ba65355a83ae8747b05f208319784083583494b4b" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" [[package]] name = "postcard" @@ -504,18 +504,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -546,9 +546,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "satrs-core" @@ -616,21 +616,21 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" [[package]] name = "semver" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" [[package]] name = "serde" -version = "1.0.151" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fed41fc1a24994d044e6db6935e69511a1153b52c15eb42493b26fa87feba0" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] @@ -648,9 +648,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.151" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "255abe9a125a985c05190d687b320c12f9b1f0b99445e608c21ba0782c719ad8" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -659,11 +659,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.89" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" dependencies = [ - "itoa 1.0.4", + "itoa 1.0.5", "ryu", "serde", ] @@ -726,9 +726,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "syn" -version = "1.0.105" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", "quote", @@ -755,9 +755,9 @@ dependencies = [ [[package]] name = "trybuild" -version = "1.0.72" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db29f438342820400f2d9acfec0d363e987a38b2950bdb50a7069ed17b2148ee" +checksum = "ed01de3de062db82c0920b5cabe804f88d599a3f217932292597c678c903754d" dependencies = [ "dissimilar", "glob", @@ -771,9 +771,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-width" diff --git a/satrs-core/src/pus/verification.rs b/satrs-core/src/pus/verification.rs index c092a7b..99f39d1 100644 --- a/satrs-core/src/pus/verification.rs +++ b/satrs-core/src/pus/verification.rs @@ -523,7 +523,7 @@ impl VerificationReporterCore { ) } - pub fn send_acceptance<'src_data, E>( + pub fn send_acceptance_success<'src_data, E>( &self, mut sendable: VerificationSendable<'src_data, TcStateNone, VerifSuccess>, seq_counter: &(impl SequenceCountProviderCore + ?Sized), @@ -536,6 +536,19 @@ impl VerificationReporterCore { Ok(sendable.send_success_acceptance_success(Some(seq_counter))) } + pub fn send_acceptance_failure<'src_data, E>( + &self, + mut sendable: VerificationSendable<'src_data, TcStateNone, VerifFailure>, + seq_counter: &(impl SequenceCountProviderCore + ?Sized), + sender: &mut (impl EcssTmSenderCore + ?Sized), + ) -> Result<(), VerificationOrSendErrorWithToken> { + sender + .send_tm(sendable.pus_tm.take().unwrap()) + .map_err(|e| VerificationOrSendErrorWithToken(e, sendable.token.unwrap()))?; + sendable.send_success_verif_failure(Some(seq_counter)); + Ok(()) + } + /// Package a PUS TM\[1, 2\] packet, see 8.1.2.2 of the PUS standard. pub fn acceptance_failure<'src_data>( &mut self, @@ -579,6 +592,21 @@ impl VerificationReporterCore { ) } + pub fn send_start_success<'src_data, E>( + &self, + mut sendable: VerificationSendable<'src_data, TcStateAccepted, VerifSuccess>, + seq_counter: &(impl SequenceCountProviderCore + ?Sized), + sender: &mut (impl EcssTmSenderCore + ?Sized), + ) -> Result< + VerificationToken, + VerificationOrSendErrorWithToken, + > { + sender + .send_tm(sendable.pus_tm.take().unwrap()) + .map_err(|e| VerificationOrSendErrorWithToken(e, sendable.token.unwrap()))?; + Ok(sendable.send_success_start_success(Some(seq_counter))) + } + /// Package and send a PUS TM\[1, 4\] packet, see 8.1.2.4 of the PUS standard. /// /// Requires a token previously acquired by calling [Self::acceptance_success]. It consumes @@ -603,6 +631,19 @@ impl VerificationReporterCore { ) } + pub fn send_start_failure<'src_data, E>( + &self, + mut sendable: VerificationSendable<'src_data, TcStateAccepted, VerifFailure>, + seq_counter: &(impl SequenceCountProviderCore + ?Sized), + sender: &mut (impl EcssTmSenderCore + ?Sized), + ) -> Result<(), VerificationOrSendErrorWithToken> { + sender + .send_tm(sendable.pus_tm.take().unwrap()) + .map_err(|e| VerificationOrSendErrorWithToken(e, sendable.token.unwrap()))?; + sendable.send_success_verif_failure(Some(seq_counter)); + Ok(()) + } + /// Package and send a PUS TM\[1, 5\] packet, see 8.1.2.5 of the PUS standard. /// /// Requires a token previously acquired by calling [Self::start_success]. @@ -701,6 +742,32 @@ impl VerificationReporterCore { ) } + pub fn send_step_or_completion_success<'src_data, E>( + &self, + mut sendable: VerificationSendable<'src_data, TcStateStarted, VerifSuccess>, + seq_counter: &(impl SequenceCountProviderCore + ?Sized), + sender: &mut (impl EcssTmSenderCore + ?Sized), + ) -> Result<(), VerificationOrSendErrorWithToken> { + sender + .send_tm(sendable.pus_tm.take().unwrap()) + .map_err(|e| VerificationOrSendErrorWithToken(e, sendable.token.unwrap()))?; + sendable.send_success_step_or_completion_success(Some(seq_counter)); + Ok(()) + } + + pub fn send_step_or_completion_failure<'src_data, E>( + &self, + mut sendable: VerificationSendable<'src_data, TcStateStarted, VerifFailure>, + seq_counter: &(impl SequenceCountProviderCore + ?Sized), + sender: &mut (impl EcssTmSenderCore + ?Sized), + ) -> Result<(), VerificationOrSendErrorWithToken> { + sender + .send_tm(sendable.pus_tm.take().unwrap()) + .map_err(|e| VerificationOrSendErrorWithToken(e, sendable.token.unwrap()))?; + sendable.send_success_verif_failure(Some(seq_counter)); + Ok(()) + } + fn create_pus_verif_success_tm<'src_data>( &mut self, src_data_buf: &'src_data mut [u8],