All checks were successful
Rust/sat-rs/pipeline/pr-main This commit looks good
- Add new shared subcrate satrs-shared to split off some shared components not expected to change very often. - Renmame `satrs-core` to `satrs`. It is expected that sat-rs will remain the primary crate, so the core information is superfluous, and core also implies stability, which will not be the case for some time.
47 lines
1.1 KiB
Rust
47 lines
1.1 KiB
Rust
use derive_new::new;
|
|
use satrs::hk::HkRequest;
|
|
use satrs::mode::ModeRequest;
|
|
use satrs::pus::verification::{TcStateAccepted, VerificationToken};
|
|
use satrs_example::TargetIdWithApid;
|
|
|
|
#[allow(dead_code)]
|
|
#[derive(Clone, Eq, PartialEq, Debug)]
|
|
pub enum ActionRequest {
|
|
CmdWithU32Id((u32, Vec<u8>)),
|
|
CmdWithStringId((String, Vec<u8>)),
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
#[derive(Clone, Eq, PartialEq, Debug)]
|
|
#[non_exhaustive]
|
|
pub enum Request {
|
|
Hk(HkRequest),
|
|
Mode(ModeRequest),
|
|
Action(ActionRequest),
|
|
}
|
|
|
|
#[derive(Clone, Eq, PartialEq, Debug, new)]
|
|
pub struct TargetedRequest {
|
|
pub(crate) target_id_with_apid: TargetIdWithApid,
|
|
pub(crate) request: Request,
|
|
}
|
|
|
|
#[derive(Clone, Eq, PartialEq, Debug)]
|
|
pub struct RequestWithToken {
|
|
pub(crate) targeted_request: TargetedRequest,
|
|
pub(crate) token: VerificationToken<TcStateAccepted>,
|
|
}
|
|
|
|
impl RequestWithToken {
|
|
pub fn new(
|
|
target_id: TargetIdWithApid,
|
|
request: Request,
|
|
token: VerificationToken<TcStateAccepted>,
|
|
) -> Self {
|
|
Self {
|
|
targeted_request: TargetedRequest::new(target_id, request),
|
|
token,
|
|
}
|
|
}
|
|
}
|