how to best do this..
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2023-07-22 18:46:12 +02:00
parent beebf00565
commit 2213a25508
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -1,6 +1,5 @@
use spacepackets::cfdp::{pdu::FileDirectiveType, PduType};
use super::{State, TransactionStep}; use super::{State, TransactionStep};
use spacepackets::cfdp::{pdu::FileDirectiveType, PduType};
pub struct DestinationHandler { pub struct DestinationHandler {
step: TransactionStep, step: TransactionStep,
@ -13,8 +12,29 @@ impl DestinationHandler {
pdu_type: PduType, pdu_type: PduType,
pdu_directive: Option<FileDirectiveType>, pdu_directive: Option<FileDirectiveType>,
raw_packet: &[u8], raw_packet: &[u8],
) { ) -> Result<(), ()> {
match pdu_type {
PduType::FileDirective => {
if pdu_directive.is_none() {
return Err(());
} }
self.handle_file_directive(pdu_directive.unwrap(), raw_packet)
}
PduType::FileData => self.handle_file_data(raw_packet),
}
}
pub fn handle_file_data(&mut self, raw_packet: &[u8]) -> Result<(), ()> {
Ok(())
}
pub fn handle_file_directive(
&mut self,
pdu_directive: FileDirectiveType,
raw_packet: &[u8],
) -> Result<(), ()> {
Ok(())
}
pub fn state_machine(&mut self) { pub fn state_machine(&mut self) {
match self.state { match self.state {
State::Idle => todo!(), State::Idle => todo!(),