delete obsolete code
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit
This commit is contained in:
parent
7bbbab56d5
commit
05c986eb2e
@ -1,8 +1,6 @@
|
|||||||
use core::{fmt, marker::PhantomData};
|
use core::{fmt, marker::PhantomData};
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
#[cfg(feature = "std")]
|
|
||||||
use std::error::Error;
|
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
|
#[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
|
||||||
@ -26,39 +24,6 @@ pub type RequestId = u32;
|
|||||||
/// CCSDS APID type definition. Please note that the APID is a 14 bit value.
|
/// CCSDS APID type definition. Please note that the APID is a 14 bit value.
|
||||||
pub type Apid = u16;
|
pub type Apid = u16;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
||||||
pub enum TargetIdCreationError {
|
|
||||||
ByteConversion(ByteConversionError),
|
|
||||||
NotEnoughAppData(usize),
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<ByteConversionError> for TargetIdCreationError {
|
|
||||||
fn from(e: ByteConversionError) -> Self {
|
|
||||||
Self::ByteConversion(e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Display for TargetIdCreationError {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
match self {
|
|
||||||
Self::ByteConversion(e) => write!(f, "target ID creation: {}", e),
|
|
||||||
Self::NotEnoughAppData(len) => {
|
|
||||||
write!(f, "not enough app data to generate target ID: {}", len)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
|
||||||
impl Error for TargetIdCreationError {
|
|
||||||
fn source(&self) -> Option<&(dyn Error + 'static)> {
|
|
||||||
if let Self::ByteConversion(e) = self {
|
|
||||||
return Some(e);
|
|
||||||
}
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
|
||||||
pub struct TargetAndApidId {
|
pub struct TargetAndApidId {
|
||||||
pub apid: Apid,
|
pub apid: Apid,
|
||||||
@ -88,13 +53,12 @@ impl TargetAndApidId {
|
|||||||
|
|
||||||
pub fn from_pus_tc(
|
pub fn from_pus_tc(
|
||||||
tc: &(impl CcsdsPacket + PusPacket + IsPusTelecommand),
|
tc: &(impl CcsdsPacket + PusPacket + IsPusTelecommand),
|
||||||
) -> Result<Self, TargetIdCreationError> {
|
) -> Result<Self, ByteConversionError> {
|
||||||
if tc.user_data().len() < 4 {
|
if tc.user_data().len() < 4 {
|
||||||
return Err(ByteConversionError::FromSliceTooSmall {
|
return Err(ByteConversionError::FromSliceTooSmall {
|
||||||
found: tc.user_data().len(),
|
found: tc.user_data().len(),
|
||||||
expected: 8,
|
expected: 8,
|
||||||
}
|
});
|
||||||
.into());
|
|
||||||
}
|
}
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
apid: tc.apid(),
|
apid: tc.apid(),
|
||||||
@ -417,3 +381,6 @@ pub mod std_mod {
|
|||||||
|
|
||||||
pub type MessageReceiverWithIdMpsc<MSG> = MessageReceiverWithId<MSG, mpsc::Receiver<MSG>>;
|
pub type MessageReceiverWithIdMpsc<MSG> = MessageReceiverWithId<MSG, mpsc::Receiver<MSG>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {}
|
||||||
|
@ -3,7 +3,7 @@ use std::{println, sync::mpsc};
|
|||||||
|
|
||||||
use satrs::mode::{
|
use satrs::mode::{
|
||||||
ModeError, ModeProvider, ModeReplyReceiver, ModeReplySender, ModeRequestHandler,
|
ModeError, ModeProvider, ModeReplyReceiver, ModeReplySender, ModeRequestHandler,
|
||||||
ModeRequestHandlerMpscBounded, ModeRequestReceiver, ModeRequestSender,
|
ModeRequestHandlerMpscBounded, ModeRequestReceiver,
|
||||||
ModeRequestorAndHandlerMpscBounded, ModeRequestorBoundedMpsc,
|
ModeRequestorAndHandlerMpscBounded, ModeRequestorBoundedMpsc,
|
||||||
};
|
};
|
||||||
use satrs::request::RequestId;
|
use satrs::request::RequestId;
|
||||||
|
Loading…
Reference in New Issue
Block a user