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>
impl<'raw_data> PusTcReader<'raw_data>
Sourcepub fn new(slice: &'raw_data [u8]) -> Result<Self, PusError>
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.
Sourcepub fn new_checksum_no_table(slice: &'raw_data [u8]) -> Result<Self, PusError>
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.
Sourcepub fn new_no_checksum(slice: &'raw_data [u8]) -> Result<Self, PusError>
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.
Sourcepub fn new_no_checksum_verification(
slice: &'raw_data [u8],
has_checksum: bool,
) -> Result<Self, PusError>
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.
Sourcepub fn len_packed(&self) -> usize
pub fn len_packed(&self) -> usize
Length of the packed data.
Trait Implementations§
Source§impl CcsdsPacket for PusTcReader<'_>
impl CcsdsPacket for PusTcReader<'_>
Source§fn ccsds_version(&self) -> u3
fn ccsds_version(&self) -> u3
CCSDS version field.
Source§fn psc(&self) -> PacketSequenceControl
fn psc(&self) -> PacketSequenceControl
CCSDS packet sequence control. Read more
Source§fn packet_len(&self) -> usize
fn packet_len(&self) -> usize
Total packet size based on the data length field
Source§fn total_len(&self) -> usize
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
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 packet_type(&self) -> PacketType
fn packet_type(&self) -> PacketType
CCSDS packet type.
Source§fn sec_header_flag(&self) -> bool
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 sequence_flags(&self) -> SequenceFlags
fn sequence_flags(&self) -> SequenceFlags
CCSDS sequence flags.
Source§impl<'raw_data> Clone for PusTcReader<'raw_data>
impl<'raw_data> Clone for PusTcReader<'raw_data>
Source§fn clone(&self) -> PusTcReader<'raw_data>
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'raw_data> Debug for PusTcReader<'raw_data>
impl<'raw_data> Debug for PusTcReader<'raw_data>
Source§impl<'de: 'raw_data, 'raw_data> Deserialize<'de> for PusTcReader<'raw_data>
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>,
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>
impl<'raw_data> Format for PusTcReader<'raw_data>
Source§impl GenericPusTcSecondaryHeader for PusTcReader<'_>
impl GenericPusTcSecondaryHeader for PusTcReader<'_>
Source§fn pus_version(&self) -> Result<PusVersion, u4>
fn pus_version(&self) -> Result<PusVersion, u4>
PUS version.
Source§fn message_type_id(&self) -> MessageTypeId
fn message_type_id(&self) -> MessageTypeId
Message type ID.
Source§fn service_type_id(&self) -> u8
fn service_type_id(&self) -> u8
Service type ID.
Source§fn message_subtype_id(&self) -> u8
fn message_subtype_id(&self) -> u8
Message subtype ID.
Source§impl PartialEq<PusTcCreator<'_>> for PusTcReader<'_>
impl PartialEq<PusTcCreator<'_>> for PusTcReader<'_>
Source§impl PartialEq<PusTcReader<'_>> for PusTcCreator<'_>
impl PartialEq<PusTcReader<'_>> for PusTcCreator<'_>
Source§impl PartialEq for PusTcReader<'_>
impl PartialEq for PusTcReader<'_>
Source§impl PusPacket for PusTcReader<'_>
impl PusPacket for PusTcReader<'_>
Source§fn pus_version(&self) -> Result<PusVersion, u4>
fn pus_version(&self) -> Result<PusVersion, u4>
PUS version.
Source§fn message_type_id(&self) -> MessageTypeId
fn message_type_id(&self) -> MessageTypeId
Message type ID.
Source§fn service_type_id(&self) -> u8
fn service_type_id(&self) -> u8
Service type ID.
Source§fn message_subtype_id(&self) -> u8
fn message_subtype_id(&self) -> u8
Message subtype ID.
Source§fn has_checksum(&self) -> bool
fn has_checksum(&self) -> bool
The presence of the CRC-16-CCITT checksum is optional.
Source§impl<'raw_data> Serialize for PusTcReader<'raw_data>
impl<'raw_data> Serialize for PusTcReader<'raw_data>
impl<'raw_data> Copy for PusTcReader<'raw_data>
impl<'raw_data> Eq for PusTcReader<'raw_data>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more