some more deprecated API replacements

This commit is contained in:
Robin Müller 2023-07-11 22:25:43 +02:00
parent 13b7c50e74
commit 0b4c1e8604
Signed by: muellerr
GPG Key ID: A649FB78196E3849
5 changed files with 14 additions and 14 deletions

View File

@ -64,7 +64,7 @@ optional = true
# version = "0.6" # version = "0.6"
# path = "../spacepackets" # path = "../spacepackets"
git = "https://egit.irs.uni-stuttgart.de/rust/spacepackets.git" git = "https://egit.irs.uni-stuttgart.de/rust/spacepackets.git"
rev = "3c8f9f9f07cf" rev = "62df510147b"
default-features = false default-features = false
[dev-dependencies] [dev-dependencies]

View File

@ -658,7 +658,7 @@ pub(crate) mod tests {
impl CommonTmInfo { impl CommonTmInfo {
pub fn new_from_tm(tm: &PusTmCreator) -> Self { pub fn new_from_tm(tm: &PusTmCreator) -> Self {
let mut time_stamp = [0; 7]; let mut time_stamp = [0; 7];
time_stamp.clone_from_slice(&tm.timestamp().unwrap()[0..7]); time_stamp.clone_from_slice(&tm.timestamp()[0..7]);
Self { Self {
subservice: tm.subservice(), subservice: tm.subservice(),
apid: tm.apid(), apid: tm.apid(),

View File

@ -1327,7 +1327,7 @@ mod tests {
use alloc::boxed::Box; use alloc::boxed::Box;
use alloc::format; use alloc::format;
use spacepackets::ecss::tc::{PusTcCreator, PusTcSecondaryHeader}; use spacepackets::ecss::tc::{PusTcCreator, PusTcSecondaryHeader};
use spacepackets::ecss::tm::PusTm; use spacepackets::ecss::tm::PusTmReader;
use spacepackets::ecss::{EcssEnumU16, EcssEnumU32, EcssEnumU8, PusError, PusPacket}; use spacepackets::ecss::{EcssEnumU16, EcssEnumU32, EcssEnumU8, PusError, PusPacket};
use spacepackets::util::UnsignedEnum; use spacepackets::util::UnsignedEnum;
use spacepackets::{ByteConversionError, CcsdsPacket, SpHeader}; use spacepackets::{ByteConversionError, CcsdsPacket, SpHeader};
@ -1376,7 +1376,7 @@ mod tests {
assert_eq!(PusPacket::service(&tm), 1); assert_eq!(PusPacket::service(&tm), 1);
assert!(!tm.source_data().is_empty()); assert!(!tm.source_data().is_empty());
let mut time_stamp = [0; 7]; let mut time_stamp = [0; 7];
time_stamp.clone_from_slice(&tm.timestamp().unwrap()[0..7]); time_stamp.clone_from_slice(&tm.timestamp()[0..7]);
let src_data = tm.source_data(); let src_data = tm.source_data();
assert!(src_data.len() >= 4); assert!(src_data.len() >= 4);
let req_id = let req_id =
@ -2181,7 +2181,7 @@ mod tests {
tm_buf[0..tm_len].copy_from_slice(slice); tm_buf[0..tm_len].copy_from_slice(slice);
} }
let (pus_tm, _) = let (pus_tm, _) =
PusTm::from_bytes(&tm_buf[0..tm_len], 7).expect("Error reading verification TM"); PusTmReader::new(&tm_buf[0..tm_len], 7).expect("Error reading verification TM");
if packet_idx == 0 { if packet_idx == 0 {
assert_eq!(pus_tm.subservice(), 1); assert_eq!(pus_tm.subservice(), 1);
assert_eq!(pus_tm.sp_header.seq_count(), 0); assert_eq!(pus_tm.sp_header.seq_count(), 0);

View File

@ -8,7 +8,7 @@ use satrs_core::pus::event_man::{
DefaultPusMgmtBackendProvider, EventReporter, PusEventDispatcher, DefaultPusMgmtBackendProvider, EventReporter, PusEventDispatcher,
}; };
use satrs_core::pus::MpscTmAsVecSender; use satrs_core::pus::MpscTmAsVecSender;
use spacepackets::ecss::tm::PusTm; use spacepackets::ecss::tm::PusTmReader;
use spacepackets::ecss::{PusError, PusPacket}; use spacepackets::ecss::{PusError, PusPacket};
use std::sync::mpsc::{channel, SendError, TryRecvError}; use std::sync::mpsc::{channel, SendError, TryRecvError};
use std::thread; use std::thread;
@ -103,7 +103,7 @@ fn test_threaded_usage() {
// Event TM received successfully // Event TM received successfully
Ok(event_tm) => { Ok(event_tm) => {
let tm = let tm =
PusTm::from_bytes(event_tm.as_slice(), 7).expect("Deserializing TM failed"); PusTmReader::new(event_tm.as_slice(), 7).expect("Deserializing TM failed");
assert_eq!(tm.0.service(), 5); assert_eq!(tm.0.service(), 5);
assert_eq!(tm.0.subservice(), 1); assert_eq!(tm.0.subservice(), 1);
let src_data = tm.0.source_data(); let src_data = tm.0.source_data();
@ -132,7 +132,7 @@ fn test_threaded_usage() {
// Event TM received successfully // Event TM received successfully
Ok(event_tm) => { Ok(event_tm) => {
let tm = let tm =
PusTm::from_bytes(event_tm.as_slice(), 7).expect("Deserializing TM failed"); PusTmReader::new(event_tm.as_slice(), 7).expect("Deserializing TM failed");
assert_eq!(tm.0.service(), 5); assert_eq!(tm.0.service(), 5);
assert_eq!(tm.0.subservice(), 2); assert_eq!(tm.0.subservice(), 2);
let src_data = tm.0.source_data(); let src_data = tm.0.source_data();

View File

@ -9,8 +9,8 @@ pub mod crossbeam_test {
}; };
use satrs_core::pus::MpscTmInStoreSender; use satrs_core::pus::MpscTmInStoreSender;
use satrs_core::tmtc::tm_helper::SharedTmStore; use satrs_core::tmtc::tm_helper::SharedTmStore;
use spacepackets::ecss::tc::{PusTc, PusTcCreator, PusTcSecondaryHeader}; use spacepackets::ecss::tc::{PusTcCreator, PusTcReader, PusTcSecondaryHeader};
use spacepackets::ecss::tm::PusTm; use spacepackets::ecss::tm::PusTmReader;
use spacepackets::ecss::{EcssEnumU16, EcssEnumU8, PusPacket, SerializablePusPacket}; use spacepackets::ecss::{EcssEnumU16, EcssEnumU8, PusPacket, SerializablePusPacket};
use spacepackets::SpHeader; use spacepackets::SpHeader;
use std::sync::{mpsc, Arc, RwLock}; use std::sync::{mpsc, Arc, RwLock};
@ -82,7 +82,7 @@ pub mod crossbeam_test {
tc_len = buf.len(); tc_len = buf.len();
tc_buf[0..tc_len].copy_from_slice(buf); tc_buf[0..tc_len].copy_from_slice(buf);
} }
let (_tc, _) = PusTc::from_bytes(&tc_buf[0..tc_len]).unwrap(); let (_tc, _) = PusTcReader::new(&tc_buf[0..tc_len]).unwrap();
let accepted_token; let accepted_token;
let token = reporter_with_sender_0.add_tc_with_req_id(req_id_0); let token = reporter_with_sender_0.add_tc_with_req_id(req_id_0);
@ -122,7 +122,7 @@ pub mod crossbeam_test {
tc_len = buf.len(); tc_len = buf.len();
tc_buf[0..tc_len].copy_from_slice(buf); tc_buf[0..tc_len].copy_from_slice(buf);
} }
let (tc, _) = PusTc::from_bytes(&tc_buf[0..tc_len]).unwrap(); let (tc, _) = PusTcReader::new(&tc_buf[0..tc_len]).unwrap();
let token = reporter_with_sender_1.add_tc(&tc); let token = reporter_with_sender_1.add_tc(&tc);
let accepted_token = reporter_with_sender_1 let accepted_token = reporter_with_sender_1
.acceptance_success(token, Some(&FIXED_STAMP)) .acceptance_success(token, Some(&FIXED_STAMP))
@ -154,8 +154,8 @@ pub mod crossbeam_test {
tm_len = slice.len(); tm_len = slice.len();
tm_buf[0..tm_len].copy_from_slice(slice); tm_buf[0..tm_len].copy_from_slice(slice);
} }
let (pus_tm, _) = PusTm::from_bytes(&tm_buf[0..tm_len], 7) let (pus_tm, _) =
.expect("Error reading verification TM"); PusTmReader::new(&tm_buf[0..tm_len], 7).expect("Error reading verification TM");
let req_id = let req_id =
RequestId::from_bytes(&pus_tm.source_data()[0..RequestId::SIZE_AS_BYTES]) RequestId::from_bytes(&pus_tm.source_data()[0..RequestId::SIZE_AS_BYTES])
.expect("reading request ID from PUS TM source data failed"); .expect("reading request ID from PUS TM source data failed");