From beebf0056554b6055f1988affa1d6d4b474763e4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 21 Jul 2023 21:36:21 +0200 Subject: [PATCH] continue --- satrs-core/src/cfdp/dest.rs | 24 ++++++++++++++++++------ satrs-core/src/cfdp/mod.rs | 5 ++--- satrs-core/src/lib.rs | 2 +- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/satrs-core/src/cfdp/dest.rs b/satrs-core/src/cfdp/dest.rs index 13e5cbe..09e21fa 100644 --- a/satrs-core/src/cfdp/dest.rs +++ b/satrs-core/src/cfdp/dest.rs @@ -1,13 +1,25 @@ -use super::{TransactionStep, State}; +use spacepackets::cfdp::{pdu::FileDirectiveType, PduType}; + +use super::{State, TransactionStep}; pub struct DestinationHandler { step: TransactionStep, - state: State + state: State, } impl DestinationHandler { - - pub fn state_machine() {} - - + pub fn insert_packet( + &mut self, + pdu_type: PduType, + pdu_directive: Option, + raw_packet: &[u8], + ) { + } + pub fn state_machine(&mut self) { + match self.state { + State::Idle => todo!(), + State::BusyClass1Nacked => todo!(), + State::BusyClass2Acked => todo!(), + } + } } diff --git a/satrs-core/src/cfdp/mod.rs b/satrs-core/src/cfdp/mod.rs index f62bd14..811c820 100644 --- a/satrs-core/src/cfdp/mod.rs +++ b/satrs-core/src/cfdp/mod.rs @@ -7,7 +7,7 @@ pub enum TransactionStep { ReceivingFileDataPdus = 2, SendingAckPdu = 3, TransferCompletion = 4, - SendingFinishedPdu = 5 + SendingFinishedPdu = 5, } #[derive(Copy, Clone, PartialEq, Eq)] @@ -20,6 +20,5 @@ pub enum State { #[cfg(test)] mod tests { #[test] - fn basic_test() { - } + fn basic_test() {} } diff --git a/satrs-core/src/lib.rs b/satrs-core/src/lib.rs index 6484cc8..949ffa5 100644 --- a/satrs-core/src/lib.rs +++ b/satrs-core/src/lib.rs @@ -20,6 +20,7 @@ extern crate downcast_rs; #[cfg(any(feature = "std", test))] extern crate std; +pub mod cfdp; pub mod error; #[cfg(feature = "alloc")] #[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))] @@ -40,7 +41,6 @@ pub mod request; pub mod res_code; pub mod seq_count; pub mod tmtc; -pub mod cfdp; pub use spacepackets;