V0.4.0加入锁定二维码
This commit is contained in:
+67
-65
@@ -1,86 +1,88 @@
|
||||
# QFT protocol overview · v0.3.0-rc3
|
||||
# QFT protocol notes — v0.4.0-rc2
|
||||
|
||||
## QFT1 — Windows → Android optical stream
|
||||
## 1. Windows → Android optical: QFT2
|
||||
|
||||
Wire text:
|
||||
Active display text:
|
||||
|
||||
`QFT1:<base64url(binary frame)>`
|
||||
```text
|
||||
QFT2:<Base45(binary-frame)>
|
||||
```
|
||||
|
||||
Binary frame fields:
|
||||
Base45 is used because its alphabet fits QR alphanumeric encoding, while Android can consume a normal ZXing `Result.text`. The receiver also keeps legacy `QFT1:<base64url(...)>` parsing for old senders.
|
||||
|
||||
- magic `QFT1`
|
||||
- protocol version
|
||||
- frame kind: MANIFEST / DATA / END
|
||||
- session id
|
||||
- sequence index
|
||||
- total chunks
|
||||
- payload length
|
||||
- payload
|
||||
- CRC32
|
||||
### Binary frame
|
||||
|
||||
MANIFEST contains file name, file size, chunk size, total chunks, SHA-256 and Windows sender-device name. DATA frames are replayed cyclically; Android de-duplicates chunks and waits for missing chunks in later rounds. No Android→Windows feedback channel is used in optical mode.
|
||||
```text
|
||||
magic 4 "QFT2"
|
||||
version 1 2
|
||||
kind 1 1=MANIFEST / 2=DATA / 3=END
|
||||
session 8 u64 BE
|
||||
sequence 4 u32 BE
|
||||
total 4 u32 BE
|
||||
payloadLen 2 u16 BE
|
||||
payload N
|
||||
crc32 4 u32 BE over everything before crc32
|
||||
```
|
||||
|
||||
v0.3 defaults: 900-byte DATA payload, 4 QR/page, target up to 60 pages/s.
|
||||
### MANIFEST payload
|
||||
|
||||
## QFTPAIR2 — Android → Windows pairing
|
||||
```text
|
||||
fileSize 8 u64 BE
|
||||
chunkSize 2 u16 BE
|
||||
sha256 32
|
||||
fileNameLen 2 u16 BE
|
||||
fileName N UTF-8
|
||||
senderLen 2 u16 BE
|
||||
senderDevice N UTF-8
|
||||
```
|
||||
|
||||
Text:
|
||||
### Optical parameters in rc2
|
||||
|
||||
`QFTPAIR2:<base64url(compact JSON)>`
|
||||
- one QR per display frame;
|
||||
- DATA payload: **450 B**;
|
||||
- QR error correction: L;
|
||||
- full 4-module quiet zone;
|
||||
- Windows display target: 5~60 FPS, default 45;
|
||||
- synthetic representative DATA frame: 722 text chars / QR-L v15;
|
||||
- theoretical payload at 60 display FPS: 27,000 B/s ≈ 26.4 KiB/s before camera misses/replay.
|
||||
|
||||
Compact JSON keys:
|
||||
Sender continuously loops `MANIFEST → DATA 0..N-1 → END`. Android deduplicates by sequence number and reconstructs once all chunks are present. No reverse ACK/network channel exists for this direction.
|
||||
|
||||
- `v`: 2
|
||||
- `s`: one-time session token
|
||||
- `n`: Windows device name
|
||||
- `p`: receiver TCP port
|
||||
- `e`: local HTTP endpoint hints; Direct AP normally carries one short hint
|
||||
- `w`: optional `[ssid, passphrase]` for QFT Direct
|
||||
## 2. Android optical ROI state machine
|
||||
|
||||
QFTPAIR1 remains parser-compatible for older QR payloads.
|
||||
```text
|
||||
ACQUIRE
|
||||
center search
|
||||
occasional full frame
|
||||
↓ success
|
||||
LOCKED
|
||||
copy Y-plane ROI only
|
||||
GlobalHistogram every frame
|
||||
sparse Hybrid fallback
|
||||
↓ finder points
|
||||
smooth ROI position/size
|
||||
↓ misses
|
||||
expand ROI
|
||||
↓ sustained misses
|
||||
REACQUIRE
|
||||
```
|
||||
|
||||
Android treats pairing QR as untrusted. HTTP endpoint hints must be literal private/local IPv4 addresses on the advertised port. Every `/qft/*` request must carry the one-time `X-QFT-Token` session value.
|
||||
The overlay is derived from the same ROI used by the decoder, so the green/yellow box is not decorative—it reflects the actual analysis area.
|
||||
|
||||
## Receiver discovery
|
||||
## 3. Android → Windows pairing
|
||||
|
||||
UDP request to port 39392:
|
||||
`QFTPAIR2` remains the active pairing format from v0.3. It contains local-only session/network metadata. Android validates the pairing endpoint as a literal local/private IPv4 and binds subsequent discovery/upload to the selected local `Network`.
|
||||
|
||||
`QFTDISC2:<session>`
|
||||
Discovery order includes QR hint, UDP `QFTDISC2`, gateway/direct candidates and bounded current-subnet fallback.
|
||||
|
||||
Windows response:
|
||||
## 4. Android → Windows upload
|
||||
|
||||
`QFTHERE2:<session>:<tcp_port>`
|
||||
Parallel v2 flow:
|
||||
|
||||
Android combines UDP result with QR hint, the actual connected Wi-Fi gateway, common Windows local addresses and a bounded current-subnet fallback scan.
|
||||
```text
|
||||
POST /qft/upload/init
|
||||
POST /qft/upload/chunk (parallel, offset based)
|
||||
POST /qft/upload/finish
|
||||
```
|
||||
|
||||
## Parallel v2 upload
|
||||
|
||||
### Ping
|
||||
|
||||
`GET /qft/ping`
|
||||
|
||||
Headers include `X-QFT-Token` and encoded Android device name.
|
||||
|
||||
### Init
|
||||
|
||||
`POST /qft/upload/init`
|
||||
|
||||
Headers include file name, file size and desired chunk size. Android requests 4/8/16 MiB depending on file size; Windows clamps accepted chunks to 1~16 MiB.
|
||||
|
||||
Response includes `upload_id`, accepted `chunk_size`, and `total_chunks`.
|
||||
|
||||
### Chunk
|
||||
|
||||
`POST /qft/upload/chunk/<upload_id>/<index>`
|
||||
|
||||
Body is exactly that file range. Up to eight Android workers send distinct chunks concurrently. Windows writes each accepted chunk to the preallocated `.qftpart` file at its deterministic offset.
|
||||
|
||||
### Finish
|
||||
|
||||
`POST /qft/upload/finish/<upload_id>`
|
||||
|
||||
Windows rejects finish while chunks are missing. Once complete it computes SHA-256, renames the temporary file to its final unique name, and returns success.
|
||||
|
||||
### Compatibility
|
||||
|
||||
`POST /qft/upload` remains the single-stream fallback for old clients or content providers that cannot sustain seekable parallel reads.
|
||||
Windows preallocates a `.qftpart`, writes chunks at explicit offsets, verifies SHA-256, then renames to the final file. Per-file worker count is capped at 8; chunk size is selected from 4/8/16 MiB by file size.
|
||||
|
||||
+12
-54
@@ -1,58 +1,16 @@
|
||||
# Roadmap
|
||||
# QFT Roadmap
|
||||
|
||||
## V0.1 — 单 QR 无网络链路(当前)
|
||||
## v0.4 physical validation
|
||||
|
||||
- Windows 选择文件
|
||||
- 单 QR 动画
|
||||
- Android CameraX 连续识别
|
||||
- CRC32
|
||||
- SHA-256
|
||||
- 重复帧去重
|
||||
- 多轮补洞
|
||||
- 保存 Downloads/QFT
|
||||
1. Use **450 B / single QR** as the baseline and measure real-phone distinct new-frame/s at Windows 30 / 45 / 60 FPS.
|
||||
2. Record lock acquisition time, locked ROI area, camera FPS, successful decode/s, distinct new-frame/s and reacquire time per device.
|
||||
3. Only after real-device data exists, test nearby DATA payloads (e.g. 390 / 450 / 510 B) and keep the value with the highest *effective* file throughput rather than the highest theoretical bytes/frame.
|
||||
4. Add optional Windows FPS presets chosen from observed Android effective new-frame/s; the optical transport itself remains strictly one-way.
|
||||
5. Tune focus/exposure behavior across LCD/OLED and 60/120 Hz panels.
|
||||
|
||||
目标不是速度,而是证明:**飞行模式下可稳定完整恢复真实文件**。
|
||||
## Later
|
||||
|
||||
## V0.2 — 扫码稳定性
|
||||
|
||||
- 自动曝光/对焦锁定
|
||||
- 只分析中央 ROI
|
||||
- 720p/1080p 自适应
|
||||
- 帧序号抖动统计
|
||||
- 自动 FPS 调节
|
||||
- QR 版本/纠错级别动态选择
|
||||
- Android 前台常亮、屏幕方向锁定
|
||||
|
||||
## V0.3 — 多 QR
|
||||
|
||||
- Windows 2x2 -> 3x3 网格
|
||||
- Android 一帧多码检测
|
||||
- 每个位置独立 lane
|
||||
- lane interleave,避免同一丢帧损失连续数据
|
||||
|
||||
## V0.4 — Fountain / RaptorQ
|
||||
|
||||
- source block / symbol
|
||||
- 无需等待指定 seq
|
||||
- 达到恢复阈值即可完成
|
||||
- 发送端持续产生 repair symbols
|
||||
- 删除“整文件循环重播”的尾部等待
|
||||
|
||||
## V0.5 — QFT Visual Code
|
||||
|
||||
- 固定四角定位
|
||||
- 自定义二值网格
|
||||
- BCH/LDPC 内层纠错
|
||||
- SIMD 二值化与采样
|
||||
- 60/120 FPS
|
||||
- 标定显示器刷新率与相机 rolling shutter
|
||||
|
||||
## V0.6 — Android -> Windows
|
||||
|
||||
这个方向因 PC 可能无摄像头,使用 App P2P:
|
||||
|
||||
- 同 LAN
|
||||
- 临时热点
|
||||
- Wi-Fi Direct(可用平台)
|
||||
- QUIC
|
||||
- 不经过外网/云端
|
||||
- Fountain/RaptorQ to reduce whole-playlist replay cost without a reverse ACK channel.
|
||||
- Native SIMD/custom visual decoder if ZXing remains the dominant bottleneck.
|
||||
- Optional custom QFT Visual Code after the single-QR baseline is measured.
|
||||
- iOS/macOS/Linux clients.
|
||||
|
||||
Reference in New Issue
Block a user