continue subsystem helper
This commit is contained in:
parent
ba5c7d4a2f
commit
09594e1761
@ -21,6 +21,16 @@ pub struct SequenceExecutionHelper {
|
||||
current_sequence_index: Option<usize>,
|
||||
}
|
||||
|
||||
impl Default for SequenceExecutionHelper {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
target_mode: 0,
|
||||
state: SequenceExecutionHelperStates::Idle,
|
||||
request_id: 0,
|
||||
current_sequence_index: todo!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
pub trait CheckSuccessProvider {
|
||||
fn mode_request_requires_success_check(
|
||||
&mut self,
|
||||
@ -37,20 +47,19 @@ pub enum SequenceHandlerResult {
|
||||
}
|
||||
|
||||
impl SequenceExecutionHelper {
|
||||
pub fn new(
|
||||
pub fn load(
|
||||
&mut self,
|
||||
mode: Mode,
|
||||
request_id: RequestId,
|
||||
sequence_tables: &SequenceModeTables,
|
||||
) -> Option<Self> {
|
||||
) -> Result<(), ()> {
|
||||
if !sequence_tables.0.contains_key(&mode) {
|
||||
return None;
|
||||
return Err(());
|
||||
}
|
||||
Some(Self {
|
||||
target_mode: mode,
|
||||
state: SequenceExecutionHelperStates::Idle,
|
||||
request_id,
|
||||
current_sequence_index: None,
|
||||
})
|
||||
self.target_mode = mode;
|
||||
self.request_id = request_id;
|
||||
self.current_sequence_index = None;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn confirm_sequence_done(&mut self) {
|
||||
|
@ -13,6 +13,7 @@ use satrs::mode_tree::{
|
||||
TargetTablesMapValue,
|
||||
};
|
||||
use satrs::request::MessageMetadata;
|
||||
use satrs::subsystem::SequenceExecutionHelper;
|
||||
use satrs::{
|
||||
mode::{ModeAndSubmode, ModeReply, ModeRequest},
|
||||
queue::GenericTargetedMessagingError,
|
||||
@ -62,8 +63,22 @@ pub struct SubsystemHelper {
|
||||
pub children_mode_store: ModeStoreVec,
|
||||
pub target_tables: TargetModeTables,
|
||||
pub sequence_tables: SequenceModeTables,
|
||||
pub helper: SequenceExecutionHelper,
|
||||
}
|
||||
impl SubsystemHelper {
|
||||
pub fn new(
|
||||
children_mode_store: ModeStoreVec,
|
||||
target_tables: TargetModeTables,
|
||||
sequence_tables: SequenceModeTables,
|
||||
) -> Self{
|
||||
Self {
|
||||
children_mode_store,
|
||||
target_tables,
|
||||
sequence_tables,
|
||||
helper: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_target_and_sequence_table(
|
||||
&mut self,
|
||||
mode: Mode,
|
||||
|
Loading…
Reference in New Issue
Block a user