CcsdsPacketCreatorWithReservedData

Struct CcsdsPacketCreatorWithReservedData 

Source
pub struct CcsdsPacketCreatorWithReservedData<'buf> { /* private fields */ }
Expand description

CCSDS packet creator with optional support for a CRC16 CCITT checksum appended to the end of the packet and support for copying into the user buffer directly.

This packet creator variant reserves memory based on the required user data length specified by the user and then provides mutable or shared access to that memory. This is useful to avoid an additional slice for the user data and allow copying data directly into the packet.

Please note that packet creation has to be completed using the Self::finish call.

Implementations§

Source§

impl<'buf> CcsdsPacketCreatorWithReservedData<'buf>

Source

pub const HEADER_LEN: usize = 6usize

CCSDS header length.

Source

pub fn packet_len_for_user_data_with_checksum( user_data_len: usize, ) -> Option<usize>

Calculate the full CCSDS packet length for a given user data length and with a CRC16 checksum.

Source

pub fn new( sp_header: SpacePacketHeader, packet_type: PacketType, packet_data_len: usize, buf: &'buf mut [u8], checksum: Option<ChecksumType>, ) -> Result<Self, CcsdsPacketCreationError>

Generic constructor.

Source

pub fn new_with_checksum( sp_header: SpHeader, packet_type: PacketType, payload_len: usize, buf: &'buf mut [u8], ) -> Result<Self, CcsdsPacketCreationError>

Constructor which always appends a CRC16 checksum at the packet end.

Source

pub fn new_tm_with_checksum( sp_header: SpHeader, payload_len: usize, buf: &'buf mut [u8], ) -> Result<Self, CcsdsPacketCreationError>

Constructor for telemetry packets which always appends a CRC16 checksum at the packet end.

Source

pub fn new_tc_with_checksum( sp_header: SpHeader, payload_len: usize, buf: &'buf mut [u8], ) -> Result<Self, CcsdsPacketCreationError>

Constructor for telecommand packets which always appends a CRC16 checksum at the packet end.

Source§

impl CcsdsPacketCreatorWithReservedData<'_>

Source

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

Raw full buffer this packet is constructed in.

Source

pub fn packet_len(&self) -> usize

Full packet length.

Source

pub fn sp_header(&self) -> &SpHeader

Space packet header.

Source

pub fn ccsds_packet_id_and_psc(&self) -> CcsdsPacketIdAndPsc

CcsdsPacketIdAndPsc structure for this packet.

Source

pub fn packet_data_mut(&mut self) -> &mut [u8]

Mutable access to the packet data field.

Source

pub fn packet_data(&mut self) -> &[u8]

Read-only access to the packet data field.

Source

pub fn finish(self) -> usize

Finish the packet generation process.

This packet writes the space packet header. It also calculates and appends the CRC checksum when configured to do so.

Trait Implementations§

Source§

impl CcsdsPacket for CcsdsPacketCreatorWithReservedData<'_>

Source§

fn ccsds_version(&self) -> u3

CCSDS version field.

Source§

fn packet_id(&self) -> PacketId

CCSDS packet ID field.

Source§

fn psc(&self) -> PacketSequenceControl

CCSDS packet sequence control field.

Source§

fn data_len(&self) -> u16

CCSDS data length field.

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<'buf> Debug for CcsdsPacketCreatorWithReservedData<'buf>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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, 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.