Files
dzc 689a07ca44 feat: 饭卡打印助手 Flutter 版(Phase 1/2:协议服务器 + macOS CUPS 真机打印)
- 协议与 C# 版 card-printer-agent 逐字段对齐(38200-38202 顺延、CORS *、串行任务队列、30 分钟保留)
- macOS CUPS 后端:lpoptions 队列发现 + lp 参数列表提交(LC_ALL=C 防本地化粘连坑)
- --mock 模拟模式 + bin/agent.dart headless 入口 + 测试卡生成工具
- 真机验收:HiTi CS-200e status 就绪 + 真实出卡;macOS 通用二进制构建通过
- App Sandbox 已关闭(服务需绑回环端口并调用 lp 子进程);zaxprint URL scheme 已注册
2026-09-21 12:03:27 +08:00

33 lines
968 B
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import '../server/protocol.dart';
import 'backend.dart';
import 'cups_backend.dart' show noopLog;
/// mock 后端:无打印机模拟全流程(打印 2.5 秒完成),供联调协议。
class MockBackend implements PrintBackend {
MockBackend({void Function(String line)? onLog}) : _log = onLog ?? noopLog;
final void Function(String line) _log;
@override
String get name => 'mock';
@override
Future<PrinterStatus> getStatus() async => PrinterStatus(
online: true,
model: 'HiTi CS-200e',
firmware: 'v1.03',
connection: 'USB',
ribbon: RibbonInfo(type: 'YMCKO', remain: 63, remainCount: 63),
cardLow: false,
cardLeft: 87,
status: 0,
statusText: '就绪',
);
@override
Future<void> printOneCard(PrintRequest request) async {
_log('[mock] 模拟打印任务(份数 ${request.copies})');
await Future<void>.delayed(const Duration(milliseconds: 2500));
}
}