[修改]11号线联锁解析err类型
All checks were successful
local-test分支打包构建docker并发布运行 / Docker-Build (push) Successful in 1m34s

This commit is contained in:
thesai 2024-05-29 17:23:31 +08:00
parent cac309f4b1
commit a83952f7b4

View File

@ -2,8 +2,8 @@ package beijing11
import (
"encoding/binary"
"errors"
"fmt"
"joylink.club/bj-rtsts-server/sys_error"
)
// FromInterlockFrame 来自联锁的数据帧
@ -27,7 +27,7 @@ type FromInterlockFrame struct {
func (f *FromInterlockFrame) Decode(data []byte) error {
f.Len = binary.BigEndian.Uint16(data[1:3])
if int(f.Len) != len(data)-3 {
return sys_error.New(fmt.Sprintf("%s数据长度不对[%d:%d]", logTag, f.Len, len(data)-3))
return errors.New(fmt.Sprintf("%s数据长度不对[%d:%d]", logTag, f.Len, len(data)-3))
}
f.InterlockCode = binary.BigEndian.Uint16(data[3:5])
f.WaysideCode = binary.BigEndian.Uint16(data[5:7])