日志调整及现场测试

This commit is contained in:
tiger_zhou 2024-05-29 15:19:04 +08:00
parent c04c0afba5
commit 099cb89bbb
2 changed files with 27 additions and 9 deletions

View File

@ -8,7 +8,6 @@ import (
"joylink.club/bj-rtsts-server/third_party/message"
"joylink.club/bj-rtsts-server/third_party/udp"
"log/slog"
"strconv"
"sync"
)
@ -89,10 +88,10 @@ func (b *BtmVobcClient) handleBtmVobcFrames(cfs []byte) {
req := &message.BtmVobcReq{}
req.Decode(dataText)
fmt.Println(req, "========================")
} else {
} /*else {
slog.Error("btm vobc 解析未知命令帧类型", strconv.FormatInt(int64(frameType), 16), frameType, "原始数据:", hex.EncodeToString(cfs), "长度:", len(cfs))
return
}
}*/
}
func (b *BtmVobcClient) SendData(data []byte) {
if b.client != nil {

View File

@ -2,6 +2,7 @@ package train_pc_sim
import (
"context"
"encoding/hex"
"fmt"
"joylink.club/bj-rtsts-server/config"
"joylink.club/bj-rtsts-server/dto/state_proto"
@ -311,8 +312,12 @@ func (d *trainPcSimService) SendDriverActive(train *state_proto.TrainState) {
msg.Type = SENDER_TRAIN_TC_NOT_ACTIVE
}
}
client.Send(msg.Encode())
da := msg.Encode()
slog.Info("发送驾驶激活 列车", train.Id, "数据", hex.EncodeToString(da))
err := client.Send(da)
if err != nil {
slog.Error("发送驾驶激活 列车", train.Id, "数据", hex.EncodeToString(da), err)
}
}
func (d *trainPcSimService) SendHandleSwitch(oldTraction, oldBrakeForce int64, tractionState bool, train *state_proto.TrainState) {
tc := train.ConnState
@ -348,7 +353,12 @@ func (d *trainPcSimService) SendHandleSwitch(oldTraction, oldBrakeForce int64, t
msg.Type = RECIVE_TRAIN_HAND_KEY_BACKWARD
}
}
client.Send(msg.Encode())
da := msg.Encode()
slog.Info("发送列车手柄消息", "clientKey", clientKey, "msg", hex.EncodeToString(da))
err := client.Send(da)
if err != nil {
slog.Error("发送列车手柄消息失败", "clientKey", clientKey, "msg", hex.EncodeToString(da))
}
}
}
func (d *trainPcSimService) SendTrainDirection(train *state_proto.TrainState, trainForward, trainBackward bool) {
@ -365,7 +375,12 @@ func (d *trainPcSimService) SendTrainDirection(train *state_proto.TrainState, tr
clientKey := FindTrainPcSimClientKey(train)
client := d.pcSimClientMap[clientKey]
for _, msg := range baseMsgs {
client.Send(msg.Encode())
da := msg.Encode()
slog.Info("发送列车方向列车", train.Id, "数据", hex.EncodeToString(da))
err := client.Send(da)
if err != nil {
slog.Error("发送列车方向失败列车", train.Id, "数据", hex.EncodeToString(da))
}
}
}
@ -375,9 +390,13 @@ func (d *trainPcSimService) SendBaliseData(train *state_proto.TrainState, msgTyp
msg.Data = data
clientKey := FindTrainPcSimClientKey(train)
client := d.pcSimClientMap[clientKey]
//fmt.Println(fmt.Sprintf("%X", msg.Encode()))
da := msg.Encode()
slog.Info("发送列车PC仿真应答器信息,数据", hex.EncodeToString(da))
client.Send(msg.Encode())
err := client.Send(da)
if err != nil {
slog.Info("发送列车PC仿真应答器信息失败,数据", hex.EncodeToString(da))
}
}
/*