power_abstractions + request id schedule implementation #32
@ -25,6 +25,7 @@ pub mod events;
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
|
||||
pub mod executable;
|
||||
pub mod hal;
|
||||
pub mod hk;
|
||||
pub mod objects;
|
||||
pub mod params;
|
||||
#[cfg(feature = "alloc")]
|
||||
@ -32,10 +33,9 @@ pub mod params;
|
||||
pub mod pool;
|
||||
pub mod power;
|
||||
pub mod pus;
|
||||
pub mod request;
|
||||
pub mod res_code;
|
||||
pub mod seq_count;
|
||||
pub mod tmtc;
|
||||
pub mod request;
|
||||
pub mod hk;
|
||||
|
||||
pub use spacepackets;
|
||||
|
@ -45,7 +45,6 @@ pub trait PowerSwitcherCommandSender {
|
||||
) -> Result<(), <T as PowerSwitch>::Error> {
|
||||
switch.switch_off()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
pub trait PowerSwitchInfo {
|
||||
@ -72,22 +71,21 @@ pub trait PowerSwitchProvider: PowerSwitcherCommandSender + PowerSwitchInfo {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::boxed::Box;
|
||||
use crate::power::PowerSwitcherCommandSender;
|
||||
|
||||
use std::boxed::Box;
|
||||
|
||||
struct Pcdu {
|
||||
switch_rx: std::sync::mpsc::Receiver<(SwitchId, u16)>
|
||||
switch_rx: std::sync::mpsc::Receiver<(SwitchId, u16)>,
|
||||
}
|
||||
enum DeviceState {
|
||||
OFF,
|
||||
SwitchingPower,
|
||||
ON,
|
||||
SETUP,
|
||||
IDLE
|
||||
IDLE,
|
||||
}
|
||||
struct MyComplexDevice {
|
||||
power_switcher: Box<dyn PowerSwitcherCommandSender<Error=()>>,
|
||||
power_switcher: Box<dyn PowerSwitcherCommandSender<Error = ()>>,
|
||||
switch_id: SwitchId,
|
||||
some_state: u16,
|
||||
dev_state: DeviceState,
|
||||
@ -101,7 +99,9 @@ mod tests {
|
||||
let mode = 1;
|
||||
if mode == 1 {
|
||||
if self.dev_state == DeviceState::OFF {
|
||||
self.power_switcher.send_switch_on_cmd(self.switch_id).expect("sending siwthc cmd failed");
|
||||
self.power_switcher
|
||||
.send_switch_on_cmd(self.switch_id)
|
||||
.expect("sending siwthc cmd failed");
|
||||
self.dev_state = DeviceState::SwitchingPower;
|
||||
}
|
||||
if self.dev_state == DeviceState::SwitchingPower {
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -1,9 +1,4 @@
|
||||
use satrs_core::tmtc::AddressableId;
|
||||
|
||||
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
pub enum AcsHkIds {
|
||||
TestMgmSet = 1,
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
use satrs_core::events::{EventU32TypedSev, SeverityInfo};
|
||||
use std::net::Ipv4Addr;
|
||||
use satrs_core::events::{EventU32, EventU32TypedSev, Severity, SeverityInfo};
|
||||
|
||||
use satrs_mib::res_code::{ResultU16, ResultU16Info};
|
||||
use satrs_mib::resultcode;
|
||||
@ -51,5 +51,3 @@ pub mod hk_err {
|
||||
#[resultcode]
|
||||
pub const COLLECTION_INTERVAL_MISSING: ResultU16 = ResultU16::const_new(GroupId::Hk as u8, 3);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@ mod pus;
|
||||
mod requests;
|
||||
mod tmtc;
|
||||
|
||||
use crate::hk::{AcsHkIds};
|
||||
use crate::hk::AcsHkIds;
|
||||
use crate::requests::{Request, RequestWithToken};
|
||||
use crate::tmtc::{
|
||||
core_tmtc_task, OtherArgs, PusTcSource, TcArgs, TcStore, TmArgs, TmFunnel, TmStore, PUS_APID,
|
||||
@ -13,6 +13,7 @@ use satrs_core::event_man::{
|
||||
EventManagerWithMpscQueue, MpscEventReceiver, MpscEventU32SendProvider, SendEventProvider,
|
||||
};
|
||||
use satrs_core::events::EventU32;
|
||||
use satrs_core::hk::HkRequest;
|
||||
use satrs_core::pool::{LocalPool, PoolCfg, StoreAddr};
|
||||
use satrs_core::pus::event_man::{
|
||||
DefaultPusMgmtBackendProvider, EventReporter, EventRequest, EventRequestWithToken,
|
||||
@ -37,7 +38,6 @@ use std::sync::mpsc::{channel, TryRecvError};
|
||||
use std::sync::{mpsc, Arc, RwLock};
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use satrs_core::hk::HkRequest;
|
||||
|
||||
#[derive(Clone)]
|
||||
struct EventTmSender {
|
||||
@ -245,7 +245,6 @@ fn main() {
|
||||
HkRequest::Disable(_) => {}
|
||||
HkRequest::ModifyCollectionInterval(_, _) => {}
|
||||
},
|
||||
_ => {}
|
||||
}
|
||||
let started_token = reporter_aocs
|
||||
.start_success(request.1, Some(×tamp))
|
||||
|
@ -1,6 +1,8 @@
|
||||
use crate::requests::{Request, RequestWithToken};
|
||||
use crate::tmtc::{PusTcSource, TmStore};
|
||||
use satrs_core::events::EventU32;
|
||||
use satrs_core::hk::{CollectionIntervalFactor, HkRequest};
|
||||
use satrs_core::params::Params;
|
||||
use satrs_core::pool::StoreAddr;
|
||||
use satrs_core::pus::event;
|
||||
use satrs_core::pus::event_man::{EventRequest, EventRequestWithToken};
|
||||
@ -21,8 +23,6 @@ use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::rc::Rc;
|
||||
use std::sync::mpsc::Sender;
|
||||
use satrs_core::hk::{CollectionIntervalFactor, HkRequest};
|
||||
use satrs_core::params::Params;
|
||||
|
||||
pub struct PusReceiver {
|
||||
pub tm_helper: PusTmWithCdsShortHelper,
|
||||
@ -133,7 +133,9 @@ impl PusReceiver {
|
||||
}
|
||||
128 => {
|
||||
self.update_time_stamp();
|
||||
self.event_sender.send((TEST_EVENT.into(), None)).expect("Sending test event failed");
|
||||
self.event_sender
|
||||
.send((TEST_EVENT.into(), None))
|
||||
.expect("Sending test event failed");
|
||||
let start_token = self
|
||||
.verif_reporter
|
||||
.start_success(token, Some(&self.time_stamp))
|
||||
|
@ -4,7 +4,6 @@ use satrs_core::pus::verification::{TcStateAccepted, VerificationToken};
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
pub enum Request {
|
||||
HkRequest(HkRequest),
|
||||
ModeRequest
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
|
Loading…
Reference in New Issue
Block a user