updated example as well
This commit is contained in:
parent
04516cf414
commit
300ea91c6b
@ -64,7 +64,7 @@ optional = true
|
||||
# version = "0.6"
|
||||
# path = "../spacepackets"
|
||||
git = "https://egit.irs.uni-stuttgart.de/rust/spacepackets.git"
|
||||
rev = "46eab3529004"
|
||||
rev = "3c8f9f9f07cf"
|
||||
default-features = false
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -9,7 +9,7 @@ use crate::pus::{
|
||||
PusPacketHandlingError, PusServiceBase, PusServiceHandler,
|
||||
};
|
||||
use spacepackets::ecss::event::Subservice;
|
||||
use spacepackets::ecss::tc::PusTc;
|
||||
use spacepackets::ecss::tc::PusTcReader;
|
||||
use spacepackets::ecss::PusPacket;
|
||||
use std::boxed::Box;
|
||||
use std::sync::mpsc::Sender;
|
||||
@ -55,7 +55,7 @@ impl PusServiceHandler for PusService5EventHandler {
|
||||
token: VerificationToken<TcStateAccepted>,
|
||||
) -> Result<PusPacketHandlerResult, PusPacketHandlingError> {
|
||||
self.copy_tc_to_buf(addr)?;
|
||||
let (tc, _) = PusTc::from_bytes(&self.psb.pus_buf)?;
|
||||
let (tc, _) = PusTcReader::new(&self.psb.pus_buf)?;
|
||||
let subservice = tc.subservice();
|
||||
let srv = Subservice::try_from(subservice);
|
||||
if srv.is_err() {
|
||||
|
@ -5,7 +5,7 @@ use crate::pus::{
|
||||
EcssTcReceiver, EcssTmSender, PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase,
|
||||
PusServiceHandler,
|
||||
};
|
||||
use spacepackets::ecss::tc::PusTc;
|
||||
use spacepackets::ecss::tc::PusTcReader;
|
||||
use spacepackets::ecss::{scheduling, PusPacket};
|
||||
use spacepackets::time::cds::TimeProvider;
|
||||
use std::boxed::Box;
|
||||
@ -67,7 +67,7 @@ impl PusServiceHandler for PusService11SchedHandler {
|
||||
token: VerificationToken<TcStateAccepted>,
|
||||
) -> Result<PusPacketHandlerResult, PusPacketHandlingError> {
|
||||
self.copy_tc_to_buf(addr)?;
|
||||
let (tc, _) = PusTc::from_bytes(&self.psb.pus_buf)?;
|
||||
let (tc, _) = PusTcReader::new(&self.psb.pus_buf)?;
|
||||
let subservice = tc.subservice();
|
||||
let std_service = scheduling::Subservice::try_from(subservice);
|
||||
if std_service.is_err() {
|
||||
|
@ -4,7 +4,7 @@ use crate::pus::{
|
||||
EcssTcReceiver, EcssTmSender, PartialPusHandlingError, PusPacketHandlerResult,
|
||||
PusPacketHandlingError, PusServiceBase, PusServiceHandler, PusTmWrapper,
|
||||
};
|
||||
use spacepackets::ecss::tc::PusTc;
|
||||
use spacepackets::ecss::tc::PusTcReader;
|
||||
use spacepackets::ecss::tm::{PusTmCreator, PusTmSecondaryHeader};
|
||||
use spacepackets::ecss::PusPacket;
|
||||
use spacepackets::SpHeader;
|
||||
@ -50,7 +50,7 @@ impl PusServiceHandler for PusService17TestHandler {
|
||||
token: VerificationToken<TcStateAccepted>,
|
||||
) -> Result<PusPacketHandlerResult, PusPacketHandlingError> {
|
||||
self.copy_tc_to_buf(addr)?;
|
||||
let (tc, _) = PusTc::from_bytes(&self.psb.pus_buf)?;
|
||||
let (tc, _) = PusTcReader::new(&self.psb.pus_buf)?;
|
||||
if tc.service() != 17 {
|
||||
return Err(PusPacketHandlingError::WrongService(tc.service()));
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ use satrs_core::pus::{
|
||||
EcssTcReceiver, EcssTmSender, PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase,
|
||||
PusServiceHandler,
|
||||
};
|
||||
use satrs_core::spacepackets::ecss::tc::PusTc;
|
||||
use satrs_core::spacepackets::ecss::tc::PusTcReader;
|
||||
use satrs_core::spacepackets::ecss::PusPacket;
|
||||
use satrs_core::tmtc::TargetId;
|
||||
use satrs_example::tmtc_err;
|
||||
@ -46,7 +46,7 @@ impl PusService8ActionHandler {
|
||||
fn handle_action_request_with_id(
|
||||
&self,
|
||||
token: VerificationToken<TcStateAccepted>,
|
||||
tc: &PusTc,
|
||||
tc: &PusTcReader,
|
||||
time_stamp: &[u8],
|
||||
) -> Result<(), PusPacketHandlingError> {
|
||||
let user_data = tc.user_data();
|
||||
@ -113,7 +113,7 @@ impl PusServiceHandler for PusService8ActionHandler {
|
||||
token: VerificationToken<TcStateAccepted>,
|
||||
) -> Result<PusPacketHandlerResult, PusPacketHandlingError> {
|
||||
self.copy_tc_to_buf(addr)?;
|
||||
let (tc, _) = PusTc::from_bytes(&self.psb().pus_buf).unwrap();
|
||||
let (tc, _) = PusTcReader::new(&self.psb().pus_buf).unwrap();
|
||||
let subservice = tc.subservice();
|
||||
let mut partial_error = None;
|
||||
let time_stamp = self.psb().get_current_timestamp(&mut partial_error);
|
||||
|
@ -9,7 +9,7 @@ use satrs_core::pus::{
|
||||
EcssTcReceiver, EcssTmSender, PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase,
|
||||
PusServiceHandler,
|
||||
};
|
||||
use satrs_core::spacepackets::ecss::tc::PusTc;
|
||||
use satrs_core::spacepackets::ecss::tc::PusTcReader;
|
||||
use satrs_core::spacepackets::ecss::{hk, PusPacket};
|
||||
use satrs_core::tmtc::{AddressableId, TargetId};
|
||||
use satrs_example::{hk_err, tmtc_err};
|
||||
@ -57,7 +57,7 @@ impl PusServiceHandler for PusService3HkHandler {
|
||||
token: VerificationToken<TcStateAccepted>,
|
||||
) -> Result<PusPacketHandlerResult, PusPacketHandlingError> {
|
||||
self.copy_tc_to_buf(addr)?;
|
||||
let (tc, _) = PusTc::from_bytes(&self.psb().pus_buf).unwrap();
|
||||
let (tc, _) = PusTcReader::new(&self.psb().pus_buf).unwrap();
|
||||
let subservice = tc.subservice();
|
||||
let mut partial_error = None;
|
||||
let time_stamp = self.psb().get_current_timestamp(&mut partial_error);
|
||||
|
@ -3,7 +3,7 @@ use log::warn;
|
||||
use satrs_core::pool::StoreAddr;
|
||||
use satrs_core::pus::verification::{FailParams, StdVerifReporterWithSender};
|
||||
use satrs_core::pus::{PusPacketHandlerResult, TcAddrWithToken};
|
||||
use satrs_core::spacepackets::ecss::tc::PusTc;
|
||||
use satrs_core::spacepackets::ecss::tc::PusTcReader;
|
||||
use satrs_core::spacepackets::ecss::PusServiceId;
|
||||
use satrs_core::spacepackets::time::cds::TimeProvider;
|
||||
use satrs_core::spacepackets::time::TimeWriter;
|
||||
@ -72,7 +72,7 @@ impl PusReceiver {
|
||||
&mut self,
|
||||
store_addr: StoreAddr,
|
||||
service: u8,
|
||||
pus_tc: &PusTc,
|
||||
pus_tc: &PusTcReader,
|
||||
) -> Result<PusPacketHandlerResult, MpscStoreAndSendError> {
|
||||
let init_token = self.verif_reporter.add_tc(pus_tc);
|
||||
self.stamp_helper.update_from_now();
|
||||
|
@ -4,7 +4,7 @@ use satrs_core::params::Params;
|
||||
use satrs_core::pus::test::PusService17TestHandler;
|
||||
use satrs_core::pus::verification::FailParams;
|
||||
use satrs_core::pus::{PusPacketHandlerResult, PusServiceHandler};
|
||||
use satrs_core::spacepackets::ecss::tc::PusTc;
|
||||
use satrs_core::spacepackets::ecss::tc::PusTcReader;
|
||||
use satrs_core::spacepackets::ecss::PusPacket;
|
||||
use satrs_core::spacepackets::time::cds::TimeProvider;
|
||||
use satrs_core::spacepackets::time::TimeWriter;
|
||||
@ -40,7 +40,7 @@ impl Service17CustomWrapper {
|
||||
PusPacketHandlerResult::CustomSubservice(subservice, token) => {
|
||||
let psb_mut = self.pus17_handler.psb_mut();
|
||||
let buf = psb_mut.pus_buf;
|
||||
let (tc, _) = PusTc::from_bytes(&buf).unwrap();
|
||||
let (tc, _) = PusTcReader::new(&buf).unwrap();
|
||||
let time_stamper = TimeProvider::from_now_with_u16_days().unwrap();
|
||||
let mut stamp_buf: [u8; 7] = [0; 7];
|
||||
time_stamper.write_to_bytes(&mut stamp_buf).unwrap();
|
||||
|
@ -11,7 +11,7 @@ use crate::pus::{PusReceiver, PusTcMpscRouter};
|
||||
use satrs_core::pool::{SharedPool, StoreAddr, StoreError};
|
||||
use satrs_core::pus::verification::StdVerifReporterWithSender;
|
||||
use satrs_core::pus::{ReceivesEcssPusTc, TcAddrWithToken};
|
||||
use satrs_core::spacepackets::ecss::tc::{PusTc, PusTcReader};
|
||||
use satrs_core::spacepackets::ecss::tc::PusTcReader;
|
||||
use satrs_core::spacepackets::ecss::PusPacket;
|
||||
use satrs_core::spacepackets::SpHeader;
|
||||
use satrs_core::tmtc::tm_helper::SharedTmStore;
|
||||
@ -154,7 +154,7 @@ fn core_tmtc_loop(
|
||||
let data = pool.read(&addr).expect("reading pool failed");
|
||||
tc_buf[0..data.len()].copy_from_slice(data);
|
||||
drop(pool);
|
||||
match PusTc::from_bytes(tc_buf) {
|
||||
match PusTcReader::new(tc_buf) {
|
||||
Ok((pus_tc, _)) => {
|
||||
pus_receiver
|
||||
.handle_tc_packet(addr, pus_tc.service(), &pus_tc)
|
||||
|
Loading…
x
Reference in New Issue
Block a user