CFDP destination handler #62

Merged
muellerr merged 49 commits from cfdp-state-machines into main 2023-09-21 18:47:07 +02:00
Showing only changes of commit 2213a25508 - Show all commits

View File

@ -1,6 +1,5 @@
use spacepackets::cfdp::{pdu::FileDirectiveType, PduType};
use super::{State, TransactionStep};
use spacepackets::cfdp::{pdu::FileDirectiveType, PduType};
pub struct DestinationHandler {
step: TransactionStep,
@ -13,8 +12,29 @@ impl DestinationHandler {
pdu_type: PduType,
pdu_directive: Option<FileDirectiveType>,
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) {
match self.state {
State::Idle => todo!(),