雷达发送功能调整

This commit is contained in:
tiger_zhou 2024-01-25 09:57:17 +08:00
parent b89f4e4b3f
commit 51d8716d4f

View File

@ -16,7 +16,6 @@ import (
type RadarVobc interface {
Start(radar RadarVobcManager)
Stop()
SendRadarInfo(ctx context.Context)
}
type RadarVobcManager interface {
@ -60,10 +59,11 @@ func (rv *radarVobc) Start(radar RadarVobcManager) {
ctx, cancleFunc := context.WithCancel(context.Background())
rv.radarVobcTaskContext = cancleFunc
rv.radarVobcManager = radar
go rv.SendRadarInfo(ctx)
go rv.sendRadarInfo(ctx)
}
func (rv *radarVobc) SendRadarInfo(ctx context.Context) {
// sendRadarInfo 发送速度,位移计数 给vobc
func (rv *radarVobc) sendRadarInfo(ctx context.Context) {
/*defer func() {
slog.Error("")
}()*/
@ -72,7 +72,6 @@ func (rv *radarVobc) SendRadarInfo(ctx context.Context) {
case <-ctx.Done():
return
default:
}
trainStatus := rv.radarVobcManager.FindRadarTrain()
if trainStatus != nil {
@ -85,13 +84,13 @@ func (rv *radarVobc) SendRadarInfo(ctx context.Context) {
}
func (rv *radarVobc) Stop() {
if rv.vobcClient != nil {
rv.vobcClient.Close()
rv.vobcClient = nil
}
if rv.radarVobcTaskContext != nil {
rv.radarVobcTaskContext()
rv.radarVobcTaskContext = nil
}
if rv.vobcClient != nil {
rv.vobcClient.Close()
rv.vobcClient = nil
}
}