From fc6b51cc248f3509eafa7562d1ddd17ea8938823 Mon Sep 17 00:00:00 2001 From: thesai <1021828630@qq.com> Date: Thu, 1 Aug 2024 14:25:45 +0800 Subject: [PATCH] =?UTF-8?q?[bug]=E4=BF=A1=E5=8F=B7=E6=9C=BA=E7=94=B5?= =?UTF-8?q?=E8=B7=AF=E7=B3=BB=E7=BB=9F=E9=80=BB=E8=BE=91=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E5=A4=84=E7=90=86=E9=A9=B1=E5=8A=A8=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- third_party/interlock/beijing12/interlock.go | 15 +++++++++++---- .../wayside/memory/wayside_simulation.go | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/third_party/interlock/beijing12/interlock.go b/third_party/interlock/beijing12/interlock.go index 5d70cdf..5a2b1e5 100644 --- a/third_party/interlock/beijing12/interlock.go +++ b/third_party/interlock/beijing12/interlock.go @@ -2,6 +2,7 @@ package beijing12 import ( + "bytes" "context" "fmt" "joylink.club/bj-rtsts-server/sys_error" @@ -169,16 +170,22 @@ func (i *interlockProxy) initInterlockProxy() { func (i *interlockProxy) handleFromCiData(n int, data []byte) { data = data[:n] - logger().Info(fmt.Sprintf("收到联锁驱动及应答器报文数据:%x", data)) - if n+len(i.fromCIBytes) == fromCIBytesLen { //暂时以此作为报文尾判定条件 + logger().Info(fmt.Sprintf("收到联锁驱动及应答器报文数据,长度%d", n)) + if len(i.fromCIBytes) != 0 { //报文头已经存进去了 i.fromCIBytes = append(i.fromCIBytes, data...) - } else { //非报文尾 + if len(i.fromCIBytes) < fromCIBytesLen { //当存储的报文长度不足预期长度 + return + } + } else if bytes.HasPrefix(data, []byte{0xff, 0xff}) { //判断是否是报文头 i.fromCIBytes = append(i.fromCIBytes, data...) return + } else { + return } //处理联锁报文 msg := &fromCiMsg{} err := msg.decode(i.fromCIBytes) + logger().Info(fmt.Sprintf("解析完整联锁驱动及应答器报文数据:%x", i.fromCIBytes)) i.fromCIBytes = i.fromCIBytes[:0] //清空联锁报文存储 if err != nil { logger().Error(fmt.Sprintf("解析来自CI的数据出错:%s", err.Error())) @@ -186,9 +193,9 @@ func (i *interlockProxy) handleFromCiData(n int, data []byte) { } //处理驱动数据 if i.simulation != nil { + logger().Info(fmt.Sprintf("解析出的驱动数据:%x", msg.driveData)) i.simulation.HandleInterlockDriverInfo(i.runConfig.Code, msg.driveData) } - logger().Info(fmt.Sprintf("解析出联锁驱动数据:%x", msg.driveData)) //处理应答器数据 for _, datum := range msg.baliseTelegramData { indexBalise2 := i.indexBalise[datum.leuIndex] diff --git a/ts/simulation/wayside/memory/wayside_simulation.go b/ts/simulation/wayside/memory/wayside_simulation.go index 3d0f4fa..d456f3f 100644 --- a/ts/simulation/wayside/memory/wayside_simulation.go +++ b/ts/simulation/wayside/memory/wayside_simulation.go @@ -458,6 +458,9 @@ func (s *VerifySimulation) HandleInterlockDriverInfo(code string, driveBytes []b for i, b := range driveInfo { qdData := m.QdList[i] for _, relayId := range qdData.RefRelays { + if b { + + } err := wd.SetQdBit(relayId, b) if err != nil { slog.Error("联锁驱动数据设置出错", "error", err)