- 在AndroidManifest.xml中添加USB Host权限和设备过滤器配置 - 新增设备控制国际化词条包括速度档位、吹气时间等 - 重构数据库结构将速度相关字段统一为档位数值存储 - 添加通用KV存储方法用于settings表数据读写 - 优化首页导航实现tab间跳转和状态保持功能 - 更新程序详情页面布局和参数表单界面 - 移除模拟运行器相关测试代码 - 添加USB串口通信依赖包usb_serial
65 lines
1.4 KiB
Dart
65 lines
1.4 KiB
Dart
/// 程序模型
|
|
class Program {
|
|
final int? id;
|
|
final String code;
|
|
final String name;
|
|
final String createdAt;
|
|
final int status; // 1: 启用, 0: 停用
|
|
final int temperature;
|
|
final int airflowTime;
|
|
|
|
Program({
|
|
this.id,
|
|
required this.code,
|
|
required this.name,
|
|
required this.createdAt,
|
|
this.status = 1,
|
|
this.temperature = 50,
|
|
this.airflowTime = 60,
|
|
});
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return {
|
|
'id': id,
|
|
'code': code,
|
|
'name': name,
|
|
'created_at': createdAt,
|
|
'status': status,
|
|
'temperature': temperature,
|
|
'airflow_time': airflowTime,
|
|
};
|
|
}
|
|
|
|
factory Program.fromMap(Map<String, dynamic> map) {
|
|
return Program(
|
|
id: map['id'] as int?,
|
|
code: map['code'] as String,
|
|
name: map['name'] as String,
|
|
createdAt: map['created_at'] as String,
|
|
status: map['status'] as int? ?? 1,
|
|
temperature: map['temperature'] as int? ?? 50,
|
|
airflowTime: map['airflow_time'] as int? ?? 60,
|
|
);
|
|
}
|
|
|
|
Program copyWith({
|
|
int? id,
|
|
String? code,
|
|
String? name,
|
|
String? createdAt,
|
|
int? status,
|
|
int? temperature,
|
|
int? airflowTime,
|
|
}) {
|
|
return Program(
|
|
id: id ?? this.id,
|
|
code: code ?? this.code,
|
|
name: name ?? this.name,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
status: status ?? this.status,
|
|
temperature: temperature ?? this.temperature,
|
|
airflowTime: airflowTime ?? this.airflowTime,
|
|
);
|
|
}
|
|
}
|