it compiles again
This commit is contained in:
parent
1389ee462e
commit
1d752251f5
@ -1,5 +1,5 @@
|
|||||||
use crate::pus::{source_buffer_large_enough, EcssTmtcErrorWithSend};
|
use crate::pus::{source_buffer_large_enough, EcssTmtcErrorWithSend};
|
||||||
use spacepackets::ecss::EcssEnumeration;
|
use spacepackets::ecss::{EcssEnumeration, PusError};
|
||||||
use spacepackets::tm::PusTm;
|
use spacepackets::tm::PusTm;
|
||||||
use spacepackets::tm::PusTmSecondaryHeader;
|
use spacepackets::tm::PusTmSecondaryHeader;
|
||||||
use spacepackets::{SpHeader, MAX_APID};
|
use spacepackets::{SpHeader, MAX_APID};
|
||||||
@ -99,7 +99,7 @@ impl EventReporterBase {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generate_and_send_generic_tm<E>(
|
fn generate_and_send_generic_tm(
|
||||||
&mut self,
|
&mut self,
|
||||||
buf: &mut [u8],
|
buf: &mut [u8],
|
||||||
subservice: Subservice,
|
subservice: Subservice,
|
||||||
@ -109,9 +109,7 @@ impl EventReporterBase {
|
|||||||
aux_data: Option<&[u8]>,
|
aux_data: Option<&[u8]>,
|
||||||
) -> Result<(), EcssTmtcErrorWithSend> {
|
) -> Result<(), EcssTmtcErrorWithSend> {
|
||||||
let tm = self.generate_generic_event_tm(buf, subservice, time_stamp, event_id, aux_data)?;
|
let tm = self.generate_generic_event_tm(buf, subservice, time_stamp, event_id, aux_data)?;
|
||||||
sender
|
sender.send_tm(tm.into())?;
|
||||||
.send_tm(tm.into())
|
|
||||||
.map_err(|e| EcssTmtcErrorWithSend::SendError(e))?;
|
|
||||||
self.msg_count += 1;
|
self.msg_count += 1;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -138,7 +136,9 @@ impl EventReporterBase {
|
|||||||
Some(time_stamp),
|
Some(time_stamp),
|
||||||
);
|
);
|
||||||
let mut current_idx = 0;
|
let mut current_idx = 0;
|
||||||
event_id.write_to_be_bytes(&mut buf[0..event_id.size()])?;
|
event_id
|
||||||
|
.write_to_be_bytes(&mut buf[0..event_id.size()])
|
||||||
|
.map_err(PusError::ByteConversionError)?;
|
||||||
current_idx += event_id.size();
|
current_idx += event_id.size();
|
||||||
if let Some(aux_data) = aux_data {
|
if let Some(aux_data) = aux_data {
|
||||||
buf[current_idx..current_idx + aux_data.len()].copy_from_slice(aux_data);
|
buf[current_idx..current_idx + aux_data.len()].copy_from_slice(aux_data);
|
||||||
@ -172,7 +172,7 @@ mod alloc_mod {
|
|||||||
reporter,
|
reporter,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
pub fn event_info<E>(
|
pub fn event_info(
|
||||||
&mut self,
|
&mut self,
|
||||||
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
||||||
time_stamp: &[u8],
|
time_stamp: &[u8],
|
||||||
@ -188,7 +188,7 @@ mod alloc_mod {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn event_low_severity<E>(
|
pub fn event_low_severity(
|
||||||
&mut self,
|
&mut self,
|
||||||
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
||||||
time_stamp: &[u8],
|
time_stamp: &[u8],
|
||||||
@ -204,7 +204,7 @@ mod alloc_mod {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn event_medium_severity<E>(
|
pub fn event_medium_severity(
|
||||||
&mut self,
|
&mut self,
|
||||||
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
||||||
time_stamp: &[u8],
|
time_stamp: &[u8],
|
||||||
@ -220,7 +220,7 @@ mod alloc_mod {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn event_high_severity<E>(
|
pub fn event_high_severity(
|
||||||
&mut self,
|
&mut self,
|
||||||
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
||||||
time_stamp: &[u8],
|
time_stamp: &[u8],
|
||||||
|
@ -173,7 +173,7 @@ pub mod alloc_mod {
|
|||||||
self.backend.disable_event_reporting(event)
|
self.backend.disable_event_reporting(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn generate_pus_event_tm_generic<E>(
|
pub fn generate_pus_event_tm_generic(
|
||||||
&mut self,
|
&mut self,
|
||||||
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
||||||
time_stamp: &[u8],
|
time_stamp: &[u8],
|
||||||
|
@ -2,17 +2,16 @@
|
|||||||
//!
|
//!
|
||||||
//! This module contains structures to make working with the PUS C standard easier.
|
//! This module contains structures to make working with the PUS C standard easier.
|
||||||
//! The satrs-example application contains various usage examples of these components.
|
//! The satrs-example application contains various usage examples of these components.
|
||||||
use crate::pus::verification::TcStateToken;
|
|
||||||
use crate::SenderId;
|
use crate::SenderId;
|
||||||
|
use core::fmt::{Display, Formatter};
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
use downcast_rs::{impl_downcast, Downcast};
|
use downcast_rs::{impl_downcast, Downcast};
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
use dyn_clone::DynClone;
|
use dyn_clone::DynClone;
|
||||||
use spacepackets::ecss::PusError;
|
use spacepackets::ecss::PusError;
|
||||||
use spacepackets::tc::PusTc;
|
|
||||||
use spacepackets::time::TimestampError;
|
|
||||||
use spacepackets::tm::PusTm;
|
use spacepackets::tm::PusTm;
|
||||||
use spacepackets::{ByteConversionError, SizeMissmatch};
|
use spacepackets::{ByteConversionError, SizeMissmatch};
|
||||||
|
use std::error::Error;
|
||||||
|
|
||||||
pub mod event;
|
pub mod event;
|
||||||
pub mod event_man;
|
pub mod event_man;
|
||||||
@ -28,7 +27,7 @@ pub mod verification;
|
|||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
pub use alloc_mod::*;
|
pub use alloc_mod::*;
|
||||||
|
|
||||||
use crate::pool::StoreAddr;
|
use crate::pool::{StoreAddr, StoreError};
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub use std_mod::*;
|
pub use std_mod::*;
|
||||||
|
|
||||||
@ -50,37 +49,89 @@ impl<'tm> From<PusTm<'tm>> for PusTmWrapper<'tm> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generic error type for PUS TM handling.
|
/// Generic error type for sending something via a message queue.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub enum EcssTmtcSendError {
|
pub enum GenericSendError {
|
||||||
RxDisconnected,
|
RxDisconnected,
|
||||||
QueueFull(u32),
|
QueueFull(u32),
|
||||||
}
|
}
|
||||||
|
|
||||||
// /// Generic error type for PUS TMTC handling.
|
impl Display for GenericSendError {
|
||||||
// #[derive(Debug, Clone)]
|
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
|
||||||
// pub enum EcssTmtcErrorWithSend {
|
match self {
|
||||||
// /// Errors related to the time stamp format of the telemetry
|
GenericSendError::RxDisconnected => {
|
||||||
// Timestamp(TimestampError),
|
write!(f, "rx side has disconnected")
|
||||||
// /// Errors related to byte conversion, for example insufficient buffer size for given data
|
}
|
||||||
// ByteConversion(ByteConversionError),
|
GenericSendError::QueueFull(max_cap) => {
|
||||||
// /// Errors related to PUS packet format
|
write!(f, "queue with max capacity of {max_cap} is full")
|
||||||
// Pus(PusError),
|
}
|
||||||
// Send(EcssTmtcSendError)
|
}
|
||||||
// }
|
}
|
||||||
//
|
}
|
||||||
// impl From<PusError> for EcssTmtcErrorWithSend {
|
|
||||||
// fn from(e: PusError) -> Self {
|
|
||||||
// EcssTmtcErrorWithSend::Pus(e)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// impl From<ByteConversionError> for EcssTmtcErrorWithSend {
|
|
||||||
// fn from(e: ByteConversionError) -> Self {
|
|
||||||
// EcssTmtcErrorWithSend::ByteConversion(e)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
impl Error for GenericSendError {}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub enum EcssTmtcErrorWithSend {
|
||||||
|
StoreLock,
|
||||||
|
Store(StoreError),
|
||||||
|
Pus(PusError),
|
||||||
|
CantSendAddr(StoreAddr),
|
||||||
|
Send(GenericSendError),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Display for EcssTmtcErrorWithSend {
|
||||||
|
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
|
||||||
|
match self {
|
||||||
|
EcssTmtcErrorWithSend::StoreLock => {
|
||||||
|
write!(f, "store lock error")
|
||||||
|
}
|
||||||
|
EcssTmtcErrorWithSend::Store(store) => {
|
||||||
|
write!(f, "store error: {store}")
|
||||||
|
}
|
||||||
|
EcssTmtcErrorWithSend::Pus(pus_e) => {
|
||||||
|
write!(f, "PUS error: {pus_e}")
|
||||||
|
}
|
||||||
|
EcssTmtcErrorWithSend::CantSendAddr(addr) => {
|
||||||
|
write!(f, "can not send address {addr}")
|
||||||
|
}
|
||||||
|
EcssTmtcErrorWithSend::Send(send_e) => {
|
||||||
|
write!(f, "send error {send_e}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<StoreError> for EcssTmtcErrorWithSend {
|
||||||
|
fn from(value: StoreError) -> Self {
|
||||||
|
Self::Store(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<PusError> for EcssTmtcErrorWithSend {
|
||||||
|
fn from(value: PusError) -> Self {
|
||||||
|
Self::Pus(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<GenericSendError> for EcssTmtcErrorWithSend {
|
||||||
|
fn from(value: GenericSendError) -> Self {
|
||||||
|
Self::Send(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
impl Error for EcssTmtcErrorWithSend {
|
||||||
|
fn source(&self) -> Option<&(dyn Error + 'static)> {
|
||||||
|
match self {
|
||||||
|
EcssTmtcErrorWithSend::Store(e) => Some(e),
|
||||||
|
EcssTmtcErrorWithSend::Pus(e) => Some(e),
|
||||||
|
EcssTmtcErrorWithSend::Send(e) => Some(e),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pub trait EcssSender: Send {
|
pub trait EcssSender: Send {
|
||||||
/// Each sender can have an ID associated with it
|
/// Each sender can have an ID associated with it
|
||||||
fn id(&self) -> SenderId;
|
fn id(&self) -> SenderId;
|
||||||
@ -140,7 +191,7 @@ pub mod std_mod {
|
|||||||
use crate::pus::verification::{
|
use crate::pus::verification::{
|
||||||
StdVerifReporterWithSender, TcStateAccepted, TcStateToken, VerificationToken,
|
StdVerifReporterWithSender, TcStateAccepted, TcStateToken, VerificationToken,
|
||||||
};
|
};
|
||||||
use crate::pus::{EcssSender, EcssTmtcSendError, PusTmWrapper};
|
use crate::pus::{EcssSender, EcssTmtcErrorWithSend, GenericSendError, PusTmWrapper};
|
||||||
use crate::tmtc::tm_helper::SharedTmStore;
|
use crate::tmtc::tm_helper::SharedTmStore;
|
||||||
use crate::SenderId;
|
use crate::SenderId;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
@ -151,23 +202,10 @@ pub mod std_mod {
|
|||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::format;
|
use std::format;
|
||||||
use std::string::String;
|
use std::string::String;
|
||||||
|
use std::sync::mpsc::SendError;
|
||||||
use std::sync::{mpsc, RwLockWriteGuard};
|
use std::sync::{mpsc, RwLockWriteGuard};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Error)]
|
|
||||||
pub enum EcssTmtcErrorWithSend {
|
|
||||||
#[error("store locking error")]
|
|
||||||
StoreLock,
|
|
||||||
#[error("generic store error: {0}")]
|
|
||||||
Store(#[from] StoreError),
|
|
||||||
#[error("generic PUS error: {0}")]
|
|
||||||
Pus(#[from] PusError),
|
|
||||||
#[error("not able to send address {0}")]
|
|
||||||
CantSendAddr(StoreAddr),
|
|
||||||
#[error("generic channel send error: {0}")]
|
|
||||||
Send(#[from] EcssTmtcSendError),
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Generic trait for a user supplied sender object.
|
/// Generic trait for a user supplied sender object.
|
||||||
///
|
///
|
||||||
/// This sender object is responsible for sending PUS telemetry to a TM sink.
|
/// This sender object is responsible for sending PUS telemetry to a TM sink.
|
||||||
@ -206,6 +244,11 @@ pub mod std_mod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<SendError<StoreAddr>> for EcssTmtcErrorWithSend {
|
||||||
|
fn from(_: SendError<StoreAddr>) -> Self {
|
||||||
|
Self::Send(GenericSendError::RxDisconnected)
|
||||||
|
}
|
||||||
|
}
|
||||||
impl MpscTmInStoreSender {
|
impl MpscTmInStoreSender {
|
||||||
pub fn send_direct_tm(
|
pub fn send_direct_tm(
|
||||||
&self,
|
&self,
|
||||||
@ -224,7 +267,7 @@ pub mod std_mod {
|
|||||||
operation(e.into_inner())
|
operation(e.into_inner())
|
||||||
} else {
|
} else {
|
||||||
Err(EcssTmtcErrorWithSend::Send(
|
Err(EcssTmtcErrorWithSend::Send(
|
||||||
EcssTmtcSendError::RxDisconnected,
|
GenericSendError::RxDisconnected,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -235,9 +278,7 @@ pub mod std_mod {
|
|||||||
impl EcssTmSenderCore for MpscTmInStoreSender {
|
impl EcssTmSenderCore for MpscTmInStoreSender {
|
||||||
fn send_tm(&self, tm: PusTmWrapper) -> Result<(), EcssTmtcErrorWithSend> {
|
fn send_tm(&self, tm: PusTmWrapper) -> Result<(), EcssTmtcErrorWithSend> {
|
||||||
match tm {
|
match tm {
|
||||||
PusTmWrapper::InStore(addr) => self.sender.send(addr).map_err(
|
PusTmWrapper::InStore(addr) => self.sender.send(addr).map_err(|e| e.into()),
|
||||||
EcssTmtcErrorWithSend::Send(EcssTmtcSendError::RxDisconnected),
|
|
||||||
),
|
|
||||||
PusTmWrapper::Direct(tm) => self.send_direct_tm(tm),
|
PusTmWrapper::Direct(tm) => self.send_direct_tm(tm),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,18 +301,6 @@ pub mod std_mod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Error)]
|
|
||||||
pub enum MpscTmAsVecSenderError {
|
|
||||||
#[error("Generic PUS error: {0}")]
|
|
||||||
Pus(#[from] PusError),
|
|
||||||
#[error("MPSC channel send error: {0}")]
|
|
||||||
Send(#[from] mpsc::SendError<Vec<u8>>),
|
|
||||||
#[error("can not handle store addresses")]
|
|
||||||
CantSendAddr(StoreAddr),
|
|
||||||
#[error("RX handle has disconnected")]
|
|
||||||
RxDisconnected,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// This class can be used if frequent heap allocations during run-time are not an issue.
|
/// This class can be used if frequent heap allocations during run-time are not an issue.
|
||||||
/// PUS TM packets will be sent around as [Vec]s. Please note that the current implementation
|
/// PUS TM packets will be sent around as [Vec]s. Please note that the current implementation
|
||||||
/// of this class can not deal with store addresses, so it is assumed that is is always
|
/// of this class can not deal with store addresses, so it is assumed that is is always
|
||||||
@ -283,6 +312,12 @@ pub mod std_mod {
|
|||||||
name: &'static str,
|
name: &'static str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<SendError<Vec<u8>>> for EcssTmtcErrorWithSend {
|
||||||
|
fn from(_: SendError<Vec<u8>>) -> Self {
|
||||||
|
Self::Send(GenericSendError::RxDisconnected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl MpscTmAsVecSender {
|
impl MpscTmAsVecSender {
|
||||||
pub fn new(id: u32, name: &'static str, sender: mpsc::Sender<Vec<u8>>) -> Self {
|
pub fn new(id: u32, name: &'static str, sender: mpsc::Sender<Vec<u8>>) -> Self {
|
||||||
Self { id, sender, name }
|
Self { id, sender, name }
|
||||||
@ -305,10 +340,8 @@ pub mod std_mod {
|
|||||||
PusTmWrapper::Direct(tm) => {
|
PusTmWrapper::Direct(tm) => {
|
||||||
let mut vec = Vec::new();
|
let mut vec = Vec::new();
|
||||||
tm.append_to_vec(&mut vec)
|
tm.append_to_vec(&mut vec)
|
||||||
.map_err(MpscTmAsVecSenderError::Pus)?;
|
.map_err(EcssTmtcErrorWithSend::Pus)?;
|
||||||
self.sender
|
self.sender.send(vec)?;
|
||||||
.send(vec)
|
|
||||||
.map_err(MpscTmAsVecSenderError::Send)?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -469,12 +502,13 @@ pub(crate) fn source_buffer_large_enough(
|
|||||||
len: usize,
|
len: usize,
|
||||||
) -> Result<(), EcssTmtcErrorWithSend> {
|
) -> Result<(), EcssTmtcErrorWithSend> {
|
||||||
if len > cap {
|
if len > cap {
|
||||||
return Err(EcssTmtcErrorWithSend::ByteConversion(
|
return Err(
|
||||||
ByteConversionError::ToSliceTooSmall(SizeMissmatch {
|
PusError::ByteConversionError(ByteConversionError::ToSliceTooSmall(SizeMissmatch {
|
||||||
found: cap,
|
found: cap,
|
||||||
expected: len,
|
expected: len,
|
||||||
}),
|
}))
|
||||||
));
|
.into(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ use core::mem::size_of;
|
|||||||
use delegate::delegate;
|
use delegate::delegate;
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use spacepackets::ecss::{EcssEnumeration, SerializablePusPacket};
|
use spacepackets::ecss::{EcssEnumeration, PusError, SerializablePusPacket};
|
||||||
use spacepackets::tc::PusTc;
|
use spacepackets::tc::PusTc;
|
||||||
use spacepackets::tm::{PusTm, PusTmSecondaryHeader};
|
use spacepackets::tm::{PusTm, PusTmSecondaryHeader};
|
||||||
use spacepackets::{CcsdsPacket, PacketId, PacketSequenceCtrl};
|
use spacepackets::{CcsdsPacket, PacketId, PacketSequenceCtrl};
|
||||||
@ -179,7 +179,7 @@ pub struct VerificationErrorWithToken<T>(pub EcssTmtcErrorWithSend, pub Verifica
|
|||||||
|
|
||||||
impl<T> From<VerificationErrorWithToken<T>> for VerificationOrSendErrorWithToken<T> {
|
impl<T> From<VerificationErrorWithToken<T>> for VerificationOrSendErrorWithToken<T> {
|
||||||
fn from(value: VerificationErrorWithToken<T>) -> Self {
|
fn from(value: VerificationErrorWithToken<T>) -> Self {
|
||||||
VerificationOrSendErrorWithToken(value.0.into(), value.1)
|
VerificationOrSendErrorWithToken(value.0, value.1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Support token to allow type-state programming. This prevents calling the verification
|
/// Support token to allow type-state programming. This prevents calling the verification
|
||||||
@ -509,7 +509,7 @@ impl VerificationReporterCore {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_acceptance_success<E>(
|
pub fn send_acceptance_success(
|
||||||
&self,
|
&self,
|
||||||
mut sendable: VerificationSendable<'_, TcStateNone, VerifSuccess>,
|
mut sendable: VerificationSendable<'_, TcStateNone, VerifSuccess>,
|
||||||
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
||||||
@ -517,28 +517,18 @@ impl VerificationReporterCore {
|
|||||||
{
|
{
|
||||||
sender
|
sender
|
||||||
.send_tm(sendable.pus_tm.take().unwrap().into())
|
.send_tm(sendable.pus_tm.take().unwrap().into())
|
||||||
.map_err(|e| {
|
.map_err(|e| VerificationOrSendErrorWithToken(e, sendable.token.unwrap()))?;
|
||||||
VerificationOrSendErrorWithToken(
|
|
||||||
EcssTmtcErrorWithSend::SendError(e),
|
|
||||||
sendable.token.unwrap(),
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
Ok(sendable.send_success_acceptance_success())
|
Ok(sendable.send_success_acceptance_success())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_acceptance_failure<E>(
|
pub fn send_acceptance_failure(
|
||||||
&self,
|
&self,
|
||||||
mut sendable: VerificationSendable<'_, TcStateNone, VerifFailure>,
|
mut sendable: VerificationSendable<'_, TcStateNone, VerifFailure>,
|
||||||
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
||||||
) -> Result<(), VerificationOrSendErrorWithToken<TcStateNone>> {
|
) -> Result<(), VerificationOrSendErrorWithToken<TcStateNone>> {
|
||||||
sender
|
sender
|
||||||
.send_tm(sendable.pus_tm.take().unwrap().into())
|
.send_tm(sendable.pus_tm.take().unwrap().into())
|
||||||
.map_err(|e| {
|
.map_err(|e| VerificationOrSendErrorWithToken(e, sendable.token.unwrap()))?;
|
||||||
VerificationOrSendErrorWithToken(
|
|
||||||
EcssTmtcErrorWithSend::SendError(e),
|
|
||||||
sendable.token.unwrap(),
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
sendable.send_success_verif_failure();
|
sendable.send_success_verif_failure();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -590,7 +580,7 @@ impl VerificationReporterCore {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_start_success<E>(
|
pub fn send_start_success(
|
||||||
&self,
|
&self,
|
||||||
mut sendable: VerificationSendable<'_, TcStateAccepted, VerifSuccess>,
|
mut sendable: VerificationSendable<'_, TcStateAccepted, VerifSuccess>,
|
||||||
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
||||||
@ -598,12 +588,7 @@ impl VerificationReporterCore {
|
|||||||
{
|
{
|
||||||
sender
|
sender
|
||||||
.send_tm(sendable.pus_tm.take().unwrap().into())
|
.send_tm(sendable.pus_tm.take().unwrap().into())
|
||||||
.map_err(|e| {
|
.map_err(|e| VerificationOrSendErrorWithToken(e, sendable.token.unwrap()))?;
|
||||||
VerificationOrSendErrorWithToken(
|
|
||||||
EcssTmtcErrorWithSend::SendError(e),
|
|
||||||
sendable.token.unwrap(),
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
Ok(sendable.send_success_start_success())
|
Ok(sendable.send_success_start_success())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,19 +618,14 @@ impl VerificationReporterCore {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_start_failure<E>(
|
pub fn send_start_failure(
|
||||||
&self,
|
&self,
|
||||||
mut sendable: VerificationSendable<'_, TcStateAccepted, VerifFailure>,
|
mut sendable: VerificationSendable<'_, TcStateAccepted, VerifFailure>,
|
||||||
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
||||||
) -> Result<(), VerificationOrSendErrorWithToken<TcStateAccepted>> {
|
) -> Result<(), VerificationOrSendErrorWithToken<TcStateAccepted>> {
|
||||||
sender
|
sender
|
||||||
.send_tm(sendable.pus_tm.take().unwrap().into())
|
.send_tm(sendable.pus_tm.take().unwrap().into())
|
||||||
.map_err(|e| {
|
.map_err(|e| VerificationOrSendErrorWithToken(e, sendable.token.unwrap()))?;
|
||||||
VerificationOrSendErrorWithToken(
|
|
||||||
EcssTmtcErrorWithSend::SendError(e),
|
|
||||||
sendable.token.unwrap(),
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
sendable.send_success_verif_failure();
|
sendable.send_success_verif_failure();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -764,12 +744,7 @@ impl VerificationReporterCore {
|
|||||||
) -> Result<(), VerificationOrSendErrorWithToken<TcState>> {
|
) -> Result<(), VerificationOrSendErrorWithToken<TcState>> {
|
||||||
sender
|
sender
|
||||||
.send_tm(sendable.pus_tm.take().unwrap().into())
|
.send_tm(sendable.pus_tm.take().unwrap().into())
|
||||||
.map_err(|e| {
|
.map_err(|e| VerificationOrSendErrorWithToken(e, sendable.token.unwrap()))?;
|
||||||
VerificationOrSendErrorWithToken(
|
|
||||||
EcssTmtcErrorWithSend::SendError(e),
|
|
||||||
sendable.token.unwrap(),
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
sendable.send_success_step_or_completion_success();
|
sendable.send_success_step_or_completion_success();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -781,12 +756,7 @@ impl VerificationReporterCore {
|
|||||||
) -> Result<(), VerificationOrSendErrorWithToken<TcState>> {
|
) -> Result<(), VerificationOrSendErrorWithToken<TcState>> {
|
||||||
sender
|
sender
|
||||||
.send_tm(sendable.pus_tm.take().unwrap().into())
|
.send_tm(sendable.pus_tm.take().unwrap().into())
|
||||||
.map_err(|e| {
|
.map_err(|e| VerificationOrSendErrorWithToken(e, sendable.token.unwrap()))?;
|
||||||
VerificationOrSendErrorWithToken(
|
|
||||||
EcssTmtcErrorWithSend::SendError(e),
|
|
||||||
sendable.token.unwrap(),
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
sendable.send_success_verif_failure();
|
sendable.send_success_verif_failure();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -858,7 +828,8 @@ impl VerificationReporterCore {
|
|||||||
}
|
}
|
||||||
params
|
params
|
||||||
.failure_code
|
.failure_code
|
||||||
.write_to_be_bytes(&mut src_data_buf[idx..idx + params.failure_code.size()])?;
|
.write_to_be_bytes(&mut src_data_buf[idx..idx + params.failure_code.size()])
|
||||||
|
.map_err(PusError::ByteConversionError)?;
|
||||||
idx += params.failure_code.size();
|
idx += params.failure_code.size();
|
||||||
if let Some(failure_data) = params.failure_data {
|
if let Some(failure_data) = params.failure_data {
|
||||||
src_data_buf[idx..idx + failure_data.len()].copy_from_slice(failure_data);
|
src_data_buf[idx..idx + failure_data.len()].copy_from_slice(failure_data);
|
||||||
@ -1001,7 +972,7 @@ mod alloc_mod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Package and send a PUS TM\[1, 2\] packet, see 8.1.2.2 of the PUS standard
|
/// Package and send a PUS TM\[1, 2\] packet, see 8.1.2.2 of the PUS standard
|
||||||
pub fn acceptance_failure<E>(
|
pub fn acceptance_failure(
|
||||||
&mut self,
|
&mut self,
|
||||||
token: VerificationToken<TcStateNone>,
|
token: VerificationToken<TcStateNone>,
|
||||||
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
||||||
@ -1028,7 +999,7 @@ mod alloc_mod {
|
|||||||
/// Package and send a PUS TM\[1, 3\] packet, see 8.1.2.3 of the PUS standard.
|
/// Package and send a PUS TM\[1, 3\] packet, see 8.1.2.3 of the PUS standard.
|
||||||
///
|
///
|
||||||
/// Requires a token previously acquired by calling [Self::acceptance_success].
|
/// Requires a token previously acquired by calling [Self::acceptance_success].
|
||||||
pub fn start_success<E>(
|
pub fn start_success(
|
||||||
&mut self,
|
&mut self,
|
||||||
token: VerificationToken<TcStateAccepted>,
|
token: VerificationToken<TcStateAccepted>,
|
||||||
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
||||||
@ -1059,7 +1030,7 @@ mod alloc_mod {
|
|||||||
///
|
///
|
||||||
/// Requires a token previously acquired by calling [Self::acceptance_success]. It consumes
|
/// Requires a token previously acquired by calling [Self::acceptance_success]. It consumes
|
||||||
/// the token because verification handling is done.
|
/// the token because verification handling is done.
|
||||||
pub fn start_failure<E>(
|
pub fn start_failure(
|
||||||
&mut self,
|
&mut self,
|
||||||
token: VerificationToken<TcStateAccepted>,
|
token: VerificationToken<TcStateAccepted>,
|
||||||
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
||||||
@ -1086,7 +1057,7 @@ mod alloc_mod {
|
|||||||
/// Package and send a PUS TM\[1, 5\] packet, see 8.1.2.5 of the PUS standard.
|
/// Package and send a PUS TM\[1, 5\] packet, see 8.1.2.5 of the PUS standard.
|
||||||
///
|
///
|
||||||
/// Requires a token previously acquired by calling [Self::start_success].
|
/// Requires a token previously acquired by calling [Self::start_success].
|
||||||
pub fn step_success<E>(
|
pub fn step_success(
|
||||||
&mut self,
|
&mut self,
|
||||||
token: &VerificationToken<TcStateStarted>,
|
token: &VerificationToken<TcStateStarted>,
|
||||||
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
||||||
@ -1118,7 +1089,7 @@ mod alloc_mod {
|
|||||||
///
|
///
|
||||||
/// Requires a token previously acquired by calling [Self::start_success]. It consumes the
|
/// Requires a token previously acquired by calling [Self::start_success]. It consumes the
|
||||||
/// token because verification handling is done.
|
/// token because verification handling is done.
|
||||||
pub fn step_failure<E>(
|
pub fn step_failure(
|
||||||
&mut self,
|
&mut self,
|
||||||
token: VerificationToken<TcStateStarted>,
|
token: VerificationToken<TcStateStarted>,
|
||||||
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
sender: &mut (impl EcssTmSenderCore + ?Sized),
|
||||||
|
Loading…
Reference in New Issue
Block a user