continue fixing old code
This commit is contained in:
@ -5,7 +5,7 @@ use crate::{
|
||||
ChannelId, TargetId,
|
||||
};
|
||||
|
||||
use super::{verification::VerificationToken, ActiveRequest, ActiveRequestProvider};
|
||||
use super::{verification::VerificationToken, ActivePusRequest, ActiveRequestProvider};
|
||||
|
||||
use delegate::delegate;
|
||||
use satrs_shared::res_code::ResultU16;
|
||||
@ -75,12 +75,12 @@ impl GenericActionReplyPus {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct ActiveActionRequest {
|
||||
pub struct ActivePusActionRequest {
|
||||
pub action_id: ActionId,
|
||||
common: ActiveRequest,
|
||||
common: ActivePusRequest,
|
||||
}
|
||||
|
||||
impl ActiveRequestProvider for ActiveActionRequest {
|
||||
impl ActiveRequestProvider for ActivePusActionRequest {
|
||||
delegate! {
|
||||
to self.common {
|
||||
fn target_id(&self) -> TargetId;
|
||||
@ -91,6 +91,21 @@ impl ActiveRequestProvider for ActiveActionRequest {
|
||||
}
|
||||
}
|
||||
|
||||
impl ActivePusActionRequest {
|
||||
pub fn new(
|
||||
action_id: ActionId,
|
||||
target_id: TargetId,
|
||||
token: VerificationToken<super::verification::TcStateStarted>,
|
||||
start_time: spacepackets::time::UnixTimestamp,
|
||||
timeout: core::time::Duration,
|
||||
) -> Self {
|
||||
Self {
|
||||
action_id,
|
||||
common: ActivePusRequest::new(target_id, token, start_time, timeout),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
|
||||
pub mod alloc_mod {}
|
||||
@ -105,7 +120,6 @@ pub mod std_mod {
|
||||
self, FailParams, FailParamsWithStep, TcStateStarted, VerificationReportingProvider,
|
||||
},
|
||||
ActiveRequestMapProvider, DefaultActiveRequestMap, EcssTmSenderCore, EcssTmtcError,
|
||||
ReplyHandlerHook,
|
||||
},
|
||||
};
|
||||
use core::time::Duration;
|
||||
@ -114,7 +128,7 @@ pub mod std_mod {
|
||||
|
||||
use super::*;
|
||||
|
||||
pub type DefaultActiveActionRequestMap = DefaultActiveRequestMap<ActiveActionRequest>;
|
||||
pub type DefaultActiveActionRequestMap = DefaultActiveRequestMap<ActivePusActionRequest>;
|
||||
|
||||
/*
|
||||
/// Type definition for a PUS 8 action service reply handler which constrains the
|
||||
@ -317,12 +331,13 @@ mod tests {
|
||||
},
|
||||
EcssTcInMemConverter, EcssTcInVecConverter, EcssTmtcError, GenericRoutingError,
|
||||
MpscTcReceiver, PusPacketHandlerResult, PusPacketHandlingError, PusRequestRouter,
|
||||
PusServiceHelper, PusTcToRequestConverter, ReplyHandlerHook, TmAsVecSenderWithMpsc,
|
||||
PusServiceHelper, PusTcToRequestConverter, TmAsVecSenderWithMpsc,
|
||||
},
|
||||
};
|
||||
|
||||
use super::*;
|
||||
|
||||
/*
|
||||
impl<Request> PusRequestRouter<Request> for TestRouter<Request> {
|
||||
type Error = GenericRoutingError;
|
||||
|
||||
@ -507,15 +522,15 @@ mod tests {
|
||||
#[derive(Default)]
|
||||
pub struct TestReplyHandlerHook {
|
||||
pub unexpected_replies: VecDeque<GenericActionReplyPus>,
|
||||
pub timeouts: RefCell<VecDeque<ActiveActionRequest>>,
|
||||
pub timeouts: RefCell<VecDeque<ActivePusActionRequest>>,
|
||||
}
|
||||
|
||||
impl ReplyHandlerHook<ActiveActionRequest, ActionReplyPusWithActionId> for TestReplyHandlerHook {
|
||||
impl ReplyHandlerHook<ActivePusActionRequest, ActionReplyPusWithActionId> for TestReplyHandlerHook {
|
||||
fn handle_unexpected_reply(&mut self, reply: &GenericActionReplyPus) {
|
||||
self.unexpected_replies.push_back(reply.clone());
|
||||
}
|
||||
|
||||
fn timeout_callback(&self, active_request: &ActiveActionRequest) {
|
||||
fn timeout_callback(&self, active_request: &ActivePusActionRequest) {
|
||||
self.timeouts.borrow_mut().push_back(active_request.clone());
|
||||
}
|
||||
|
||||
@ -870,4 +885,5 @@ mod tests {
|
||||
assert_eq!(reply.request_id, request_id);
|
||||
assert_eq!(reply.message.variant, ActionReplyPus::Completed);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -304,6 +304,22 @@ pub struct ActivePusRequest {
|
||||
timeout: Duration,
|
||||
}
|
||||
|
||||
impl ActivePusRequest {
|
||||
pub fn new(
|
||||
target_id: TargetId,
|
||||
token: VerificationToken<TcStateStarted>,
|
||||
start_time: UnixTimestamp,
|
||||
timeout: Duration,
|
||||
) -> Self {
|
||||
Self {
|
||||
target_id,
|
||||
token,
|
||||
start_time,
|
||||
timeout,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveRequestProvider for ActivePusRequest {
|
||||
fn target_id(&self) -> TargetId {
|
||||
self.target_id
|
||||
@ -330,7 +346,7 @@ pub trait PusRequestRouter<Request> {
|
||||
fn route(
|
||||
&self,
|
||||
target_id: TargetId,
|
||||
hk_request: Request,
|
||||
request: Request,
|
||||
token: VerificationToken<TcStateAccepted>,
|
||||
) -> Result<(), Self::Error>;
|
||||
|
||||
@ -351,7 +367,9 @@ pub trait PusReplyHandler<ActiveRequestInfo: ActiveRequestProvider, ReplyType> {
|
||||
fn handle_reply(
|
||||
&mut self,
|
||||
reply: &GenericMessage<ReplyType>,
|
||||
active_request: &ActiveRequestInfo,
|
||||
verification_handler: &impl VerificationReportingProvider,
|
||||
time_stamp: &[u8],
|
||||
tm_sender: &impl EcssTmSenderCore,
|
||||
) -> Result<bool, Self::Error>;
|
||||
|
||||
@ -467,7 +485,7 @@ pub mod alloc_mod {
|
||||
///
|
||||
/// A [VerificationReportingProvider] instance is passed to the user to also allow handling
|
||||
/// of the verification process as part of the PUS standard requirements.
|
||||
pub trait PusTcToRequestConverter<ActiveRequestInfo, Request> {
|
||||
pub trait PusTcToRequestConverter<ActiveRequestInfo: ActiveRequestProvider, Request> {
|
||||
type Error;
|
||||
fn convert(
|
||||
&mut self,
|
||||
|
@ -42,26 +42,16 @@ pub mod std_mod {
|
||||
SpHeader,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
mode::GenericModeReply,
|
||||
pus::{
|
||||
mode::Subservice,
|
||||
verification::{
|
||||
self, FailParams, TcStateStarted, VerificationReportingProvider, VerificationToken,
|
||||
},
|
||||
ActivePusRequest, ActiveRequestMapProvider, EcssTmSenderCore, EcssTmtcError,
|
||||
PusServiceReplyHandler, PusTmWrapper, ReplyHandlerHook,
|
||||
},
|
||||
TargetId,
|
||||
};
|
||||
|
||||
/*
|
||||
pub trait ModeReplyHook: ReplyHandlerHook<ActivePusRequest, ModeReply> {
|
||||
fn wrong_mode_result_code(&self) -> ResultU16;
|
||||
fn can_not_reach_mode_result_code(&self) -> ResultU16;
|
||||
}
|
||||
*/
|
||||
|
||||
use super::{ModeReply, MODE_SERVICE_ID};
|
||||
|
||||
/*
|
||||
/// Type definition for a PUS mode servicd reply handler which constrains the
|
||||
/// [PusServiceReplyHandler] active request and reply generics to the [ActiveActionRequest] and
|
||||
/// [ActionReplyPusWithIds] type.
|
||||
@ -180,6 +170,7 @@ pub mod std_mod {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
Reference in New Issue
Block a user