remove networkold api and union the adasapis and adasstatus lat lon data

This commit is contained in:
zhongchao
2022-03-29 19:09:35 +08:00
parent 66cde2ea81
commit acbde6411e
43 changed files with 129 additions and 732 deletions

View File

@@ -11,7 +11,6 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_C
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_VEHICLE
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_ADAS
@@ -19,6 +18,7 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LO
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_DATA_TRACKED
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_TRAJECTORY
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_VEHICLE
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeArriveAtStation
@@ -37,8 +37,6 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showAdUpgradeStatu
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showDockerRebootResult
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.module.common.MogoApisHandler
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter
import com.zhidao.support.adas.high.AdasManager
import com.zhidao.support.adas.high.OnAdasListener
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo
@@ -125,21 +123,13 @@ class MoGoAdasListenerImpl : OnAdasListener {
)
override fun onGnssInfo(header: MessagePad.Header, gnssInfo: MessagePad.GnssInfo?) {
invokeAutopilotCarStateData(gnssInfo)
// 同步给MAP地图
if (gnssInfo != null) {
MogoApisHandler.getInstance().apis.adasControllerApi.lastLat = gnssInfo.latitude
MogoApisHandler.getInstance().apis.adasControllerApi.lastLon = gnssInfo.longitude
MogoApisHandler.getInstance().apis.adasControllerApi.satelliteTime =
java.lang.Double.valueOf(gnssInfo.satelliteTime).toLong()
if (1 == FunctionBuildConfig.gpsProvider) {
CallerMapUIServiceManager.getMapUIController()?.syncLocation2Map(
gnssInfo
)
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(gnssInfo)
// 同步给MAP地图
CallerMapUIServiceManager.getMapUIController()?.syncLocation2Map(gnssInfo)
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon(gnssInfo.satelliteTime.toLong(),gnssInfo.longitude, gnssInfo.latitude)
}
//根据加速度判断 是否刹车
CallerAutopilotVehicleStateListenerManager.invokeAutopilotBrakeLightByAcceleration(gnssInfo.acceleration)
}
}

View File

