added some generic scheduling definitions
All checks were successful
Rust/spacepackets/pipeline/head This commit looks good
All checks were successful
Rust/spacepackets/pipeline/head This commit looks good
This commit is contained in:
parent
5e208e7c23
commit
effef4609b
@ -12,6 +12,8 @@ use serde::{Deserialize, Serialize};
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
|
pub mod scheduling;
|
||||||
|
|
||||||
pub type CrcType = u16;
|
pub type CrcType = u16;
|
||||||
|
|
||||||
/// CRC algorithm used by the PUS standard.
|
/// CRC algorithm used by the PUS standard.
|
||||||
@ -29,6 +31,8 @@ pub enum PusServiceId {
|
|||||||
Event = 5,
|
Event = 5,
|
||||||
/// Service 8
|
/// Service 8
|
||||||
Action = 8,
|
Action = 8,
|
||||||
|
/// Service 11
|
||||||
|
Scheduling = 11,
|
||||||
/// Service 17
|
/// Service 17
|
||||||
Test = 17,
|
Test = 17,
|
||||||
}
|
}
|
||||||
|
91
src/ecss/scheduling.rs
Normal file
91
src/ecss/scheduling.rs
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
//! PUS Service 11 Scheduling
|
||||||
|
#[cfg(feature = "serde")]
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
|
pub enum Subservice {
|
||||||
|
// Core subservices
|
||||||
|
TcEnableScheduling = 1,
|
||||||
|
TcDisableScheduling = 2,
|
||||||
|
TcResetScheduling = 3,
|
||||||
|
TcInsertActivity = 4,
|
||||||
|
TcDeleteActivityByRequestId = 5,
|
||||||
|
TcDeleteActivitiesByFilter = 6,
|
||||||
|
|
||||||
|
// Time shift subservices
|
||||||
|
TcTimeShiftActivityWithRequestId = 7,
|
||||||
|
TcTimeShiftActivitiesByFilter = 8,
|
||||||
|
TcTimeShiftAll = 15,
|
||||||
|
|
||||||
|
// Reporting subservices
|
||||||
|
TcDetailReportByRequestId = 9,
|
||||||
|
TmDetailReport = 10,
|
||||||
|
TcDetailReportByFilter = 11,
|
||||||
|
TcSummaryReportByRequestId = 12,
|
||||||
|
TmSummaryReport = 13,
|
||||||
|
TcSummaryReportByFilter = 14,
|
||||||
|
TcDetailReportAll = 16,
|
||||||
|
TcSummaryReportAll = 17,
|
||||||
|
|
||||||
|
// Subschedule subservices
|
||||||
|
TcReportSubscheduleStatus = 18,
|
||||||
|
TmReportSubscheduleStatus = 19,
|
||||||
|
TcEnableSubschedule = 20,
|
||||||
|
TcDisableSubschedule = 21,
|
||||||
|
|
||||||
|
// Group subservices
|
||||||
|
TcCreateScheduleGroup = 22,
|
||||||
|
TcDeleteScheduleGroup = 23,
|
||||||
|
TcEnableScheduleGroup = 24,
|
||||||
|
TcDisableScheduleGroup = 25,
|
||||||
|
TcReportAllGroupsStatus = 26,
|
||||||
|
TmReportAllGroupsStatus = 27,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This status applies to sub-schedules and groups as well as specified in ECSS-E-ST-70-41C 8.11.3
|
||||||
|
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
|
pub enum SchedStatus {
|
||||||
|
Disabled = 0,
|
||||||
|
Enabled = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<bool> for SchedStatus {
|
||||||
|
fn from(value: bool) -> Self {
|
||||||
|
if value {
|
||||||
|
SchedStatus::Enabled
|
||||||
|
} else {
|
||||||
|
SchedStatus::Disabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Time window types as specified in ECSS-E-ST-70-41C 8.11.3
|
||||||
|
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
|
pub enum TimeWindowType {
|
||||||
|
SelectAll = 0,
|
||||||
|
TimeTagToTimeTag = 1,
|
||||||
|
FromTimeTag = 2,
|
||||||
|
ToTimeTag = 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use crate::ecss::scheduling::SchedStatus;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_bool_conv_0() {
|
||||||
|
let enabled = true;
|
||||||
|
let status: SchedStatus = enabled.into();
|
||||||
|
assert_eq!(status, SchedStatus::Enabled)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_bool_conv_1() {
|
||||||
|
let enabled = false;
|
||||||
|
let status: SchedStatus = enabled.into();
|
||||||
|
assert_eq!(status, SchedStatus::Disabled)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user