2023-02-13 09:20:00 +01:00
|
|
|
use satrs_core::hk::HkRequest;
|
2023-02-15 11:05:32 +01:00
|
|
|
use satrs_core::mode::ModeRequest;
|
2022-12-21 10:15:41 +01:00
|
|
|
use satrs_core::pus::verification::{TcStateAccepted, VerificationToken};
|
2023-02-27 13:44:24 +01:00
|
|
|
use satrs_core::tmtc::TargetId;
|
2022-12-19 17:03:26 +01:00
|
|
|
|
2023-07-05 21:08:04 +02:00
|
|
|
#[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)]
|
2023-02-15 11:19:23 +01:00
|
|
|
#[non_exhaustive]
|
2022-12-19 17:03:26 +01:00
|
|
|
pub enum Request {
|
2023-07-05 21:08:04 +02:00
|
|
|
Hk(HkRequest),
|
|
|
|
Mode(ModeRequest),
|
|
|
|
Action(ActionRequest),
|
2022-12-19 17:03:26 +01:00
|
|
|
}
|
2022-12-21 10:15:41 +01:00
|
|
|
|
2023-07-05 21:08:04 +02:00
|
|
|
#[derive(Clone, Eq, PartialEq, Debug)]
|
2023-02-27 13:44:24 +01:00
|
|
|
pub struct TargetedRequest {
|
|
|
|
pub(crate) target_id: TargetId,
|
|
|
|
pub(crate) request: Request,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl TargetedRequest {
|
|
|
|
pub fn new(target_id: TargetId, request: Request) -> Self {
|
|
|
|
Self { target_id, request }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-05 21:08:04 +02:00
|
|
|
#[derive(Clone, Eq, PartialEq, Debug)]
|
2023-02-27 13:44:24 +01:00
|
|
|
pub struct RequestWithToken {
|
|
|
|
pub(crate) targeted_request: TargetedRequest,
|
|
|
|
pub(crate) token: VerificationToken<TcStateAccepted>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl RequestWithToken {
|
|
|
|
pub fn new(
|
|
|
|
target_id: u32,
|
|
|
|
request: Request,
|
|
|
|
token: VerificationToken<TcStateAccepted>,
|
|
|
|
) -> Self {
|
|
|
|
Self {
|
|
|
|
targeted_request: TargetedRequest::new(target_id, request),
|
|
|
|
token,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|