sat-rs/satrs/src/hk.rs
Robin Mueller a5e5a1a5a0
Some checks are pending
Rust/sat-rs/pipeline/head Build started...
First PUS handler abstraction with request mapping
This is the first attempt of a generic PUS service abstraction where
the PUS telecommands need to be converted into targetted requests.
2024-02-13 18:19:45 +01:00

41 lines
899 B
Rust

use crate::{
pus::verification::{TcStateAccepted, VerificationToken},
TargetId,
};
pub type CollectionIntervalFactor = u32;
pub type UniqueId = u32;
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum HkRequest {
OneShot(UniqueId),
Enable(UniqueId),
Disable(UniqueId),
ModifyCollectionInterval(UniqueId, CollectionIntervalFactor),
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct TargetedHkRequest {
pub target_id: TargetId,
pub hk_request: HkRequest,
}
impl TargetedHkRequest {
pub fn new(target_id: TargetId, hk_request: HkRequest) -> Self {
Self {
target_id,
hk_request,
}
}
}
pub trait PusHkRequestRouter {
type Error;
fn route(
&self,
target_id: TargetId,
hk_request: HkRequest,
token: VerificationToken<TcStateAccepted>,
) -> Result<(), Self::Error>;
}