continue scheduler

This commit is contained in:
Robin Müller 2023-01-21 13:18:57 +01:00
parent 1f27c23447
commit 89a7de355f
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
4 changed files with 36 additions and 12 deletions

4
Cargo.lock generated
View File

@ -568,7 +568,7 @@ dependencies = [
"postcard",
"serde",
"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",
]
@ -698,7 +698,7 @@ dependencies = [
[[package]]
name = "spacepackets"
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 = [
"chrono",
"crc",

View File

@ -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

View File

@ -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();
}
}

@ -1 +1 @@
Subproject commit 1e9079307273e414a6333bf575322c1eb302c93e
Subproject commit 74e489bd074bbd8139a1c8740aa1670a2ef9b671