PusTcReader

Struct PusTcReader 

Source
pub struct PusTcReader<'raw_data> { /* private fields */ }
Expand description

This class can be used to read a PUS TC telecommand from raw memory.

This class also derives the serde::Serialize and serde::Deserialize trait if the serde feature is used, which allows to send around TC packets in a raw byte format using a serde provider like postcard.

There is no spare bytes support yet.

§Lifetimes

  • 'raw_data - Lifetime of the provided raw slice.

Implementations§

Source§

impl<'raw_data> PusTcReader<'raw_data>

Source

pub fn new(slice: &'raw_data [u8]) -> Result<Self, PusError>

Create a PusTcReader instance from a raw slice. The given packet should have a a CRC-16-CCITT checksum which is also verified.

Source

pub fn new_checksum_no_table(slice: &'raw_data [u8]) -> Result<Self, PusError>

Similar to PusTcReader::new, but uses a table-less CRC16 algorithm which can reduce binary size and memory usage.

Source

pub fn new_no_checksum(slice: &'raw_data [u8]) -> Result<Self, PusError>

Read a PUS TC from a raw slice where no checksum is expected.

Source

pub fn new_no_checksum_verification( slice: &'raw_data [u8], has_checksum: bool, ) -> Result<Self, PusError>

Create a new Self instance without verifying the checksum, even if the packet has one.

Source

pub fn app_data(&self) -> &[u8]

Application data slice.

Source

pub fn raw_data(&self) -> &[u8]

Full raw data slice.

Source

pub fn len_packed(&self) -> usize

Length of the packed data.

Source

pub fn sp_header(&self) -> &SpHeader

Space packet header.

Source

pub fn crc16(&self) -> Option<u16>

CRC16 checksum if present.

Trait Implementations§

Source§

impl CcsdsPacket for PusTcReader<'_>

Source§

fn ccsds_version(&self) -> u3

CCSDS version field.
Source§

fn packet_id(&self) -> PacketId

CCSDS packet ID. Read more
Source§

fn psc(&self) -> PacketSequenceControl

CCSDS packet sequence control. Read more
Source§

fn data_len(&self) -> u16

Data length field. Read more
Source§

fn packet_len(&self) -> usize

Total packet size based on the data length field
Source§

fn total_len(&self) -> usize

👎Deprecated since 0.16.0: use packet_len instead
Deprecated alias for Self::packet_len.
Source§

fn packet_id_raw(&self) -> u16

Retrieve 13 bit Packet Identification field. Can usually be retrieved with a bitwise AND of the first 2 bytes with 0x1FFF.
Source§

fn psc_raw(&self) -> u16

Retrieve Packet Sequence Count
Source§

fn packet_type(&self) -> PacketType

CCSDS packet type.
Source§

fn is_tm(&self) -> bool

Is this a telemetry packet?
Source§

fn is_tc(&self) -> bool

Is this a telecommand packet?
Source§

fn sec_header_flag(&self) -> bool

CCSDS secondary header flag. Returns true if a secondary header is present and false if it is not.
Source§

fn apid(&self) -> u11

CCSDS Application Process ID (APID).
Source§

fn seq_count(&self) -> u14

CCSDS sequence count.
Source§

fn sequence_flags(&self) -> SequenceFlags

CCSDS sequence flags.
Source§

impl<'raw_data> Clone for PusTcReader<'raw_data>

Source§

fn clone(&self) -> PusTcReader<'raw_data>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'raw_data> Debug for PusTcReader<'raw_data>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de: 'raw_data, 'raw_data> Deserialize<'de> for PusTcReader<'raw_data>

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'raw_data> Format for PusTcReader<'raw_data>

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl GenericPusTcSecondaryHeader for PusTcReader<'_>

Source§

fn pus_version(&self) -> Result<PusVersion, u4>

PUS version.
Source§

fn message_type_id(&self) -> MessageTypeId

Message type ID.
Source§

fn service_type_id(&self) -> u8

Service type ID.
Source§

fn message_subtype_id(&self) -> u8

Message subtype ID.
Source§

fn source_id(&self) -> u16

Source ID.
Source§

fn ack_flags(&self) -> AckFlags

Acknowledgement flags.
Source§

impl PartialEq<PusTcCreator<'_>> for PusTcReader<'_>

Source§

fn eq(&self, other: &PusTcCreator<'_>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<PusTcReader<'_>> for PusTcCreator<'_>

Source§

fn eq(&self, other: &PusTcReader<'_>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for PusTcReader<'_>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PusPacket for PusTcReader<'_>

Source§

fn pus_version(&self) -> Result<PusVersion, u4>

PUS version.
Source§

fn message_type_id(&self) -> MessageTypeId

Message type ID.
Source§

fn service_type_id(&self) -> u8

Service type ID.
Source§

fn message_subtype_id(&self) -> u8

Message subtype ID.
Source§

fn has_checksum(&self) -> bool

The presence of the CRC-16-CCITT checksum is optional.
Source§

fn user_data(&self) -> &[u8]

User data field.
Source§

fn checksum(&self) -> Option<u16>

CRC-16-CCITT checksum.
Source§

impl<'raw_data> Serialize for PusTcReader<'raw_data>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'raw_data> Copy for PusTcReader<'raw_data>

Source§

impl<'raw_data> Eq for PusTcReader<'raw_data>

Source§

impl IsPusTelecommand for PusTcReader<'_>

Auto Trait Implementations§

§

impl<'raw_data> Freeze for PusTcReader<'raw_data>

§

impl<'raw_data> RefUnwindSafe for PusTcReader<'raw_data>

§

impl<'raw_data> Send for PusTcReader<'raw_data>

§

impl<'raw_data> Sync for PusTcReader<'raw_data>

§

impl<'raw_data> Unpin for PusTcReader<'raw_data>

§

impl<'raw_data> UnwindSafe for PusTcReader<'raw_data>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,