-
Notifications
You must be signed in to change notification settings - Fork 173
/
doc.go
45 lines (27 loc) · 1.31 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*Package txqr implements the transmission protocol over QR codes.
Intro
The protocol allows to send a relatively small (fits into the memory fast)
data of a known size. Stream data is not supported by design.
QR codes are supposed to be sent and received by means of optical displays
and sensors with unknown properties. Sender might be a 85 inch OLED TV with
240Hz rate, while receiver could be an old Android phone with 2MP camera and
bound by CPU allowing only 5FPS. Or vice versa. Protocol must adapt to all
cases.
The basic idea is to split the data into chunks, suitable for encoding as a
single QR frame, add frame header/footer information and run it in the loop.
- splitting into frame is crucial to adapt to desired QR code size/error recovery level
- header and footer contain enough information to uniquely identify frame and be able to restore the whole data even if all frames received out of order.
- loop is needed to make sure slow receiver has enough opportunity to restore from missed frames
All data should be within alphanumeric space.
No error correction is implemented, as QR code layer already has one.
Header
offset/total|<data>
both offset and total are represents byte position
and printed in HEX
For, example:
First chunk:
0/11|hello
Second chunk:
5/11|world!
*/
package txqr