[修改]12号线联锁通信增加日志;
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
[bug]12号线联锁驱动字节解析bug
This commit is contained in:
parent
e7b7ff6781
commit
c23c70ce05
6
third_party/interlock/beijing12/interlock.go
vendored
6
third_party/interlock/beijing12/interlock.go
vendored
@ -14,6 +14,10 @@ import (
|
||||
"joylink.club/bj-rtsts-server/third_party/udp"
|
||||
)
|
||||
|
||||
const (
|
||||
logTag = "[北京12号线联锁通信]"
|
||||
)
|
||||
|
||||
// 联锁代理通信接口
|
||||
type InterlockMessageManager interface {
|
||||
CollectInterlockRelayInfo(code string) *message.InterlockSendMsgPkg
|
||||
@ -53,7 +57,7 @@ type interlockProxy struct {
|
||||
|
||||
// 驱动信息进行转发
|
||||
func (i *interlockProxy) handleDriverInfo(b []byte) {
|
||||
slog.Info(fmt.Sprintf("收到联锁驱动继电器数据:%x", b))
|
||||
slog.Info(fmt.Sprintf("%s收到联锁驱动继电器数据:%x", logTag, b))
|
||||
handler := i.manager
|
||||
if handler != nil {
|
||||
handler.HandleInterlockDriverInfo(i.runConfig.Code, b)
|
||||
|
6
third_party/message/interlock.go
vendored
6
third_party/message/interlock.go
vendored
@ -163,7 +163,7 @@ func (t *InterlockReceiveMsgPkg) Decode(buf []byte) error {
|
||||
// 驱动数据
|
||||
preIndex = lastIndex
|
||||
lastIndex = lastIndex + t.et_out_num
|
||||
t.parseByte(t.DriveInfo, buf, preIndex, lastIndex)
|
||||
t.parseByte(buf, preIndex, lastIndex)
|
||||
// 应答器报文
|
||||
preIndex = lastIndex
|
||||
lastIndex = lastIndex + t.tcc_output_len
|
||||
@ -173,11 +173,11 @@ func (t *InterlockReceiveMsgPkg) Decode(buf []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *InterlockReceiveMsgPkg) parseByte(r []bool, buf []byte, start, end int) {
|
||||
func (t *InterlockReceiveMsgPkg) parseByte(buf []byte, start, end int) {
|
||||
for i := start; i < end; i++ {
|
||||
b := buf[i]
|
||||
for bit := 7; bit >= 0; bit-- {
|
||||
r = append(r, (b&(1<<bit)) != 0)
|
||||
t.DriveInfo = append(t.DriveInfo, (b&(1<<bit)) != 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -457,7 +457,10 @@ func (s *VerifySimulation) HandleInterlockDriverInfo(code string, b []byte) {
|
||||
continue
|
||||
}
|
||||
driverMsg := message.NewInterlockReceiveMsgPkg(0, len(m.QdList), len(m.TransponderId))
|
||||
driverMsg.Decode(b)
|
||||
err := driverMsg.Decode(b)
|
||||
if err != nil {
|
||||
slog.Error(fmt.Sprintf("联锁驱动数据解析失败:%s", err))
|
||||
}
|
||||
driveState := driverMsg.DriveInfo
|
||||
for i, r := range m.QdList {
|
||||
ds := driveState[i]
|
||||
|
Loading…
Reference in New Issue
Block a user