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,32 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:desktop_plugin/agent.dart';
|
||||
|
||||
/// headless 入口(开发联调用,行为对齐 C# 版控制台助手):
|
||||
/// dart run bin/agent.dart [--mock] [--port 38203]
|
||||
Future<void> main(List<String> args) async {
|
||||
final agent = Agent(AgentOptions.parse(args));
|
||||
try {
|
||||
await agent.start();
|
||||
} catch (e) {
|
||||
stderr.writeln('启动失败:$e');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
final done = Completer<void>();
|
||||
final subs = [
|
||||
ProcessSignal.sigint.watch().listen((_) {
|
||||
if (!done.isCompleted) done.complete();
|
||||
}),
|
||||
ProcessSignal.sigterm.watch().listen((_) {
|
||||
if (!done.isCompleted) done.complete();
|
||||
}),
|
||||
];
|
||||
await done.future;
|
||||
for (final sub in subs) {
|
||||
await sub.cancel();
|
||||
}
|
||||
await agent.stop();
|
||||
exit(0);
|
||||
}
|
||||
Reference in new issue
Block a user