chore(project): 初始化项目基础配置文件
- 添加 CodeGraph、Android 和通用 gitignore 配置 - 创建项目元数据文件跟踪 Flutter 项目属性 - 添加 Codex AI 指导文档 AGENTS.md 说明项目架构 - 配置代码分析选项 analysis_options.yaml - 设置 Android 应用清单权限和 Kiosk 模式配置 - 实现中英文国际化支持 AppLocalizations - 配置 GoRouter 应用路由导航 - 创建明亮工业控制风格的主题配置 AppTheme
This commit is contained in:
54
lib/features/device/services/runner_interface.dart
Normal file
54
lib/features/device/services/runner_interface.dart
Normal file
@@ -0,0 +1,54 @@
|
||||
import '../../programs/models/program.dart';
|
||||
import '../../programs/models/step.dart';
|
||||
|
||||
/// 运行器状态
|
||||
enum RunnerStatus {
|
||||
idle,
|
||||
running,
|
||||
paused,
|
||||
completed,
|
||||
error,
|
||||
}
|
||||
|
||||
/// 运行器回调
|
||||
class RunnerCallbacks {
|
||||
/// 步骤进度回调: (stepIndex, remainingSeconds, progress, currentWell)
|
||||
final void Function(int stepIndex, int remainingSeconds, double progress, String well)? onProgress;
|
||||
|
||||
/// 运行完成回调
|
||||
final void Function()? onComplete;
|
||||
|
||||
/// 错误回调
|
||||
final void Function(String error)? onError;
|
||||
|
||||
const RunnerCallbacks({
|
||||
this.onProgress,
|
||||
this.onComplete,
|
||||
this.onError,
|
||||
});
|
||||
}
|
||||
|
||||
/// 运行器抽象接口
|
||||
/// 定义硬件运行控制的标准接口
|
||||
abstract class Runner {
|
||||
/// 当前状态
|
||||
RunnerStatus status = RunnerStatus.idle;
|
||||
|
||||
/// 启动程序运行
|
||||
void start(Program program, List<Step> steps, RunnerCallbacks callbacks);
|
||||
|
||||
/// 暂停运行
|
||||
void pause();
|
||||
|
||||
/// 继续运行
|
||||
void resume();
|
||||
|
||||
/// 停止运行
|
||||
void stop();
|
||||
|
||||
/// 获取当前状态
|
||||
RunnerStatus getStatus();
|
||||
|
||||
/// 释放资源
|
||||
void dispose();
|
||||
}
|
||||
Reference in New Issue
Block a user