namespace Lab505.Script; /// /// Unified condition checker exposed to user scripts. /// Type 1 — instant: State.Assert(s => s.ImrReady, "msg") /// Type 2 — async wait: await State.WaitUntil(s => s.ImrReadyAtC1) /// await State.Require(s => s.C1HasGoods, "msg") /// public interface ICondition { // ── IMR ────────────────────────────────────────────────────────────── bool ImrOnline { get; } bool ImrReady { get; } bool ImrBusy { get; } bool ImrAtC1 { get; } bool ImrAtABB { get; } bool ImrReadyAtC1 { get; } bool ImrReadyAtABB { get; } // ── AMR ────────────────────────────────────────────────────────────── bool AmrOnline { get; } bool AmrReady { get; } bool AmrBusy { get; } bool AmrAtCap1 { get; } bool AmrAtCap2 { get; } bool AmrReadyAtCap1 { get; } bool AmrReadyAtCap2 { get; } // ── C1 ─────────────────────────────────────────────────────────────── bool C1Online { get; } bool C1HasGoods { get; } bool C1NotGoods { get; } bool C1Ready { get; } bool C1Idle { get; } bool C1InOn { get; } bool C1OutOn { get; } bool C1IMRinOn { get; } bool C1IMRoutOn { get; } // ── C2 ─────────────────────────────────────────────────────────────── bool C2Online { get; } bool C2HasGoods { get; } bool C2Ready { get; } bool C2Idle { get; } bool C2InOn { get; } bool C2OutOn { get; } // ── Dobot ──────────────────────────────────────────────────────────── bool DobotOnline { get; } // ── Condition methods ───────────────────────────────────────────────── /// Instant check — throws InvalidOperationException if false. Use before sending a command. void Assert(Func condition, string errorMessage); /// Event-driven wait. Returns false on timeout, throws on cancellation. Task WaitUntil(Func condition, int timeoutMs = 1_200_000, CancellationToken ct = default); /// Event-driven wait. Throws TimeoutException if condition not met in time. Task Require(Func condition, string errorMessage, int timeoutMs = 1_200_000, CancellationToken ct = default); }