@@ -1,13 +1,18 @@
package com.mogo.eagle.core.function.autopilot.adapter;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_DEVA;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager;
@@ -24,12 +29,11 @@ import chassis.Chassis;
import mogo.telematics.pad.MessagePad;
import record_cache.RecordPanelOuterClass;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_DEVA;
public class MoGoHandAdasMsgManager implements
IMoGoAutopilotIdentifyListener,
IMoGoAutopilotVehicleStateListener,
IMoGoAutopilotCarConfigListener{
IMoGoAutopilotCarConfigListener,
IMoGoAutopilotCarStateListener {
private final String TAG = "AdasEventManager";
@@ -39,6 +43,7 @@ public class MoGoHandAdasMsgManager implements
CallerAutopilotIdentifyListenerManager.INSTANCE.addListener(TAG, this);
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, this);
CallerAutopilotCarConfigListenerManager.INSTANCE.addListener(TAG, this);
CallerAutopilotCarStatusListenerManager.INSTANCE.addListener(TAG, this);
}
public static MoGoHandAdasMsgManager getInstance() {
@@ -91,17 +96,13 @@ public class MoGoHandAdasMsgManager implements
} else {
isShowTurnLight = false;
}
// CallerLogger.INSTANCE.d(M_DEVA + TAG, "onAutopilotLightSwitchData -- newState:" + state + ",oldState:" + lightSwitch.getNumber());
CallerHmiManager.INSTANCE.showTurnLight(state);
}
}
@Override
public void onAutopilotBrakeLightData(boolean brakeLight) {
// CallerLogger.INSTANCE.d(M_DEVA + TAG, "onAutopilotBrakeLightData -- brakeLight = $brakeLight ---$isShowTurnLight");
// if (!isShowTurnLight) {
// CallerHmiManager.INSTANCE.showBrakeLight(brakeLight ? 1 : 0);
// }
}
@Override
@@ -137,22 +138,20 @@ public class MoGoHandAdasMsgManager implements
}
}
/**
* 根据加速度判断是否刹车
* @param acceleration
*/
@Override
public void onAutopilotBrakeLightByAcceleration(double acceleration) {
//设置刹车信息
if (acceleration < -2.5) {
brakeLight = 1;
} else {
brakeLight = 0;
public void onAutopilotCarStateData(@Nullable MessagePad.GnssInfo gnssInfo) {
//根据加速度判断 是否刹车
if (gnssInfo != null) {
//设置刹车信息
if (gnssInfo.getAcceleration() < -2.5) {
brakeLight = 1;
} else {
brakeLight = 0;
}
if (!isShowTurnLight) {
ThreadUtils.runOnUiThread(() -> CallerHmiManager.INSTANCE.showBrakeLight(brakeLight));
}
}
// CallerLogger.INSTANCE.d(M_DEVA + TAG, "onAutopilotBrakeLightByAcceleration -- acceleration = " + acceleration);
if (!isShowTurnLight) {
CallerHmiManager.INSTANCE.showBrakeLight(brakeLight);
}
}
}

View File

@@ -21,6 +21,7 @@ import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData;
import com.mogo.eagle.core.data.notice.NoticeValue;
import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.function.call.notice.CallerNoticeManager;
import com.mogo.eagle.core.function.hmi.R;
@@ -173,13 +174,11 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
parameters.vehicleType = 10;
//云平台使用的是火星坐标,自动驾驶需要wgs84
double[] gcj02 = CoordinateUtils.transformGcj02toWgs84(mTrafficStyleInfo.getLat(), mTrafficStyleInfo.getLon());
AutopilotControlParameters.AutoPilotLonLat startLocation = new AutopilotControlParameters.AutoPilotLonLat
(MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(),
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat());
parameters.startLatLon = startLocation;
AutopilotControlParameters.AutoPilotLonLat endLocation = new AutopilotControlParameters.AutoPilotLonLat
parameters.startLatLon = new AutopilotControlParameters.AutoPilotLonLat
(CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat(),
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon());
parameters.endLatLon = new AutopilotControlParameters.AutoPilotLonLat
(gcj02[0], gcj02[1]);
parameters.endLatLon = endLocation;
CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters);
}

View File

@@ -10,6 +10,8 @@ import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getCurWgs84Lat
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getCurWgs84Lon
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -84,10 +86,7 @@ class AutoPilotStatusView @JvmOverloads constructor(
currentAutopilot.endName = "HYJC"
currentAutopilot.isSpeakVoice = false
currentAutopilot.startLatLon =
AutopilotControlParameters.AutoPilotLonLat(
MogoApisHandler.getInstance().apis.adasControllerApi.lastLat,
MogoApisHandler.getInstance().apis.adasControllerApi.lastLon
)
AutopilotControlParameters.AutoPilotLonLat(getCurWgs84Lat(),getCurWgs84Lon())
currentAutopilot.endLatLon =
AutopilotControlParameters.AutoPilotLonLat(26.819716071924688, 112.57715442110867)
currentAutopilot.vehicleType = 10

View File

@@ -305,7 +305,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
// 开启Socket长链服务
double lat = location.getLatitude();
double lon = location.getLongitude();
CallerLogger.INSTANCE.d(M_MAIN + TAG,"emArrow lat : " + lat + " , lon : " + lon);
apis.getSocketManagerApi(getApplicationContext()).init(getApplicationContext(), DebugConfig.getSocketAppId(),lat,lon);
}

View File

