this is tricky
Some checks failed
Rust/sat-rs/pipeline/head There was a failure building this commit
Some checks failed
Rust/sat-rs/pipeline/head There was a failure building this commit
This commit is contained in:
parent
5f227d1a20
commit
62c9d13cec
@ -39,7 +39,7 @@ impl PusService5EventHandler {
|
||||
}
|
||||
|
||||
pub fn handle_one_tc(&mut self) -> Result<PusPacketHandlerResult, PusPacketHandlingError> {
|
||||
let possible_packet = self.psb.retrieve_next_packet()?;
|
||||
let possible_packet = self.psb.retrieve_and_accept_next_packet()?;
|
||||
if possible_packet.is_none() {
|
||||
return Ok(PusPacketHandlerResult::Empty);
|
||||
}
|
||||
|
@ -200,8 +200,15 @@ pub trait EcssTcSenderCore: EcssChannel {
|
||||
fn send_tc(&self, tc: PusTcCreator, token: Option<TcStateToken>) -> Result<(), EcssTmtcError>;
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
pub enum TcInMemory {
|
||||
StoreAddr(StoreAddr),
|
||||
#[cfg(feature = "alloc")]
|
||||
Vec(alloc::vec::Vec<u8>),
|
||||
}
|
||||
|
||||
pub struct ReceivedTcWrapper {
|
||||
pub store_addr: StoreAddr,
|
||||
pub store_addr: TcInMemory,
|
||||
pub token: Option<TcStateToken>,
|
||||
}
|
||||
|
||||
@ -335,6 +342,8 @@ pub mod std_mod {
|
||||
use std::sync::mpsc::TryRecvError;
|
||||
use thiserror::Error;
|
||||
|
||||
use super::TcInMemory;
|
||||
|
||||
impl From<mpsc::SendError<StoreAddr>> for EcssTmtcError {
|
||||
fn from(_: mpsc::SendError<StoreAddr>) -> Self {
|
||||
Self::Send(GenericSendError::RxDisconnected)
|
||||
@ -703,17 +712,25 @@ pub mod std_mod {
|
||||
|
||||
pub fn retrieve_next_packet(
|
||||
&mut self,
|
||||
) -> Result<Option<(StoreAddr, VerificationToken<TcStateAccepted>)>, PusPacketHandlingError>
|
||||
handle_acceptance: bool,
|
||||
) -> Result<Option<ReceivedTcWrapper>,PusPacketHandlingError>
|
||||
{
|
||||
match self.tc_receiver.recv_tc() {
|
||||
Ok(ReceivedTcWrapper { store_addr, token }) => {
|
||||
if token.is_none() {
|
||||
return Err(PusPacketHandlingError::InvalidVerificationToken);
|
||||
let mut passed_token = token;
|
||||
if handle_acceptance {
|
||||
if token.is_none() {
|
||||
return Err(PusPacketHandlingError::InvalidVerificationToken);
|
||||
}
|
||||
let token = token.unwrap();
|
||||
let accepted_token = VerificationToken::<TcStateAccepted>::try_from(token)
|
||||
.map_err(|_| PusPacketHandlingError::InvalidVerificationToken)?;
|
||||
passed_token = Some(accepted_token.into());
|
||||
}
|
||||
let token = token.unwrap();
|
||||
let accepted_token = VerificationToken::<TcStateAccepted>::try_from(token)
|
||||
.map_err(|_| PusPacketHandlingError::InvalidVerificationToken)?;
|
||||
Ok(Some((store_addr, accepted_token)))
|
||||
Ok(Some(ReceivedTcWrapper {
|
||||
store_addr,
|
||||
token: passed_token
|
||||
}))
|
||||
}
|
||||
Err(e) => match e {
|
||||
TryRecvTmtcError::Error(e) => Err(PusPacketHandlingError::EcssTmtc(e)),
|
||||
|
@ -53,7 +53,7 @@ impl PusService11SchedHandler {
|
||||
}
|
||||
|
||||
pub fn handle_one_tc(&mut self) -> Result<PusPacketHandlerResult, PusPacketHandlingError> {
|
||||
let possible_packet = self.psb.retrieve_next_packet()?;
|
||||
let possible_packet = self.psb.retrieve_and_accept_next_packet()?;
|
||||
if possible_packet.is_none() {
|
||||
return Ok(PusPacketHandlerResult::Empty);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ impl PusService17TestHandler {
|
||||
}
|
||||
|
||||
pub fn handle_one_tc(&mut self) -> Result<PusPacketHandlerResult, PusPacketHandlingError> {
|
||||
let possible_packet = self.psb.retrieve_next_packet()?;
|
||||
let possible_packet = self.psb.retrieve_and_accept_next_packet()?;
|
||||
if possible_packet.is_none() {
|
||||
return Ok(PusPacketHandlerResult::Empty);
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ impl PusService8ActionHandler {
|
||||
}
|
||||
|
||||
fn handle_one_tc(&mut self) -> Result<PusPacketHandlerResult, PusPacketHandlingError> {
|
||||
let possible_packet = self.psb.retrieve_next_packet()?;
|
||||
let possible_packet = self.psb.retrieve_and_accept_next_packet()?;
|
||||
if possible_packet.is_none() {
|
||||
return Ok(PusPacketHandlerResult::Empty);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ impl PusService3HkHandler {
|
||||
}
|
||||
|
||||
fn handle_one_tc(&mut self) -> Result<PusPacketHandlerResult, PusPacketHandlingError> {
|
||||
let possible_packet = self.psb.retrieve_next_packet()?;
|
||||
let possible_packet = self.psb.retrieve_and_accept_next_packet()?;
|
||||
if possible_packet.is_none() {
|
||||
return Ok(PusPacketHandlerResult::Empty);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user