add transaction params struct

This commit is contained in:
Robin Müller 2023-07-26 23:33:54 +02:00
parent c0e1cb8bcf
commit 0ea0f90b25
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -1,6 +1,9 @@
use super::{State, TransactionStep}; use super::{State, TransactionStep};
use spacepackets::cfdp::{ use spacepackets::cfdp::{
pdu::{metadata::MetadataPdu, CommonPduConfig, FileDirectiveType, PduError}, pdu::{
metadata::{MetadataGenericParams, MetadataPdu},
CommonPduConfig, FileDirectiveType, PduError,
},
PduType, PduType,
}; };
@ -8,6 +11,12 @@ pub struct DestinationHandler {
step: TransactionStep, step: TransactionStep,
state: State, state: State,
pdu_conf: CommonPduConfig, pdu_conf: CommonPduConfig,
transaction_params: TransactionParams,
}
#[derive(Default)]
struct TransactionParams {
metadata_params: MetadataGenericParams,
} }
#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[derive(Debug, PartialEq, Eq, Clone, Copy)]
@ -32,6 +41,7 @@ impl DestinationHandler {
step: TransactionStep::Idle, step: TransactionStep::Idle,
state: State::Idle, state: State::Idle,
pdu_conf: CommonPduConfig::new_with_defaults(), pdu_conf: CommonPduConfig::new_with_defaults(),
transaction_params: Default::default(),
} }
} }
@ -86,8 +96,7 @@ impl DestinationHandler {
return Err(DestError::RecvdMetadataButIsBusy); return Err(DestError::RecvdMetadataButIsBusy);
} }
let metadata_pdu = MetadataPdu::from_bytes(raw_packet)?; let metadata_pdu = MetadataPdu::from_bytes(raw_packet)?;
let params = metadata_pdu.metadata_params(); self.transaction_params.metadata_params = *metadata_pdu.metadata_params();
Ok(()) Ok(())
} }