diff --git a/satrs/src/pus/mod.rs b/satrs/src/pus/mod.rs index ba0ff1d..60509ef 100644 --- a/satrs/src/pus/mod.rs +++ b/satrs/src/pus/mod.rs @@ -920,7 +920,7 @@ pub mod std_mod { } } - /// This function can be used to poll the internal [EcssTcReceiver] object for the next + /// This function can be used to poll the internal [EcssTcReceiverCore] object for the next /// telecommand packet. It will return `Ok(None)` if there are not packets available. /// In any other case, it will perform the acceptance of the ECSS TC packet using the /// internal [VerificationReportingProvider] object. It will then return the telecommand diff --git a/satrs/src/tmtc/ccsds_distrib.rs b/satrs/src/tmtc/ccsds_distrib.rs index a336a2b..b16421a 100644 --- a/satrs/src/tmtc/ccsds_distrib.rs +++ b/satrs/src/tmtc/ccsds_distrib.rs @@ -107,14 +107,11 @@ pub trait CcsdsPacketHandler { } /// The CCSDS distributor dispatches received CCSDS packets to a user provided packet handler. -/// -/// The passed APID handler is required to be [Send]able to allow more ergonomic usage with -/// threads. pub struct CcsdsDistributor, E> { /// User provided APID handler stored as a generic trait object. - /// It can be cast back to the original concrete type using the [Self::apid_handler_ref] or - /// the [Self::apid_handler_mut] method. - pub apid_handler: PacketHandler, + /// It can be cast back to the original concrete type using [Self::packet_handler] or + /// the [Self::packet_handler_mut] method. + packet_handler: PacketHandler, } #[derive(Debug, Copy, Clone, PartialEq, Eq)] @@ -174,28 +171,29 @@ impl, E: 'static> ReceivesTcCore impl, E: 'static> CcsdsDistributor { pub fn new(apid_handler: PacketHandler) -> Self { - CcsdsDistributor { apid_handler } + CcsdsDistributor { packet_handler: apid_handler } } pub fn packet_handler(&self) -> &PacketHandler { - &self.apid_handler + &self.packet_handler } + pub fn packet_handler_mut(&mut self) -> &mut PacketHandler { - &mut self.apid_handler + &mut self.packet_handler } fn dispatch_ccsds(&mut self, sp_header: &SpHeader, tc_raw: &[u8]) -> Result<(), CcsdsError> { let apid = sp_header.apid(); - let valid_apids = self.apid_handler.valid_apids(); + let valid_apids = self.packet_handler.valid_apids(); for &valid_apid in valid_apids { if valid_apid == apid { return self - .apid_handler + .packet_handler .handle_known_apid(sp_header, tc_raw) .map_err(|e| CcsdsError::CustomError(e)); } } - self.apid_handler + self.packet_handler .handle_unknown_apid(sp_header, tc_raw) .map_err(|e| CcsdsError::CustomError(e)) } diff --git a/satrs/src/tmtc/pus_distrib.rs b/satrs/src/tmtc/pus_distrib.rs index ff0ff1d..f5d6c8d 100644 --- a/satrs/src/tmtc/pus_distrib.rs +++ b/satrs/src/tmtc/pus_distrib.rs @@ -2,7 +2,7 @@ //! //! The routing components consist of two core components: //! 1. [PusDistributor] component which dispatches received packets to a user-provided handler. -//! 2. [PusServiceProvider] trait which should be implemented by the user-provided PUS packet +//! 2. [PusServiceDistributor] trait which should be implemented by the user-provided PUS packet //! handler. //! //! The [PusDistributor] implements the [ReceivesEcssPusTc], [ReceivesCcsdsTc] and the @@ -13,7 +13,7 @@ //! the raw bytestream. If this process fails, a [PusDistribError::PusError] is returned to the //! user. //! 2. If it was possible to extract both components, the packet will be passed to the -//! [PusServiceProvider::handle_pus_tc_packet] method provided by the user. +//! [PusServiceDistributor::distribute_packet] method provided by the user. //! //! # Example //! @@ -83,9 +83,6 @@ pub trait PusServiceDistributor { } /// Generic distributor object which dispatches received packets to a user provided handler. -/// -/// This distributor expects the passed trait object to be [Send]able to allow more ergonomic -/// usage with threads. pub struct PusDistributor, E> { service_distributor: ServiceDistributor, } @@ -185,7 +182,6 @@ mod tests { use spacepackets::CcsdsPacket; #[cfg(feature = "std")] use std::collections::VecDeque; - use std::fmt::format; #[cfg(feature = "std")] use std::sync::{Arc, Mutex};