diff --git a/mission_rust/src/fsrc/datasets/mod.rs b/mission_rust/src/fsrc/datasets/mod.rs index dea8b6c..8883b04 100644 --- a/mission_rust/src/fsrc/datasets/mod.rs +++ b/mission_rust/src/fsrc/datasets/mod.rs @@ -1,3 +1,5 @@ +use super::objectmanager::SystemObjectIF; + #[derive(Copy, Clone, PartialEq)] pub struct TypeId { id: usize, @@ -14,7 +16,7 @@ pub trait Reflection { } pub trait DatapoolOwnerIF { - fn get_set(&self, type_id: TypeId) -> Option<&dyn DataSetIF> { + fn get_set(&self, _type_id: TypeId) -> Option<&dyn DataSetIF> { None } } @@ -75,7 +77,7 @@ impl ReferencedDataset { } } - pub fn initialize(&mut self, owner: &dyn DatapoolOwnerIF) -> Result<(), ()> { + pub fn initialize(&mut self, owner: &dyn SystemObjectIF) -> Result<(), ()> { let temp: T = T::default(); //TODO find nicer solution whithout local instance and trait bound to Default let type_id = temp.get_type_id(); let other_set: &dyn DataSetIF; @@ -88,6 +90,7 @@ impl ReferencedDataset { } } //pointer cast is safe because we checked the type_id + //getting pointer to avoid lifetime check self.actual_data = Some(other_set.get_actual_data() as *const dyn Reflection as *const T); //self.mutex = other.mutex Ok(()) diff --git a/mission_rust/src/fsrc/tasks/mod.rs b/mission_rust/src/fsrc/tasks/mod.rs index 9251c73..253dfb0 100644 --- a/mission_rust/src/fsrc/tasks/mod.rs +++ b/mission_rust/src/fsrc/tasks/mod.rs @@ -90,6 +90,7 @@ pub struct TaskExecutor<'a> { impl<'a> TaskExecutor<'a> { pub fn init_and_run(&mut self) { + //TODO unlock global multitasking mutex let object_manager = TaskObjectManager { tasks: unsafe { slice::from_raw_parts(self.tasks.as_ptr(), self.tasks.len()) }, }; @@ -140,6 +141,7 @@ impl<'a> crate::objectmanager::ObjectManager<'a> for TaskObjectManager<'a> { impl<'a> Drop for TaskExecutor<'a> { fn drop(&mut self) { + //TODO lock global multitasking mutex for task in self.tasks.iter_mut() { unsafe { crate::fsrc::osal::delete_task(task.get_handle()); diff --git a/mission_rust/src/lib.rs b/mission_rust/src/lib.rs index 5a8054f..94794c7 100644 --- a/mission_rust/src/lib.rs +++ b/mission_rust/src/lib.rs @@ -162,7 +162,8 @@ impl SystemObjectIF for HandlerSender { Err(_) => return Err(()), }; self.other_handler_queue = other_handler.get_command_queue(); - //TODO self.other_data.initialize(other_handler); // oh come on :/ + + self.other_data.initialize(other_handler)?; Ok(()) } }