bili

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

README

一款水机设备服务端模拟程序

HTLV+CRC,H头码,T功能码,L数据长度,V数据内容
+------+-------+---------+--------+--------+
| 头码  | 功能码 | 数据长度 | 数据内容 | CRC校验 |
| 1字节 | 1字节  | 1字节   | N字节   |  2字节  |
+------+-------+---------+--------+--------+

头码   功能码 数据长度      Body                         CRC
A2    10    0E           0102030405060708091011121314 050B


说明:
  1.数据长度len是14(0E),这里的len仅仅指Body长度;
   
   lengthFieldOffset   = 2   (len的索引下标是2,下标从0开始) 长度字段的偏差
   lengthFieldLength   = 1   (len是1个byte) 长度字段占的字节数
   lengthAdjustment    = 2   (len只表示Body长度,程序只会读取len个字节就结束,但是CRC还有2byte没读呢,所以为2)
   initialBytesToStrip = 0   (这个0表示完整的协议内容,如果不想要A2,那么这里就是1) 从解码帧中第一次去除的字节数
   maxFrameLength      = 255 + 4(起始码、功能码、CRC) (len是1个byte,所以最大长度是无符号1个byte的最大值)

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL