[修改]11号线联锁数据解析删除洗车机数据;删除紧急停车后两个命令
All checks were successful
local-test分支打包构建docker并发布运行 / Docker-Build (push) Successful in 1m37s
All checks were successful
local-test分支打包构建docker并发布运行 / Docker-Build (push) Successful in 1m37s
This commit is contained in:
parent
0a25ee3170
commit
497bbad8ed
30
third_party/interlock/beijing11/msg.go
vendored
30
third_party/interlock/beijing11/msg.go
vendored
@ -19,7 +19,7 @@ type FromInterlockFrame struct {
|
||||
FymData *DeviceData //防淹门数据
|
||||
SPKSData *SPKSData //SPKS数据
|
||||
CkmData *DeviceData //车库门数据
|
||||
XcjData *DeviceData //洗车机数据
|
||||
//XcjData *DeviceData //洗车机数据
|
||||
}
|
||||
|
||||
func (f *FromInterlockFrame) Decode(data []byte) error {
|
||||
@ -50,8 +50,8 @@ func (f *FromInterlockFrame) Decode(data []byte) error {
|
||||
f.SPKSData = spksData
|
||||
ckmData, i := decodeDeviceData(data, i)
|
||||
f.CkmData = ckmData
|
||||
xcjData, i := decodeDeviceData(data, i)
|
||||
f.XcjData = xcjData
|
||||
//xcjData, i := decodeDeviceData(data, i)
|
||||
//f.XcjData = xcjData
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -77,16 +77,16 @@ func decodeDeviceData(data []byte, index uint16) (*DeviceData, uint16) {
|
||||
func decodeESBData(data []byte, index uint16) (*ESBData, uint16) {
|
||||
data = data[index:]
|
||||
num := binary.BigEndian.Uint16(data[0:2])
|
||||
nextIndex := 2 + 6*num
|
||||
nextIndex := 2 + 4*num
|
||||
data = data[2:nextIndex]
|
||||
var cmdList []*ESBCmd
|
||||
for i := 0; i < len(data); i += 6 {
|
||||
for i := 0; i < len(data); i += 4 {
|
||||
cmdList = append(cmdList, &ESBCmd{
|
||||
Id: binary.BigEndian.Uint16(data[i : i+2]),
|
||||
JjtcCmd: data[i+2],
|
||||
JjtcplCmd: data[i+3],
|
||||
JjtcfmqCmd: data[i+4],
|
||||
Ess1Cmd: data[i+5],
|
||||
Id: binary.BigEndian.Uint16(data[i : i+2]),
|
||||
JjtcCmd: data[i+2],
|
||||
JjtcplCmd: data[i+3],
|
||||
//JjtcfmqCmd: data[i+4],
|
||||
//Ess1Cmd: data[i+5],
|
||||
})
|
||||
}
|
||||
deviceData := &ESBData{
|
||||
@ -159,11 +159,11 @@ type SPKSData struct {
|
||||
}
|
||||
|
||||
type ESBCmd struct {
|
||||
Id uint16 //紧急停车ID
|
||||
JjtcCmd byte //紧急停车按钮命令
|
||||
JjtcplCmd byte //紧急停车旁路按钮命令
|
||||
JjtcfmqCmd byte //紧急停车蜂鸣器命令
|
||||
Ess1Cmd byte //Ess1指示灯状态
|
||||
Id uint16 //紧急停车ID
|
||||
JjtcCmd byte //紧急停车按钮命令
|
||||
JjtcplCmd byte //紧急停车旁路按钮命令
|
||||
//JjtcfmqCmd byte //紧急停车蜂鸣器命令
|
||||
//Ess1Cmd byte //Ess1指示灯状态
|
||||
}
|
||||
|
||||
type HoldTrainCmd struct {
|
||||
|
8
third_party/interlock/beijing11/msg_test.go
vendored
8
third_party/interlock/beijing11/msg_test.go
vendored
@ -16,7 +16,7 @@ func TestFromInterlockFrame_Decode(t *testing.T) {
|
||||
data = binary.BigEndian.AppendUint16(data, interlockCode)
|
||||
data = binary.BigEndian.AppendUint16(data, waysideCode)
|
||||
//填充设备数据
|
||||
deviceCmdCount := []int{1, 1, 4, 4, 1, 1, 1, 1, 2, 1, 1}
|
||||
deviceCmdCount := []int{1, 1, 2, 4, 1, 1, 1, 1, 2, 1}
|
||||
for i, count := range deviceCmdCount {
|
||||
data = binary.BigEndian.AppendUint16(data, uint16(i)) //设备数量
|
||||
for j := 0; j < i; j++ {
|
||||
@ -26,6 +26,10 @@ func TestFromInterlockFrame_Decode(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
//保留字节及CRC(先瞎填吧,现在没有校验)
|
||||
for i := 0; i < 14; i++ {
|
||||
data = append(data, 0)
|
||||
}
|
||||
//替换长度
|
||||
len := uint16(len(data) - 3)
|
||||
data[1] = byte(len >> 8)
|
||||
@ -38,7 +42,7 @@ func TestFromInterlockFrame_Decode(t *testing.T) {
|
||||
t.FailNow()
|
||||
}
|
||||
marshal, _ := json.Marshal(f)
|
||||
fmt.Println(marshal)
|
||||
fmt.Println(string(marshal))
|
||||
//if f.InterlockCode != interlockCode {
|
||||
// t.Error()
|
||||
//}
|
||||
|
Loading…
Reference in New Issue
Block a user