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>
impl<'buf> CcsdsPacketCreatorWithReservedData<'buf>
Sourcepub const HEADER_LEN: usize = 6usize
pub const HEADER_LEN: usize = 6usize
CCSDS header length.
Sourcepub fn packet_len_for_user_data_with_checksum(
user_data_len: usize,
) -> Option<usize>
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.
Sourcepub fn new(
sp_header: SpacePacketHeader,
packet_type: PacketType,
packet_data_len: usize,
buf: &'buf mut [u8],
checksum: Option<ChecksumType>,
) -> Result<Self, CcsdsPacketCreationError>
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.
Sourcepub fn new_with_checksum(
sp_header: SpHeader,
packet_type: PacketType,
payload_len: usize,
buf: &'buf mut [u8],
) -> Result<Self, CcsdsPacketCreationError>
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.
Sourcepub fn new_tm_with_checksum(
sp_header: SpHeader,
payload_len: usize,
buf: &'buf mut [u8],
) -> Result<Self, CcsdsPacketCreationError>
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.
Sourcepub fn new_tc_with_checksum(
sp_header: SpHeader,
payload_len: usize,
buf: &'buf mut [u8],
) -> Result<Self, CcsdsPacketCreationError>
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<'_>
impl CcsdsPacketCreatorWithReservedData<'_>
Sourcepub fn raw_buffer(&self) -> &[u8] ⓘ
pub fn raw_buffer(&self) -> &[u8] ⓘ
Raw full buffer this packet is constructed in.
Sourcepub fn packet_len(&self) -> usize
pub fn packet_len(&self) -> usize
Full packet length.
Sourcepub fn ccsds_packet_id_and_psc(&self) -> CcsdsPacketIdAndPsc
pub fn ccsds_packet_id_and_psc(&self) -> CcsdsPacketIdAndPsc
CcsdsPacketIdAndPsc structure for this packet.
Sourcepub fn packet_data_mut(&mut self) -> &mut [u8] ⓘ
pub fn packet_data_mut(&mut self) -> &mut [u8] ⓘ
Mutable access to the packet data field.
Sourcepub fn packet_data(&mut self) -> &[u8] ⓘ
pub fn packet_data(&mut self) -> &[u8] ⓘ
Read-only access to the packet data field.
Trait Implementations§
Source§impl CcsdsPacket for CcsdsPacketCreatorWithReservedData<'_>
impl CcsdsPacket for CcsdsPacketCreatorWithReservedData<'_>
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 field.