From 8313a0b26c28dbf003fca4a9c5f5804e164bd398 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 15 Apr 2024 14:13:10 +0200 Subject: [PATCH] another small update --- Cargo.lock | 12 ++++++------ src/interface/tcp_server.rs | 3 +-- src/interface/tcp_spp_client.rs | 2 +- src/interface/udp_server.rs | 2 +- src/pus/action.rs | 3 ++- src/pus/mod.rs | 3 ++- src/pus/test.rs | 3 ++- src/tmtc/tc_source.rs | 12 ++++++------ src/tmtc/tm_sink.rs | 2 +- 9 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9b62799..2bec391 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -150,9 +150,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", @@ -590,7 +590,7 @@ checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "satrs" version = "0.2.0-rc.0" -source = "git+https://egit.irs.uni-stuttgart.de/rust/sat-rs.git?branch=rework-tmtc-modules#301a7a19a62a4f4541e8c7299cd67ab347c44352" +source = "git+https://egit.irs.uni-stuttgart.de/rust/sat-rs.git?branch=rework-tmtc-modules#794094ae9fc948cc1575c48d2d57cfe0deb8c799" dependencies = [ "bus", "cobs", @@ -615,7 +615,7 @@ dependencies = [ [[package]] name = "satrs-mib" version = "0.1.1" -source = "git+https://egit.irs.uni-stuttgart.de/rust/sat-rs.git?branch=rework-tmtc-modules#301a7a19a62a4f4541e8c7299cd67ab347c44352" +source = "git+https://egit.irs.uni-stuttgart.de/rust/sat-rs.git?branch=rework-tmtc-modules#794094ae9fc948cc1575c48d2d57cfe0deb8c799" dependencies = [ "csv", "satrs-mib-codegen", @@ -627,7 +627,7 @@ dependencies = [ [[package]] name = "satrs-mib-codegen" version = "0.1.1" -source = "git+https://egit.irs.uni-stuttgart.de/rust/sat-rs.git?branch=rework-tmtc-modules#301a7a19a62a4f4541e8c7299cd67ab347c44352" +source = "git+https://egit.irs.uni-stuttgart.de/rust/sat-rs.git?branch=rework-tmtc-modules#794094ae9fc948cc1575c48d2d57cfe0deb8c799" dependencies = [ "proc-macro2", "quote", @@ -637,7 +637,7 @@ dependencies = [ [[package]] name = "satrs-shared" version = "0.1.3" -source = "git+https://egit.irs.uni-stuttgart.de/rust/sat-rs.git?branch=rework-tmtc-modules#301a7a19a62a4f4541e8c7299cd67ab347c44352" +source = "git+https://egit.irs.uni-stuttgart.de/rust/sat-rs.git?branch=rework-tmtc-modules#794094ae9fc948cc1575c48d2d57cfe0deb8c799" dependencies = [ "serde", "spacepackets", diff --git a/src/interface/tcp_server.rs b/src/interface/tcp_server.rs index 52df8ea..42b7b40 100644 --- a/src/interface/tcp_server.rs +++ b/src/interface/tcp_server.rs @@ -8,10 +8,9 @@ use log::{info, warn}; use ops_sat_rs::config::tasks::STOP_CHECK_FREQUENCY; use satrs::{ hal::std::tcp_server::{HandledConnectionHandler, ServerConfig, TcpSpacepacketsServer}, - pus::PacketAsVec, queue::GenericSendError, spacepackets::PacketId, - tmtc::PacketSource, + tmtc::{PacketAsVec, PacketSource}, }; #[derive(Default, Clone)] diff --git a/src/interface/tcp_spp_client.rs b/src/interface/tcp_spp_client.rs index 39ad72d..d8d6936 100644 --- a/src/interface/tcp_spp_client.rs +++ b/src/interface/tcp_spp_client.rs @@ -8,8 +8,8 @@ use mio::{Events, Interest, Poll, Token}; use ops_sat_rs::config::tasks::STOP_CHECK_FREQUENCY; use ops_sat_rs::config::{EXPERIMENT_PACKET_ID, TCP_SPP_SERVER_PORT}; use satrs::encoding::ccsds::parse_buffer_for_ccsds_space_packets; -use satrs::pus::PacketAsVec; use satrs::queue::GenericSendError; +use satrs::tmtc::PacketAsVec; use satrs::ComponentId; use thiserror::Error; diff --git a/src/interface/udp_server.rs b/src/interface/udp_server.rs index d10292d..9a6cfb8 100644 --- a/src/interface/udp_server.rs +++ b/src/interface/udp_server.rs @@ -3,8 +3,8 @@ use std::sync::mpsc; use log::{info, warn}; use satrs::hal::std::udp_server::{ReceiveResult, UdpTcServer}; -use satrs::pus::PacketAsVec; use satrs::queue::GenericSendError; +use satrs::tmtc::PacketAsVec; use crate::pus::HandlingStatus; diff --git a/src/pus/action.rs b/src/pus/action.rs index d4bf2d1..cd2472f 100644 --- a/src/pus/action.rs +++ b/src/pus/action.rs @@ -12,12 +12,13 @@ use satrs::pus::verification::{ }; use satrs::pus::{ ActiveRequestProvider, EcssTcAndToken, EcssTcInVecConverter, EcssTmSender, EcssTmtcError, - GenericConversionError, PacketAsVec, PusPacketHandlerResult, PusReplyHandler, PusServiceHelper, + GenericConversionError, PusPacketHandlerResult, PusReplyHandler, PusServiceHelper, PusTcToRequestConverter, }; use satrs::request::{GenericMessage, UniqueApidTargetId}; use satrs::spacepackets::ecss::tc::PusTcReader; use satrs::spacepackets::ecss::{EcssEnumU16, PusPacket}; +use satrs::tmtc::PacketAsVec; use std::sync::mpsc; use std::time::Duration; diff --git a/src/pus/mod.rs b/src/pus/mod.rs index 903c677..bc323b0 100644 --- a/src/pus/mod.rs +++ b/src/pus/mod.rs @@ -468,8 +468,9 @@ pub(crate) mod tests { use std::time::Duration; use satrs::pus::test_util::TEST_COMPONENT_ID_0; - use satrs::pus::{MpscTmAsVecSender, PacketAsVec, PusTmVariant}; + use satrs::pus::{MpscTmAsVecSender, PusTmVariant}; use satrs::request::RequestId; + use satrs::tmtc::PacketAsVec; use satrs::{ pus::{ verification::test_util::TestVerificationReporter, ActivePusRequestStd, diff --git a/src/pus/test.rs b/src/pus/test.rs index bf3596d..8428be7 100644 --- a/src/pus/test.rs +++ b/src/pus/test.rs @@ -7,12 +7,13 @@ use satrs::pus::test::PusService17TestHandler; use satrs::pus::verification::{FailParams, VerificationReporter, VerificationReportingProvider}; use satrs::pus::{ EcssTcAndToken, EcssTcInMemConverter, EcssTcInVecConverter, MpscTcReceiver, MpscTmAsVecSender, - PacketAsVec, PusPacketHandlerResult, PusServiceHelper, + PusPacketHandlerResult, PusServiceHelper, }; use satrs::spacepackets::ecss::tc::PusTcReader; use satrs::spacepackets::ecss::PusPacket; use satrs::spacepackets::time::cds::CdsTime; use satrs::spacepackets::time::TimeWriter; +use satrs::tmtc::PacketAsVec; use std::sync::mpsc; use super::HandlingStatus; diff --git a/src/tmtc/tc_source.rs b/src/tmtc/tc_source.rs index d75004f..02cf5d0 100644 --- a/src/tmtc/tc_source.rs +++ b/src/tmtc/tc_source.rs @@ -1,8 +1,8 @@ use std::sync::mpsc::{self, TryRecvError}; -use satrs::pus::{MpscTmAsVecSender, PacketAsVec}; +use satrs::{pus::MpscTmAsVecSender, tmtc::PacketAsVec}; -use crate::pus::PusTcDistributor; +use crate::pus::{HandlingStatus, PusTcDistributor}; // TC source components where the heap is the backing memory of the received telecommands. pub struct TcSourceTaskDynamic { @@ -25,7 +25,7 @@ impl TcSourceTaskDynamic { self.poll_tc(); } - pub fn poll_tc(&mut self) -> bool { + pub fn poll_tc(&mut self) -> HandlingStatus { // Right now, we only expect PUS packets. If any other protocols like CFDP are added at // a later stage, we probably need to check for the APID before routing the packet. match self.tc_receiver.try_recv() { @@ -33,13 +33,13 @@ impl TcSourceTaskDynamic { self.pus_distrib .handle_tc_packet(packet_with_sender.sender_id, packet_with_sender.packet) .ok(); - true + HandlingStatus::HandledOne } Err(e) => match e { - TryRecvError::Empty => false, + TryRecvError::Empty => HandlingStatus::Empty, TryRecvError::Disconnected => { log::warn!("tmtc thread: sender disconnected"); - false + HandlingStatus::Empty } }, } diff --git a/src/tmtc/tm_sink.rs b/src/tmtc/tm_sink.rs index 5e8b236..9dfac6f 100644 --- a/src/tmtc/tm_sink.rs +++ b/src/tmtc/tm_sink.rs @@ -4,7 +4,7 @@ use std::{collections::HashMap, sync::mpsc, time::Duration}; use log::info; use ops_sat_rs::config::tasks::STOP_CHECK_FREQUENCY; -use satrs::pus::PacketAsVec; +use satrs::tmtc::PacketAsVec; use satrs::{ seq_count::{CcsdsSimpleSeqCountProvider, SequenceCountProviderCore}, spacepackets::{