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 已注册
This commit is contained in:
commit
689a07ca44
46 files changed
+2986
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import 'dart:io';
|
||||
|
||||
import '../server/protocol.dart';
|
||||
import 'cups_backend.dart';
|
||||
|
||||
/// 打印后端抽象:Windows 走 HiTi PavoApi 直打(分层 BITMAP);macOS 走系统 CUPS 队列。
|
||||
abstract class PrintBackend {
|
||||
/// 后端名:pavo / cups / mock(暴露给日志)
|
||||
String get name;
|
||||
|
||||
Future<PrinterStatus> getStatus();
|
||||
|
||||
Future<void> printOneCard(PrintRequest request);
|
||||
}
|
||||
|
||||
/// manifest 里的后端名按操作系统报,与是否 mock 无关(对齐 C# 版行为)。
|
||||
String osBackendName() => Platform.isWindows ? 'pavo' : 'cups';
|
||||
|
||||
/// 创建当前操作系统的真实打印后端(非 mock)。
|
||||
PrintBackend createOsBackend({void Function(String line)? onLog}) {
|
||||
if (Platform.isWindows) {
|
||||
// Phase 3:PavoApi ffi 直打(待 Windows 实机联调)
|
||||
throw UnsupportedError('Windows PavoApi 后端尚未实现(Phase 3)');
|
||||
}
|
||||
return CupsPrintBackend(onLog: onLog);
|
||||
}
|
||||
Reference in new issue
Block a user