import 'package:iperf3gui/domain/models/iperf3_event.dart'; import 'package:iperf3gui/domain/models/iperf3_result.dart'; import 'package:iperf3gui/domain/models/test_configuration.dart'; /// Runs iperf3 tests and reports what happens. /// /// This is the whole contract the UI depends on. It is deliberately pure Dart — /// no Flutter import — so the presentation layer never names a transport. The /// Android build supplies a MethodChannel-and-JNI implementation /// (`Iperf3Service`); a test, a desktop build or a headless tool can supply /// its own without touching anything above this line. abstract interface class Iperf3Runner { /// Reports parsed from the running test, one event per iperf3 report. /// /// A broadcast stream: it may have no listener, and late listeners miss /// earlier events rather than replaying them. Stream get events; /// Whether a test is in flight right now. bool get isRunning; /// Run a test to completion and resolve with its outcome. /// /// Resolves rather than throws for an iperf3-level failure — the failure is /// carried in [Iperf3Result.exitCode]. Implementations must always resolve, /// including on internal error, so a caller can never be left awaiting. Future run(TestConfiguration config); /// Ask a running test to stop early. A no-op when nothing is running. /// /// The run's future still resolves, with [Iperf3Result.stopped] set. Future stop(); /// Release resources. The instance is unusable afterwards. Future dispose(); }