@@ -51,7 +51,6 @@ class MogoMainService extends Service implements IMogoLocationListener {
UiThreadHandler.postDelayed(() -> {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "5秒已过启动基础服务……");
loadBaseModules();
initADAS();
initGpsSimulatorListener();
HdMapBuildConfig.isMapLoaded = true;
}, 5_000L
@@ -97,12 +96,6 @@ class MogoMainService extends Service implements IMogoLocationListener {
MogoModulesManager.getInstance().loadBaseModule();
}
private void initADAS() {
if (mServiceApis != null) {
mServiceApis.getAdasControllerApi().init(AbsMogoApplication.getApp());
}
}
@Override
public void onLocationChanged(MogoLocation location) {
EventDispatchCenter.getInstance().onLocationChanged(location);

View File

@@ -12,7 +12,6 @@ import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MONITOR
import com.mogo.map.MogoLocationClient
import com.mogo.module.common.MogoApisHandler
import com.mogo.module.common.constants.HostConst
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
@@ -25,10 +24,6 @@ class CronTaskManager(private var context: Context?) {
private const val CRON_TASK_TYPE = 1011
}
private val netWork by lazy {
MogoApisHandler.getInstance().apis.networkApi
}
// 请求路侧摄像头
private var disposable: Disposable? = null

View File

@@ -8,7 +8,9 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Default
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.TooClose
@@ -17,9 +19,6 @@ import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.map.MogoMapUIController
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter
import com.mogo.module.common.drawer.TrafficMarkerDrawer
import com.mogo.module.common.enums.EventTypeEnum
import com.mogo.service.IMogoServiceApis
@@ -169,21 +168,13 @@ class MogoPrivateObuManager private constructor() {
} catch (e: Exception) {
e.printStackTrace()
}
try {
data.putOpt("receiverDataTime", System.currentTimeMillis())
} catch (e: Exception) {
e.printStackTrace()
}
try {
data.putOpt("adasSatelliteTime", System.currentTimeMillis())
} catch (e: Exception) {
e.printStackTrace()
}
// 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统1-工控机2-OBU
if (2 == FunctionBuildConfig.gpsProvider) {
MogoMapUIController.getInstance().syncLocation2Map(data)
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(data)
// 同步给MAP地图
CallerMapUIServiceManager.getMapUIController()?.syncLocation2Map(data)
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
CallerAutoPilotStatusListenerManager.updateAutoPilotLatLon(System.currentTimeMillis(),position.longitude, position.latitude)
}
} catch (e: Exception) {

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
@@ -13,7 +14,6 @@ import com.mogo.map.MogoOverlayManager;
import com.mogo.map.overlay.IMogoOverlayManager;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.overlay.MogoPolylineOptions;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.enums.EventTypeEnum;
import com.mogo.service.statusmanager.IMogoStatusManager;
@@ -78,8 +78,8 @@ public class MoGoV2XPolylineManager implements IMoGoV2XPolylineManager {
// 当前车辆位置
MogoLatLng carLocation = new MogoLatLng(
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon()
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat(),
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon()
);
if (carLocation != null) {

View File

@@ -9,6 +9,7 @@ import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.entity.model.DrawLineInfo;
@@ -43,8 +44,8 @@ public class V2XWarningMarker implements IV2XMarker {
private final List fillPoints = new ArrayList();//停止线经纬度合集
private boolean isFirstLocation = false;
private MogoLatLng carLocation = new MogoLatLng(
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon()
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat(),
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon()
);
/*

View File

@@ -5,6 +5,7 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
@@ -31,8 +32,8 @@ public class LocationUtils {
public static MogoLatLng getCurrentLatLon() {
// 当前车辆位置
MogoLatLng latLon = new MogoLatLng(
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon()
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat(),
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon()
);
IMogoLocationClient locationClient = CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(AbsMogoApplication.getApp());
if (locationClient != null) {

View File

@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.v2x.events.utils
import android.content.Context
import android.graphics.Rect
import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi
import com.mogo.eagle.core.utilcode.util.WindowUtils
@@ -42,8 +43,8 @@ class MapUtils {
mBoundRect.right = paddingRight
// 当前车辆位置
val carLocation = MogoLatLng(
MogoApisHandler.getInstance().apis.adasControllerApi.lastLat,
MogoApisHandler.getInstance().apis.adasControllerApi.lastLon
CallerAutoPilotStatusListenerManager.getCurWgs84Lat(),
CallerAutoPilotStatusListenerManager.getCurWgs84Lon()
)
// 调整自适应的地图镜头
carLocation?.let {

View File

@@ -46,7 +46,7 @@ import java.util.List;
import tv.danmaku.ijk.media.player.IjkMediaPlayer;
/**
* author : donghongyu EmArrow
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020-02-06 23:07
* update : 2021-04-01 17:30