Trait OrbitalMode

Source
pub(super) trait OrbitalMode: GlobalMode {
    // Required method
    fn base(&self) -> &BaseMode;

    // Provided methods
    fn get_max_dt() -> TimeDelta { ... }
    async fn exec_task_wait(
        &self,
        context: Arc<ModeContext>,
        due: DateTime<Utc>,
    ) -> WaitExitSignal { ... }
    async fn monitor_bo_mon_change(
        sig: BeaconControllerState,
        bo_mon: &RwLock<Receiver<BeaconControllerState>>,
    ) { ... }
    async fn log_bo_event(&self, context: &Arc<ModeContext>, base: BaseMode) { ... }
}
Expand description

An internal extension trait for GlobalMode that encapsulates logic specific to time-constrained orbital task execution.

The OrbitalMode trait provides utility methods for task waiting, event monitoring, and logging transitions related to orbital activities, such as beacon detection or zoned objective events.

This trait is not intended to be used directly outside the mode control subsystem.

Required Methods§

Source

fn base(&self) -> &BaseMode

Returns a reference to the BaseMode associated with this orbital mode.

This is used for delegating tasks and behavior such as wait and scheduling primitives.

§Returns
  • &BaseMode – The current mode (e.g., Mapping or Beacon Objective Scanning).

Provided Methods§

Source

fn get_max_dt() -> TimeDelta

Returns the maximum duration allowed for scheduled task waiting. If the remaining time until a task is due exceeds this value, the mode may begin long-wait procedures; otherwise, a fallback short sleep is used.

§Returns
  • TimeDelta – Maximum duration (default: 10 seconds).
Source

async fn exec_task_wait( &self, context: Arc<ModeContext>, due: DateTime<Utc>, ) -> WaitExitSignal

Waits until a scheduled task’s due time or returns early if a notable event occurs.

While waiting, this method concurrently monitors for:

  • Safe mode triggers
  • New zoned objectives (ZO)
  • Beacon state changes (BO)

It also supports short or long sleep strategies depending on how far the task lies in the future.

§Arguments
  • context – Shared reference to the current ModeContext.
  • due – Scheduled time at which the next task is expected to start.
§Returns
  • WaitExitSignal – An event indicating why the wait ended (safe event, ZO, or BO, …).
Source

async fn monitor_bo_mon_change( sig: BeaconControllerState, bo_mon: &RwLock<Receiver<BeaconControllerState>>, )

Continuously monitors the BeaconControllerState until it changes to the expected value.

Used to react to asynchronous events in which the beacon scanning mode (e.g., active or inactive) must trigger a response in the scheduler or mode transition logic.

§Arguments
  • sig – The BeaconControllerState state to wait for.
  • bo_mon – A watch receiver providing asynchronous access to beacon state changes.
Source

async fn log_bo_event(&self, context: &Arc<ModeContext>, base: BaseMode)

Logs a beacon-related event and finalizes the orbit at the current satellite position.

This is used to capture the reason for switching out of the current BaseMode, typically due to either beacon objective completion or expiry.

§Arguments
  • context – Shared reference to the current ModeContext.
  • base – The BaseMode that determines the rationale for finishing the orbit segment.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§