bumped spacepackets
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit

This commit is contained in:
Robin Müller 2023-12-07 13:29:26 +01:00
parent 0b81198c03
commit 774d9b5961
13 changed files with 40 additions and 40 deletions

View File

@ -19,11 +19,11 @@ use spacepackets::{
pdu::{ pdu::{
eof::EofPdu, eof::EofPdu,
file_data::FileDataPdu, file_data::FileDataPdu,
finished::{DeliveryCode, FileStatus, FinishedPdu}, finished::{DeliveryCode, FileStatus, FinishedPduCreator},
metadata::{MetadataGenericParams, MetadataPdu}, metadata::{MetadataGenericParams, MetadataPduReader},
CommonPduConfig, FileDirectiveType, PduError, PduHeader, WritablePduPacket, CommonPduConfig, FileDirectiveType, PduError, PduHeader, WritablePduPacket, CfdpPdu,
}, },
tlv::{msg_to_user::MsgToUserTlv, EntityIdTlv, TlvType}, tlv::{msg_to_user::MsgToUserTlv, EntityIdTlv, TlvType, GenericTlv},
ConditionCode, PduType, ConditionCode, PduType,
}, },
util::UnsignedByteField, util::UnsignedByteField,
@ -227,7 +227,7 @@ impl DestinationHandler {
let finished_pdu = if self.tparams.tstate.condition_code == ConditionCode::NoError let finished_pdu = if self.tparams.tstate.condition_code == ConditionCode::NoError
|| self.tparams.tstate.condition_code == ConditionCode::UnsupportedChecksumType || self.tparams.tstate.condition_code == ConditionCode::UnsupportedChecksumType
{ {
FinishedPdu::new_default( FinishedPduCreator::new_default(
pdu_header, pdu_header,
self.tparams.tstate.delivery_code, self.tparams.tstate.delivery_code,
self.tparams.tstate.file_status, self.tparams.tstate.file_status,
@ -235,7 +235,7 @@ impl DestinationHandler {
} else { } else {
// TODO: Are there cases where this ID is actually the source entity ID? // TODO: Are there cases where this ID is actually the source entity ID?
let entity_id = EntityIdTlv::new(self.id); let entity_id = EntityIdTlv::new(self.id);
FinishedPdu::new_with_error( FinishedPduCreator::new_with_error(
pdu_header, pdu_header,
self.tparams.tstate.condition_code, self.tparams.tstate.condition_code,
self.tparams.tstate.delivery_code, self.tparams.tstate.delivery_code,
@ -283,7 +283,7 @@ impl DestinationHandler {
if self.state != State::Idle { if self.state != State::Idle {
return Err(DestError::RecvdMetadataButIsBusy); return Err(DestError::RecvdMetadataButIsBusy);
} }
let metadata_pdu = MetadataPdu::from_bytes(raw_packet)?; let metadata_pdu = MetadataPduReader::from_bytes(raw_packet)?;
self.tparams.reset(); self.tparams.reset();
self.tparams.tstate.metadata_params = *metadata_pdu.metadata_params(); self.tparams.tstate.metadata_params = *metadata_pdu.metadata_params();
let src_name = metadata_pdu.src_file_name(); let src_name = metadata_pdu.src_file_name();
@ -302,7 +302,7 @@ impl DestinationHandler {
self.tparams.file_properties.dest_file_name_len = dest_name.len_value(); self.tparams.file_properties.dest_file_name_len = dest_name.len_value();
self.tparams.pdu_conf = *metadata_pdu.pdu_header().common_pdu_conf(); self.tparams.pdu_conf = *metadata_pdu.pdu_header().common_pdu_conf();
self.tparams.msgs_to_user_size = 0; self.tparams.msgs_to_user_size = 0;
if metadata_pdu.options().is_some() { if !metadata_pdu.options().is_empty() {
for option_tlv in metadata_pdu.options_iter().unwrap() { for option_tlv in metadata_pdu.options_iter().unwrap() {
if option_tlv.is_standard_tlv() if option_tlv.is_standard_tlv()
&& option_tlv.tlv_type().unwrap() == TlvType::MsgToUser && option_tlv.tlv_type().unwrap() == TlvType::MsgToUser
@ -520,7 +520,7 @@ mod tests {
use alloc::{format, string::String}; use alloc::{format, string::String};
use rand::Rng; use rand::Rng;
use spacepackets::{ use spacepackets::{
cfdp::{lv::Lv, pdu::WritablePduPacket, ChecksumType, TransmissionMode}, cfdp::{lv::Lv, pdu::{WritablePduPacket, metadata::MetadataPduCreator}, ChecksumType, TransmissionMode},
util::{UbfU16, UnsignedByteFieldU16}, util::{UbfU16, UnsignedByteFieldU16},
}; };
@ -743,14 +743,13 @@ mod tests {
src_name: &'filename Path, src_name: &'filename Path,
dest_name: &'filename Path, dest_name: &'filename Path,
file_size: u64, file_size: u64,
) -> MetadataPdu<'filename, 'filename, 'static> { ) -> MetadataPduCreator<'filename, 'filename, 'static> {
let metadata_params = MetadataGenericParams::new(false, ChecksumType::Crc32, file_size); let metadata_params = MetadataGenericParams::new(false, ChecksumType::Crc32, file_size);
MetadataPdu::new( MetadataPduCreator::new_no_opts(
*pdu_header, *pdu_header,
metadata_params, metadata_params,
Lv::new_from_str(src_name.as_os_str().to_str().unwrap()).unwrap(), Lv::new_from_str(src_name.as_os_str().to_str().unwrap()).unwrap(),
Lv::new_from_str(dest_name.as_os_str().to_str().unwrap()).unwrap(), Lv::new_from_str(dest_name.as_os_str().to_str().unwrap()).unwrap(),
None,
) )
} }

View File

@ -323,7 +323,7 @@ mod tests {
pdu::{ pdu::{
eof::EofPdu, eof::EofPdu,
file_data::FileDataPdu, file_data::FileDataPdu,
metadata::{MetadataGenericParams, MetadataPdu}, metadata::{MetadataGenericParams, MetadataPduCreator},
CommonPduConfig, FileDirectiveType, PduHeader, WritablePduPacket, CommonPduConfig, FileDirectiveType, PduHeader, WritablePduPacket,
}, },
PduType, PduType,
@ -347,7 +347,7 @@ mod tests {
let dest_file_name = "hello-dest.txt"; let dest_file_name = "hello-dest.txt";
let src_lv = Lv::new_from_str(src_file_name).unwrap(); let src_lv = Lv::new_from_str(src_file_name).unwrap();
let dest_lv = Lv::new_from_str(dest_file_name).unwrap(); let dest_lv = Lv::new_from_str(dest_file_name).unwrap();
let metadata_pdu = MetadataPdu::new(pdu_header, metadata_params, src_lv, dest_lv, None); let metadata_pdu = MetadataPduCreator::new_no_opts(pdu_header, metadata_params, src_lv, dest_lv);
metadata_pdu metadata_pdu
.write_to_bytes(&mut buf) .write_to_bytes(&mut buf)
.expect("writing metadata PDU failed"); .expect("writing metadata PDU failed");

View File

@ -113,7 +113,7 @@ pub fn parse_buffer_for_ccsds_space_packets<E>(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use spacepackets::{ use spacepackets::{
ecss::{tc::PusTcCreator, SerializablePusPacket}, ecss::{tc::PusTcCreator, WritablePusPacket},
PacketId, SpHeader, PacketId, SpHeader,
}; };

View File

@ -173,7 +173,7 @@ mod tests {
use alloc::{boxed::Box, sync::Arc}; use alloc::{boxed::Box, sync::Arc};
use hashbrown::HashSet; use hashbrown::HashSet;
use spacepackets::{ use spacepackets::{
ecss::{tc::PusTcCreator, SerializablePusPacket}, ecss::{tc::PusTcCreator, WritablePusPacket},
PacketId, SpHeader, PacketId, SpHeader,
}; };

View File

@ -19,7 +19,7 @@ use std::vec::Vec;
/// ///
/// ``` /// ```
/// use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket}; /// use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket};
/// use spacepackets::ecss::SerializablePusPacket; /// use spacepackets::ecss::WritablePusPacket;
/// use satrs_core::hal::std::udp_server::UdpTcServer; /// use satrs_core::hal::std::udp_server::UdpTcServer;
/// use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore}; /// use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore};
/// use spacepackets::SpHeader; /// use spacepackets::SpHeader;
@ -144,7 +144,7 @@ mod tests {
use crate::hal::std::udp_server::{ReceiveResult, UdpTcServer}; use crate::hal::std::udp_server::{ReceiveResult, UdpTcServer};
use crate::tmtc::ReceivesTcCore; use crate::tmtc::ReceivesTcCore;
use spacepackets::ecss::tc::PusTcCreator; use spacepackets::ecss::tc::PusTcCreator;
use spacepackets::ecss::SerializablePusPacket; use spacepackets::ecss::WritablePusPacket;
use spacepackets::SpHeader; use spacepackets::SpHeader;
use std::boxed::Box; use std::boxed::Box;
use std::collections::VecDeque; use std::collections::VecDeque;

View File

@ -147,7 +147,7 @@ impl EventReporterBase {
Ok(PusTmCreator::new( Ok(PusTmCreator::new(
&mut sp_header, &mut sp_header,
sec_header, sec_header,
Some(&buf[0..current_idx]), &buf[0..current_idx],
true, true,
)) ))
} }

View File

@ -626,7 +626,7 @@ mod tests {
use crate::pool::{LocalPool, PoolCfg, PoolProvider, StoreAddr, StoreError}; use crate::pool::{LocalPool, PoolCfg, PoolProvider, StoreAddr, StoreError};
use alloc::collections::btree_map::Range; use alloc::collections::btree_map::Range;
use spacepackets::ecss::tc::{PusTcCreator, PusTcReader, PusTcSecondaryHeader}; use spacepackets::ecss::tc::{PusTcCreator, PusTcReader, PusTcSecondaryHeader};
use spacepackets::ecss::SerializablePusPacket; use spacepackets::ecss::WritablePusPacket;
use spacepackets::time::{cds, TimeWriter, UnixTimestamp}; use spacepackets::time::{cds, TimeWriter, UnixTimestamp};
use spacepackets::SpHeader; use spacepackets::SpHeader;
use std::time::Duration; use std::time::Duration;

View File

@ -72,7 +72,7 @@ impl PusServiceHandler for PusService17TestHandler {
// Sequence count will be handled centrally in TM funnel. // Sequence count will be handled centrally in TM funnel.
let mut reply_header = SpHeader::tm_unseg(self.psb.tm_apid, 0, 0).unwrap(); let mut reply_header = SpHeader::tm_unseg(self.psb.tm_apid, 0, 0).unwrap();
let tc_header = PusTmSecondaryHeader::new_simple(17, 2, &time_stamp); let tc_header = PusTmSecondaryHeader::new_simple(17, 2, &time_stamp);
let ping_reply = PusTmCreator::new(&mut reply_header, tc_header, None, true); let ping_reply = PusTmCreator::new(&mut reply_header, tc_header, &[], true);
let result = self let result = self
.psb .psb
.tm_sender .tm_sender
@ -118,7 +118,7 @@ mod tests {
use crate::tmtc::tm_helper::SharedTmStore; use crate::tmtc::tm_helper::SharedTmStore;
use spacepackets::ecss::tc::{PusTcCreator, PusTcSecondaryHeader}; use spacepackets::ecss::tc::{PusTcCreator, PusTcSecondaryHeader};
use spacepackets::ecss::tm::PusTmReader; use spacepackets::ecss::tm::PusTmReader;
use spacepackets::ecss::{PusPacket, SerializablePusPacket}; use spacepackets::ecss::{PusPacket, WritablePusPacket};
use spacepackets::{SequenceFlags, SpHeader}; use spacepackets::{SequenceFlags, SpHeader};
use std::boxed::Box; use std::boxed::Box;
use std::sync::{mpsc, RwLock}; use std::sync::{mpsc, RwLock};

View File

@ -877,7 +877,7 @@ impl VerificationReporterCore {
PusTmCreator::new( PusTmCreator::new(
sp_header, sp_header,
tm_sec_header, tm_sec_header,
Some(&src_data_buf[0..source_data_len]), &src_data_buf[0..source_data_len],
true, true,
) )
} }

View File

@ -21,7 +21,7 @@
//! use satrs_core::tmtc::ccsds_distrib::{CcsdsPacketHandler, CcsdsDistributor}; //! use satrs_core::tmtc::ccsds_distrib::{CcsdsPacketHandler, CcsdsDistributor};
//! use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore}; //! use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore};
//! use spacepackets::{CcsdsPacket, SpHeader}; //! use spacepackets::{CcsdsPacket, SpHeader};
//! use spacepackets::ecss::SerializablePusPacket; //! use spacepackets::ecss::WritablePusPacket;
//! use spacepackets::ecss::tc::{PusTc, PusTcCreator}; //! use spacepackets::ecss::tc::{PusTc, PusTcCreator};
//! //!
//! #[derive (Default)] //! #[derive (Default)]
@ -226,7 +226,7 @@ pub(crate) mod tests {
use super::*; use super::*;
use crate::tmtc::ccsds_distrib::{CcsdsDistributor, CcsdsPacketHandler}; use crate::tmtc::ccsds_distrib::{CcsdsDistributor, CcsdsPacketHandler};
use spacepackets::ecss::tc::PusTcCreator; use spacepackets::ecss::tc::PusTcCreator;
use spacepackets::ecss::SerializablePusPacket; use spacepackets::ecss::WritablePusPacket;
use spacepackets::CcsdsPacket; use spacepackets::CcsdsPacket;
use std::collections::VecDeque; use std::collections::VecDeque;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
@ -244,9 +244,10 @@ pub(crate) mod tests {
&buf[0..size] &buf[0..size]
} }
type SharedPacketQueue = Arc<Mutex<VecDeque<(u16, Vec<u8>)>>>;
pub struct BasicApidHandlerSharedQueue { pub struct BasicApidHandlerSharedQueue {
pub known_packet_queue: Arc<Mutex<VecDeque<(u16, Vec<u8>)>>>, pub known_packet_queue: SharedPacketQueue,
pub unknown_packet_queue: Arc<Mutex<VecDeque<(u16, Vec<u8>)>>>, pub unknown_packet_queue: SharedPacketQueue,
} }
#[derive(Default)] #[derive(Default)]
@ -268,11 +269,11 @@ pub(crate) mod tests {
) -> Result<(), Self::Error> { ) -> Result<(), Self::Error> {
let mut vec = Vec::new(); let mut vec = Vec::new();
vec.extend_from_slice(tc_raw); vec.extend_from_slice(tc_raw);
Ok(self self.known_packet_queue
.known_packet_queue
.lock() .lock()
.unwrap() .unwrap()
.push_back((sp_header.apid(), vec))) .push_back((sp_header.apid(), vec));
Ok(())
} }
fn handle_unknown_apid( fn handle_unknown_apid(
@ -282,11 +283,11 @@ pub(crate) mod tests {
) -> Result<(), Self::Error> { ) -> Result<(), Self::Error> {
let mut vec = Vec::new(); let mut vec = Vec::new();
vec.extend_from_slice(tc_raw); vec.extend_from_slice(tc_raw);
Ok(self self.unknown_packet_queue
.unknown_packet_queue
.lock() .lock()
.unwrap() .unwrap()
.push_back((sp_header.apid(), vec))) .push_back((sp_header.apid(), vec));
Ok(())
} }
} }

View File

@ -18,7 +18,7 @@
//! # Example //! # Example
//! //!
//! ```rust //! ```rust
//! use spacepackets::ecss::SerializablePusPacket; //! use spacepackets::ecss::WritablePusPacket;
//! use satrs_core::tmtc::pus_distrib::{PusDistributor, PusServiceProvider}; //! use satrs_core::tmtc::pus_distrib::{PusDistributor, PusServiceProvider};
//! use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore}; //! use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore};
//! use spacepackets::SpHeader; //! use spacepackets::SpHeader;

View File

@ -1,7 +1,7 @@
#![allow(dead_code)] #![allow(dead_code)]
use core::mem::size_of; use core::mem::size_of;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use spacepackets::ecss::{Ptc, RealPfc, UnsignedPfc}; use spacepackets::ecss::{Ptc, PfcReal, PfcUnsigned};
use spacepackets::time::cds::TimeProvider; use spacepackets::time::cds::TimeProvider;
use spacepackets::time::{CcsdsTimeProvider, TimeWriter}; use spacepackets::time::{CcsdsTimeProvider, TimeWriter};
@ -64,7 +64,7 @@ impl TestMgmHkWithIndividualValidity {
curr_idx += 1; curr_idx += 1;
buf[curr_idx] = Ptc::Real as u8; buf[curr_idx] = Ptc::Real as u8;
curr_idx += 1; curr_idx += 1;
buf[curr_idx] = RealPfc::Float as u8; buf[curr_idx] = PfcReal::Float as u8;
curr_idx += 1; curr_idx += 1;
buf[curr_idx..curr_idx + size_of::<f32>()].copy_from_slice(&self.temp.val.to_be_bytes()); buf[curr_idx..curr_idx + size_of::<f32>()].copy_from_slice(&self.temp.val.to_be_bytes());
curr_idx += size_of::<f32>(); curr_idx += size_of::<f32>();
@ -75,7 +75,7 @@ impl TestMgmHkWithIndividualValidity {
curr_idx += 1; curr_idx += 1;
buf[curr_idx] = Ptc::UnsignedInt as u8; buf[curr_idx] = Ptc::UnsignedInt as u8;
curr_idx += 1; curr_idx += 1;
buf[curr_idx] = UnsignedPfc::TwoBytes as u8; buf[curr_idx] = PfcUnsigned::TwoBytes as u8;
curr_idx += 1; curr_idx += 1;
buf[curr_idx] = 3; buf[curr_idx] = 3;
curr_idx += 1; curr_idx += 1;
@ -100,7 +100,7 @@ impl TestMgmHkWithGroupValidity {
curr_idx += 1; curr_idx += 1;
buf[curr_idx] = Ptc::Real as u8; buf[curr_idx] = Ptc::Real as u8;
curr_idx += 1; curr_idx += 1;
buf[curr_idx] = RealPfc::Float as u8; buf[curr_idx] = PfcReal::Float as u8;
curr_idx += 1; curr_idx += 1;
buf[curr_idx..curr_idx + size_of::<f32>()].copy_from_slice(&self.temp.to_be_bytes()); buf[curr_idx..curr_idx + size_of::<f32>()].copy_from_slice(&self.temp.to_be_bytes());
curr_idx += size_of::<f32>(); curr_idx += size_of::<f32>();
@ -109,7 +109,7 @@ impl TestMgmHkWithGroupValidity {
curr_idx += 1; curr_idx += 1;
buf[curr_idx] = Ptc::UnsignedInt as u8; buf[curr_idx] = Ptc::UnsignedInt as u8;
curr_idx += 1; curr_idx += 1;
buf[curr_idx] = UnsignedPfc::TwoBytes as u8; buf[curr_idx] = PfcUnsigned::TwoBytes as u8;
curr_idx += 1; curr_idx += 1;
buf[curr_idx] = 3; buf[curr_idx] = 3;
for val in self.mgm_vals { for val in self.mgm_vals {

View File

@ -28,7 +28,7 @@ use satrs_core::{
tmtc::{ReceivesTcCore, TmPacketSourceCore}, tmtc::{ReceivesTcCore, TmPacketSourceCore},
}; };
use spacepackets::{ use spacepackets::{
ecss::{tc::PusTcCreator, SerializablePusPacket}, ecss::{tc::PusTcCreator, WritablePusPacket},
PacketId, SpHeader, PacketId, SpHeader,
}; };
use std::{boxed::Box, collections::VecDeque, sync::Arc, vec::Vec}; use std::{boxed::Box, collections::VecDeque, sync::Arc, vec::Vec};