From 80a7054c7cf8e3c5b2a7ec2b226307bbfae1f018 Mon Sep 17 00:00:00 2001 From: jimmytai Date: Wed, 30 Aug 2023 23:05:31 +0800 Subject: [PATCH] Docs: protocol --- docs/images/protocol-packet.png | Bin 0 -> 25723 bytes docs/protocol.md | 17 ++++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 docs/images/protocol-packet.png diff --git a/docs/images/protocol-packet.png b/docs/images/protocol-packet.png new file mode 100644 index 0000000000000000000000000000000000000000..98372b5e33a16b31b5565c41ba1b9d5d8eda832e GIT binary patch literal 25723 zcmeIaWn7o*+AWGG1_sjrL=Y4#N+bknOiD#sS_Py*N*csMML}9b0R^N%=|)BA66qAA zyF2!HbgsSDT=P9&&hNbY?ETy8%XB&?{NuT=7}pr%x*uP;EWVw5A2|sL$#zMJb8;jk z>pzl^kkV}?#eYc?y~0L9qH{*_+-U_{&EYn?oToEuYvyIag~IX9EB z_HE?loOQ*?hAH8q@~M{z+(!e~;T;cr^KRONKS{oLl5WQz^LPI9$A2Ed|6ft?v4b?% zZtCXJ^V`Ky>qrgnJl(w2)OJ_f^PS_B9i+mPBqSM6bGMTm-+hPFgrQ~!%}Ft_?ay~! z|Fm7^EiD&myKLz03m3Nkab>;ExvRGdeEJ_gy<@Yd|Gt;(`VF-tG&`wU#}8#4Wcsn6 zOyIgsEy=o*Vi)d{@d-UPE#7P^?s|Fe|M@SsgS|S4*JPil^YVCSL0{$TrM?gsRpoe< zHJF1%J`y@w0)kOyV9dS~f^^tuGZSlWBW? z@NB!w+Dc;ns_OPqFEy8}Jv2OHGh_K{rNu`>9B+8M;GY$;L4-5ypBYW_HlM;EKhBz-u)|)mZeWhFI3D8;{ z6EFHan^P>~u}w4M)+d3z$Cq7p>1K5+7K;qpH7S2T%<-bbajN30JGBXIahZn@)8svt zDTBN%rJi#&5z-xaTC!mm0uv3KCq+SRhG4D5IhM?Y1LmOJmU&|;Ra7ltQ#~ew&|AomiQd?%nYP{yzPapr|@i}kBo=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|T}U-xa5r6u}>8{(mF)wUEI2E?}x*sK9p`i{^6eo<>Vn$OB?vt+0@Z#IaWf#nA0 z;OFP3tE&sR(ou0I5BY+*aT?^v&FmJJMR8Ynpt6xLUNavwWM#iWOT?7@Wv=4V{3cR? zxA~~0O`ICd%R`m_og3^yp`3}am(r^@k_xLrOcpY+f6r4qkcAm;X$-tWxqRv z+I{Smto%7Wpwh0-H=KQ~urWg}lJS#ab3Z^Q!>y0&;4VGYA9}ADdjqPfS%T~K-#dKx zFp|tfo?WSU?Y-zK7s}M|bx?W1kUwET;|3{;c(-y(zmH^DF-={z)c|fL;1L3*Q4?#K zqdx`f6EuQcTC5%L#LxmB)nP`+MCg4k5afci4VJG^g^YnzLvh92p~c0bxbmyfQ}-%i zZ?9x{`|$3R+iof)sMB!pKH;y_K&QLyCZhDnI;my+17T^%$Z0HI*`|HSSp?k1W9n=` y=zXk{%IHP^ZGHH^qqqO(HUAd?sJ}eqWr}CDOsYldafhKjVdMMqxr8&5dxL~ literal 0 HcmV?d00001 diff --git a/docs/protocol.md b/docs/protocol.md index 7b1a6a29..f7643eff 100644 --- a/docs/protocol.md +++ b/docs/protocol.md @@ -6,11 +6,18 @@ The communication with the application is not the easiest but is structured as follows: -`MAGIC BYTE(0x11) LRC(Magic Byte) COMMAND STATUS(0x00) DATA LRC(COMMAND + STATUS + DATA)` - -You build the Packet by first adding 0x11, this is the "Magic Byte" to say that there is something coming. This is followed by the LRC ([**L**ongitudinal **R**edundancy **C**heck](https://en.wikipedia.org/wiki/Longitudinal_redundancy_check)) of the "Magic Byte". Then you put in the command in [Big Endian](https://en.wikipedia.org/wiki/Endianness). Each command gets assigned a unique number (e.g. `factoryReset(1020)`), this is what you are sending to the device. Append the status, also in Big Endian. The status is always 0x00. Then you add your Data, this could be anything, for example sending the card keys when reading a block. - -For receiving, it is the exact same in reverse. +![](images/protocol-packet.png) + +- **SOF**: `1 Byte`, the "Magic Byte" represent the start of a packet, must be `0x11`. +- **LRC1**: `1 Byte`, the LRC ([**L**ongitudinal **R**edundancy **C**heck](https://en.wikipedia.org/wiki/Longitudinal_redundancy_check)) of the `SOF`, must be `0xEF`. +- **CMD**: `2 Bytes` in unsigned [Big Endian](https://en.wikipedia.org/wiki/Endianness) format, each command have been assigned a unique number (e.g. `factoryReset(1020)`), this is what you are sending to the device. +- **STATUS**: `2 Bytes` in unsigned [Big Endian](https://en.wikipedia.org/wiki/Endianness) format. If the direction is from APP to hardware, the status is always `0x0000`. If the direction is from hardware to APP, the status is the result of the command. +- **LEN**: `2 Bytes` in unsigned [Big Endian](https://en.wikipedia.org/wiki/Endianness) format, the length of the data, maximum is `512`. +- **LRC2**: `1 Byte`, the LRC ([**L**ongitudinal **R**edundancy **C**heck](https://en.wikipedia.org/wiki/Longitudinal_redundancy_check)) of the `CMD`, `STATUS` and `LEN`. +- **DATA**: `LEN Bytes`, the data to send or receive, maximum is `512 Bytes`. This could be anything, for example you should sending key type, block number, and the card keys when reading a block. +- **LRC3**: `1 Byte`, the LRC ([**L**ongitudinal **R**edundancy **C**heck](https://en.wikipedia.org/wiki/Longitudinal_redundancy_check)) of the `DATA`. + +The total length of the packet is `LEN + 10` Bytes. For receiving, it is the exact same format. ## Packet payloads