日志调整及现场测试

This commit is contained in:
tiger_zhou 2024-06-14 16:48:59 +08:00
parent 8aebff96a5
commit 815b181a0c
2 changed files with 8 additions and 4 deletions

View File

@ -50,7 +50,7 @@ func (tp *TrainPcSimBaseMessage) Decode(data []byte) error {
pcType, _ = buf.ReadByte()
dataLen, _ := buf.ReadByte()
if buf.Len() < int(dataLen)-1-1-1+2 {
if buf.Len() > int(dataLen)-1-1-1 {
return fmt.Errorf("")
}

View File

@ -302,7 +302,7 @@ func (d *trainPcSimService) Start(pcSimManage TrainPcSimManage) {
//FireTrainControlEventType.Subscribe(wd, d.trainControlEventHandle)
d.updateState(tpapi.ThirdPartyState_Normal)
go d.sendTrainLocationAndSpeedTask(ctx)
//go d.sendTrainLocationAndSpeedTask(ctx)
}
func (d *trainPcSimService) Stop() {
d.updateState(tpapi.ThirdPartyState_Closed)
@ -371,8 +371,12 @@ func (d *trainPcSimService) sendTrainLocationAndSpeedTask(ctx context.Context) {
bm := &message.TrainPcSimBaseMessage{Type: SENDER_TRAIN_LOCATION_INFO, Data: data}
train.PluseCount.PulseCount1 = 0
train.PluseCount.PulseCount2 = 0
rd.tcpClient.Send(bm.Encode())
dataCode := bm.Encode()
slog.Info(fmt.Sprintf("发送列车速度位置,列车:%v,发送数据:%v", train.Id, hex.EncodeToString(dataCode)))
err := rd.tcpClient.Send(dataCode)
if err != nil {
slog.Error(fmt.Sprintf("发送列车速度位置失败,列车:%v,发送数据:%v", train.Id, hex.EncodeToString(dataCode)))
}
/*client := d.pcSimClientMap[clientKey]
s1, s2 := train.PluseCount.PulseCount1, train.PluseCount.PulseCount2
d.speedPlace.ParsePulseCount1(s1, s2)