continue scheduler
This commit is contained in:
@ -56,7 +56,7 @@ optional = true
|
||||
git = "https://egit.irs.uni-stuttgart.de/rust/spacepackets.git"
|
||||
# path = "../spacepackets"
|
||||
# version = "0.4.0"
|
||||
rev = "1e9079307273e414a6333bf575322c1eb302c93e"
|
||||
rev = "74e489bd074"
|
||||
|
||||
default-features = false
|
||||
|
||||
|
@ -1,14 +1,40 @@
|
||||
use crate::pool::StoreAddr;
|
||||
use spacepackets::time::cds;
|
||||
use spacepackets::time::cds::TimeProvider;
|
||||
use std::collections::BTreeMap;
|
||||
use spacepackets::time::UnixTimestamp;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct PusScheduler {
|
||||
tc_map: BTreeMap<cds::TimeProvider, StoreAddr>,
|
||||
tc_map: BTreeMap<UnixTimestamp, StoreAddr>,
|
||||
current_time: UnixTimestamp,
|
||||
enabled: bool
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -19,9 +45,7 @@ mod tests {
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
#[test]
|
||||
fn wtf() {
|
||||
let scheduler = PusScheduler {
|
||||
tc_map: BTreeMap::new(),
|
||||
};
|
||||
fn basic() {
|
||||
let scheduler = PusScheduler::new();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user