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