[修改]11号线联锁数据解析删除数据长度校验
All checks were successful
local-test分支打包构建docker并发布运行 / Docker-Build (push) Successful in 1m41s
All checks were successful
local-test分支打包构建docker并发布运行 / Docker-Build (push) Successful in 1m41s
This commit is contained in:
parent
a83952f7b4
commit
0a25ee3170
8
third_party/interlock/beijing11/msg.go
vendored
8
third_party/interlock/beijing11/msg.go
vendored
@ -2,8 +2,6 @@ package beijing11
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// FromInterlockFrame 来自联锁的数据帧
|
// FromInterlockFrame 来自联锁的数据帧
|
||||||
@ -26,9 +24,9 @@ type FromInterlockFrame struct {
|
|||||||
|
|
||||||
func (f *FromInterlockFrame) Decode(data []byte) error {
|
func (f *FromInterlockFrame) Decode(data []byte) error {
|
||||||
f.Len = binary.BigEndian.Uint16(data[1:3])
|
f.Len = binary.BigEndian.Uint16(data[1:3])
|
||||||
if int(f.Len) != len(data)-3 {
|
//if int(f.Len) != len(data)-3 {
|
||||||
return errors.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.InterlockCode = binary.BigEndian.Uint16(data[3:5])
|
||||||
f.WaysideCode = binary.BigEndian.Uint16(data[5:7])
|
f.WaysideCode = binary.BigEndian.Uint16(data[5:7])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user