fix compile error
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit
This commit is contained in:
@@ -323,6 +323,20 @@ impl ActiveRequestProvider for ActiveRequest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Generic user hook method.
|
||||||
|
///
|
||||||
|
/// This hook method currently serves the following tasks:
|
||||||
|
///
|
||||||
|
/// 1. Pass specific information to the reply handlers which can not be kept inside the
|
||||||
|
/// framework. This includes information like the error codes used for packet verification.
|
||||||
|
/// 2. It exposes callback methods which can be useful to perform custom user operations like
|
||||||
|
/// logging.
|
||||||
|
pub trait ReplyHandlerHook<ActiveRequestType, ReplyType> {
|
||||||
|
fn handle_unexpected_reply(&mut self, reply: &ReplyType);
|
||||||
|
fn timeout_callback(&self, active_request: &ActiveRequestType);
|
||||||
|
fn timeout_error_code(&self) -> ResultU16;
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
mod alloc_mod {
|
mod alloc_mod {
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
@@ -464,55 +478,40 @@ mod alloc_mod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// Generic user hook method.
|
/// Generic reply handler structure which can be used to handle replies for a specific PUS service.
|
||||||
///
|
///
|
||||||
/// This hook method currently serves the following tasks:
|
/// This is done by keeping track of active requests using an internal map structure. An API
|
||||||
///
|
/// to register new active requests is exposed as well.
|
||||||
/// 1. Pass specific information to the reply handlers which can not be kept inside the
|
/// The reply handler performs boilerplate tasks like performing the verification handling and
|
||||||
/// framework. This includes information like the error codes used for packet verification.
|
/// timeout handling.
|
||||||
/// 2. It exposes callback methods which can be useful to perform custom user operations like
|
///
|
||||||
/// logging.
|
/// This object is not useful by itself but serves as a common building block for high-level
|
||||||
pub trait ReplyHandlerHook<ActiveRequestType, ReplyType> {
|
/// PUS reply handlers. Concrete PUS handlers should constrain the [ActiveRequestProvider] and
|
||||||
fn handle_unexpected_reply(&mut self, reply: &ReplyType);
|
/// the `ReplyType` generics to specific types tailored towards PUS services in addition to
|
||||||
fn timeout_callback(&self, active_request: &ActiveRequestType);
|
/// providing an API which can process received replies and convert them into verification
|
||||||
fn timeout_error_code(&self) -> ResultU16;
|
/// completions or other operation like user hook calls. The framework also provides some concrete
|
||||||
}
|
/// PUS handlers for common PUS services like the mode, action and housekeeping service.
|
||||||
|
///
|
||||||
/// Generic reply handler structure which can be used to handle replies for a specific PUS service.
|
/// This object does not automatically update its internal time information used to check for
|
||||||
///
|
/// timeouts. The user should call the [Self::update_time] and [Self::update_time_from_now] methods
|
||||||
/// This is done by keeping track of active requests using an internal map structure. An API
|
/// to do this.
|
||||||
/// to register new active requests is exposed as well.
|
pub struct PusServiceReplyHandler<
|
||||||
/// The reply handler performs boilerplate tasks like performing the verification handling and
|
|
||||||
/// timeout handling.
|
|
||||||
///
|
|
||||||
/// This object is not useful by itself but serves as a common building block for high-level
|
|
||||||
/// PUS reply handlers. Concrete PUS handlers should constrain the [ActiveRequestProvider] and
|
|
||||||
/// the `ReplyType` generics to specific types tailored towards PUS services in addition to
|
|
||||||
/// providing an API which can process received replies and convert them into verification
|
|
||||||
/// completions or other operation like user hook calls. The framework also provides some concrete
|
|
||||||
/// PUS handlers for common PUS services like the mode, action and housekeeping service.
|
|
||||||
///
|
|
||||||
/// This object does not automatically update its internal time information used to check for
|
|
||||||
/// timeouts. The user should call the [Self::update_time] and [Self::update_time_from_now] methods
|
|
||||||
/// to do this.
|
|
||||||
pub struct PusServiceReplyHandler<
|
|
||||||
VerificationReporter: VerificationReportingProvider,
|
VerificationReporter: VerificationReportingProvider,
|
||||||
ActiveRequestMap: ActiveRequestMapProvider<ActiveRequestType>,
|
ActiveRequestMap: ActiveRequestMapProvider<ActiveRequestType>,
|
||||||
UserHook: ReplyHandlerHook<ActiveRequestType, ReplyType>,
|
UserHook: ReplyHandlerHook<ActiveRequestType, ReplyType>,
|
||||||
ActiveRequestType: ActiveRequestProvider,
|
ActiveRequestType: ActiveRequestProvider,
|
||||||
ReplyType,
|
ReplyType,
|
||||||
> {
|
> {
|
||||||
active_request_map: ActiveRequestMap,
|
active_request_map: ActiveRequestMap,
|
||||||
verification_reporter: VerificationReporter,
|
verification_reporter: VerificationReporter,
|
||||||
fail_data_buf: alloc::vec::Vec<u8>,
|
fail_data_buf: alloc::vec::Vec<u8>,
|
||||||
current_time: UnixTimestamp,
|
current_time: UnixTimestamp,
|
||||||
pub user_hook: UserHook,
|
pub user_hook: UserHook,
|
||||||
phantom: PhantomData<(ActiveRequestType, ReplyType)>,
|
phantom: PhantomData<(ActiveRequestType, ReplyType)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
VerificationReporter: VerificationReportingProvider,
|
VerificationReporter: VerificationReportingProvider,
|
||||||
ActiveRequestMap: ActiveRequestMapProvider<ActiveRequestType>,
|
ActiveRequestMap: ActiveRequestMapProvider<ActiveRequestType>,
|
||||||
UserHook: ReplyHandlerHook<ActiveRequestType, ReplyType>,
|
UserHook: ReplyHandlerHook<ActiveRequestType, ReplyType>,
|
||||||
@@ -526,7 +525,7 @@ impl<
|
|||||||
ActiveRequestType,
|
ActiveRequestType,
|
||||||
ReplyType,
|
ReplyType,
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
|
#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
|
||||||
pub fn new_from_now(
|
pub fn new_from_now(
|
||||||
@@ -626,6 +625,7 @@ impl<
|
|||||||
pub fn update_time(&mut self, time: UnixTimestamp) {
|
pub fn update_time(&mut self, time: UnixTimestamp) {
|
||||||
self.current_time = time;
|
self.current_time = time;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
|
|||||||
Reference in New Issue
Block a user