feat: 配对信息二维码与主控端导入

- 被控端新增 zxing 二维码,展示 lancast://pair 链接(含设备 id、指纹、TLS 指纹位)
- 配对 URI 增加 id/name/tls 字段,端口与指纹仍由手机端生成
- 主控端设备列表新增「导入配对信息」,粘贴链接即可添加设备并写入 pin
- 导入设备落盘 ttstd_paired_devices.json,与发现结果按 id/ip+端口去重
This commit is contained in:
tongtong committed 2026-11-27 20:21:57 +08:00
1 parent 1548139051
commit 9a82766fa2
8 files changed
+338 -6

No files matched your search

@@ -9,6 +9,7 @@ class DeviceList extends StatelessWidget {
required this.selectedId,
required this.onSelected,
required this.onRefresh,
this.onPair,
this.refreshing = false,
this.shrinkWrap = false,
});
@@ -17,6 +18,9 @@ class DeviceList extends StatelessWidget {
final String? selectedId;
final ValueChanged<DeviceInfo> onSelected;
final VoidCallback onRefresh;
/// 导入配对信息(扫码/粘贴 `lancast://pair?...`)。
final VoidCallback? onPair;
final bool refreshing;
final bool shrinkWrap;
@@ -35,6 +39,12 @@ class DeviceList extends StatelessWidget {
Text('可连接设备', style: theme.textTheme.titleMedium),
const Spacer(),
Text('${devices.length} 台', style: theme.textTheme.bodySmall),
if (onPair != null)
IconButton(
tooltip: '导入配对信息',
onPressed: onPair,
icon: const Icon(Icons.qr_code_scanner),
),
IconButton(
tooltip: '重新发现',
onPressed: onRefresh,