continue scheduler
This commit is contained in:
parent
1f27c23447
commit
89a7de355f
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -568,7 +568,7 @@ dependencies = [
|
|||||||
"postcard",
|
"postcard",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"spacepackets 0.5.0 (git+https://egit.irs.uni-stuttgart.de/rust/spacepackets.git?rev=1e9079307273e414a6333bf575322c1eb302c93e)",
|
"spacepackets 0.5.0 (git+https://egit.irs.uni-stuttgart.de/rust/spacepackets.git?rev=74e489bd074)",
|
||||||
"zerocopy",
|
"zerocopy",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -698,7 +698,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "spacepackets"
|
name = "spacepackets"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
source = "git+https://egit.irs.uni-stuttgart.de/rust/spacepackets.git?rev=1e9079307273e414a6333bf575322c1eb302c93e#1e9079307273e414a6333bf575322c1eb302c93e"
|
source = "git+https://egit.irs.uni-stuttgart.de/rust/spacepackets.git?rev=74e489bd074#74e489bd074bbd8139a1c8740aa1670a2ef9b671"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"crc",
|
"crc",
|
||||||
|
@ -56,7 +56,7 @@ optional = true
|
|||||||
git = "https://egit.irs.uni-stuttgart.de/rust/spacepackets.git"
|
git = "https://egit.irs.uni-stuttgart.de/rust/spacepackets.git"
|
||||||
# path = "../spacepackets"
|
# path = "../spacepackets"
|
||||||
# version = "0.4.0"
|
# version = "0.4.0"
|
||||||
rev = "1e9079307273e414a6333bf575322c1eb302c93e"
|
rev = "74e489bd074"
|
||||||
|
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
|
@ -1,14 +1,40 @@
|
|||||||
use crate::pool::StoreAddr;
|
use crate::pool::StoreAddr;
|
||||||
use spacepackets::time::cds;
|
|
||||||
use spacepackets::time::cds::TimeProvider;
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
use spacepackets::time::UnixTimestamp;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct PusScheduler {
|
pub struct PusScheduler {
|
||||||
tc_map: BTreeMap<cds::TimeProvider, StoreAddr>,
|
tc_map: BTreeMap<UnixTimestamp, StoreAddr>,
|
||||||
|
current_time: UnixTimestamp,
|
||||||
|
enabled: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PusScheduler {
|
impl PusScheduler {
|
||||||
pub fn insert_tc(&mut self, time_stamp: TimeProvider, addr: StoreAddr) {
|
pub fn new(init_current_time: UnixTimestamp) -> Self {
|
||||||
|
PusScheduler {
|
||||||
|
tc_map: Default::default(),
|
||||||
|
current_time: init_current_time,
|
||||||
|
enabled: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_enabled(&self) -> bool {
|
||||||
|
self.enabled
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn enable(&mut self) {
|
||||||
|
self.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn disable(&mut self) {
|
||||||
|
self.enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn update_time(&mut self, current_time: UnixTimestamp) {
|
||||||
|
self.current_time = current_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn insert_tc(&mut self, time_stamp: UnixTimestamp, addr: StoreAddr) {
|
||||||
self.tc_map.insert(time_stamp, addr);
|
self.tc_map.insert(time_stamp, addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -19,9 +45,7 @@ mod tests {
|
|||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn wtf() {
|
fn basic() {
|
||||||
let scheduler = PusScheduler {
|
let scheduler = PusScheduler::new();
|
||||||
tc_map: BTreeMap::new(),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 1e9079307273e414a6333bf575322c1eb302c93e
|
Subproject commit 74e489bd074bbd8139a1c8740aa1670a2ef9b671
|
Loading…
Reference in New Issue
Block a user