[2.13.0-arch-opt] merg

This commit is contained in:
zhongchao
2023-01-30 22:29:40 +08:00
parent d46c11767d
commit 66db271f6c
17 changed files with 52 additions and 58 deletions

View File

@@ -0,0 +1,74 @@
package com.mogo.eagle.core.function.business;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.enums.DataSourceType;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import java.util.Objects;
import java.util.Timer;
import java.util.TimerTask;
import mogo.telematics.pad.MessagePad;
/**
* 限速
*
* @author mogoauto
*/
public class SpeedLimitDataManager implements IMoGoChassisLocationGCJ02Listener {
private final static String TAG = "SpeedLimitDataManager";
private static volatile SpeedLimitDataManager instance;
private MessagePad.GnssInfo mLocation;
private SpeedLimitDataManager() {
}
public static SpeedLimitDataManager getInstance() {
if (instance == null) {
synchronized (SpeedLimitDataManager.class) {
if (instance == null) {
instance = new SpeedLimitDataManager();
}
}
}
return instance;
}
@Override
public void onChassisLocationGCJ02(@Nullable MessagePad.GnssInfo gnssInfo) {
mLocation = gnssInfo;
}
private class SpeedTimerTask extends TimerTask {
@Override
public void run() {
if (mLocation != null) {
if (CallerMapUIServiceManager.INSTANCE.getMapUIController() != null) {
getSpeedLimit();
}
}
}
private void getSpeedLimit() {
int speedLimit = Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMapUIController()).getLimitSpeed(mLocation.getLongitude(), mLocation.getLatitude(), (float) mLocation.getHeading());
UiThreadHandler.post(() -> {
if (speedLimit > 0) {
CallerLimitingVelocityListenerManager.INSTANCE.invokeOnLimitingVelocityChange(speedLimit, DataSourceType.MAP);
}
});
}
}
public void start() {
CallerChassisLocationGCJ20ListenerManager.INSTANCE.addListener(TAG, this);
Timer mTimer = new Timer();
mTimer.schedule(new SpeedTimerTask(), 3000, 1000);
}
}

View File

@@ -15,6 +15,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
import com.mogo.eagle.core.function.business.MapPointCloudSubscriber
import com.mogo.eagle.core.function.business.SpeedLimitDataManager
import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
import com.mogo.eagle.core.function.business.routeoverlay.MogoRouteOverlayManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
@@ -199,6 +200,8 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
MapIdentifySubscriber.instance
MogoRouteOverlayManager.getInstance().init()
MapPointCloudSubscriber.instance
SpeedLimitDataManager.getInstance().start()
// TODO GD地图业务需要与高精地图业务拆开 --- 扶风
queryInfStructure()
}