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

@@ -1,132 +0,0 @@
package com.mogo.module.common.datacenter;
import static com.mogo.eagle.core.data.config.FunctionBuildConfig.gpsProvider;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.map.MogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.cloud.location.CloudLocationInfo;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import mogo.telematics.pad.MessagePad;
/**
* 定位坐标同步数据中心
* 接收来自工控机实际定位数据
*/
public class SnapshotLocationDataCenter {
private static volatile SnapshotLocationDataCenter sInstance;
private SnapshotLocationDataCenter() {
}
public static SnapshotLocationDataCenter getInstance() {
if (sInstance == null) {
synchronized (SnapshotLocationDataCenter.class) {
if (sInstance == null) {
sInstance = new SnapshotLocationDataCenter();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
// adda 工控机数据缓存
private final List<CloudLocationInfo> mMachineCacheList = new ArrayList<>();
private double mCurLon;
private double mCurLat;
private long mSatelliteTime = 0;
/**
* 同步从工控机来的数据
*
* @param data JSON结构化数据
*/
public void syncAdasLocationInfo(JSONObject data) {
if (data == null) {
return;
}
//测试面板状态同步
DebugConfig.setStatus(DebugConfig.sLocation, true);
double lon = data.optDouble("lon", -1);
double lat = data.optDouble("lat", -1);
double alt = data.optDouble("alt", -1);
double heading = data.optDouble("heading", -1);
double speed = data.optDouble("speed", -1);
long satelliteTime = data.optLong("satelliteTime");
long systemTime = data.optLong("systemTime");
realSync(lon, lat, alt, heading, speed, satelliteTime, systemTime);
}
public void syncAdasLocationInfo(MessagePad.GnssInfo gnssInfo) {
//测试面板状态同步
DebugConfig.setStatus(DebugConfig.sLocation, true);
double lon = gnssInfo.getLongitude();
double lat = gnssInfo.getLatitude();
double alt = gnssInfo.getAltitude();
double heading = gnssInfo.getHeading();
double speed = gnssInfo.getGnssSpeed();
long satelliteTime = Double.valueOf(gnssInfo.getSatelliteTime()).longValue();
long systemTime = Double.valueOf(gnssInfo.getSystemTime()).longValue();
realSync(lon, lat, alt, heading, speed, satelliteTime, systemTime);
}
private void realSync(double lon, double lat, double alt, double heading, double speed, long satelliteTime, long systemTime) {
DebugConfig.setStatusData(DebugConfig.sLon, lon);
DebugConfig.setStatusData(DebugConfig.sLat, lat);
// 使用与渠道配置一样的gps提供者提供的数据,app/productFlavors/fPadLenovo.gradle GPS_PROVIDER 0-Android系统1-工控机2-OBU
AutopilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
autopilotStatusInfo.setLocationLat(lat);
autopilotStatusInfo.setLocationLon(lon);
autopilotStatusInfo.setLocationStatus(true);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
// 使用与渠道配置一样的gps提供者提供的数据
// if (gpsProvider == FunctionBuildConfig.gpsProvider) {
// CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
// cloudLocationInfo.setAlt(alt);
// cloudLocationInfo.setHeading(heading);
// cloudLocationInfo.setLat(lat);
// cloudLocationInfo.setLon(lon);
// cloudLocationInfo.setSpeed(speed);
// cloudLocationInfo.setSatelliteTime(satelliteTime);
// cloudLocationInfo.setSystemTime(systemTime);
// cloudLocationInfo.setTileId(String.valueOf(MogoMapUIController.getInstance().getTileId(lon, lat)));
// mMachineCacheList.add(cloudLocationInfo);
//
// mCurLon = cloudLocationInfo.getLon();
// mCurLat = cloudLocationInfo.getLat();
// mSatelliteTime = cloudLocationInfo.getSatelliteTime();
// }
}
public double getCurLon() {
return mCurLon;
}
public double getCurLat() {
return mCurLat;
}
public long getSatelliteTime() {
return mSatelliteTime;
}
}

View File

@@ -1,53 +0,0 @@
package com.mogo.module.common.datacenter.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.mogo.module.common.datacenter.RealTimeData;
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
public class SnapShotMockTestPanelBroadCastReceiver extends BroadcastReceiver {
private static final String TAG = "SnapShotMockTestPanelBroadCastReceiver";
/**
* 定位模拟测试控制面板广播Action
*/
public static final String BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY = "sceneType";
@Override
public void onReceive(Context context, Intent intent) {
try {
int sceneType = intent.getIntExtra(BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY, 0);
// 分发场景
dispatchSceneTest(sceneType);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 分发处理场景
* 定位模拟分发场景中需要case自己处理数据以生产者消费者模式来提供 RealTimeData 所需字段
*
* @param sceneType 场景类型
*/
private void dispatchSceneTest(int sceneType) {
if (sceneType == 1) {
//模拟顺义固定位置
RealTimeData.getInstance().setLat(39.968309);
RealTimeData.getInstance().setLon(116.410871);
RealTimeData.getInstance().setHeading(120);
RealTimeData.getInstance().setSpeed(30);
long satelliteTime = SnapshotLocationDataCenter.getInstance().getSatelliteTime();
if (satelliteTime == 0) {
satelliteTime = System.currentTimeMillis();
}
RealTimeData.getInstance().setSatelliteTime(satelliteTime);
} else if (sceneType == 2) {
}
}
}

View File

@@ -6,11 +6,10 @@ import android.content.Context;
import android.text.TextUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.constants.AdasRecognizedType;
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
import java.util.Collection;
import java.util.Iterator;
@@ -151,15 +150,10 @@ public class BaseDrawer {
* @return 0:lon 1:lat
*/
protected double[] getCurCoordinates() {
double[] coordinates = {
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(),
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
return new double[]{
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon(),
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat()
};
if (coordinates[0] <= 0) {
coordinates[0] = SnapshotLocationDataCenter.getInstance().getCurLon();
coordinates[1] = SnapshotLocationDataCenter.getInstance().getCurLat();
}
return coordinates;
}
/**
@@ -168,7 +162,7 @@ public class BaseDrawer {
* @return SNTP时间
*/
protected long getCurSatelliteTime() {
Long satelliteTime = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getSatelliteTime();
long satelliteTime = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84SatelliteTime();
if (satelliteTime == 0) {
return System.currentTimeMillis();
}

View File

@@ -1,4 +1,4 @@
package com.mogo.module.common.datacenter;
package com.mogo.module.common.mock;
public class RealTimeData {

View File

@@ -1,4 +1,4 @@
package com.mogo.module.common.datacenter;
package com.mogo.module.common.mock;
import com.elegant.spi.annotations.Service;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;

View File

@@ -38,7 +38,6 @@ import com.mogo.map.search.geo.MogoGeocodeResult;
import com.mogo.map.search.geo.MogoRegeocodeResult;
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
import com.mogo.module.common.dialog.WMDialog;
import com.mogo.module.common.drawer.IdentifyDataDrawer;
import com.mogo.module.common.drawer.SnapshotSetDataDrawer;
@@ -712,7 +711,6 @@ public class MockIntentHandler implements IntentHandler {
JSONObject jo = new JSONObject(line);
//改变rtk定位数据触发自车移动
MogoMapUIController.getInstance().syncLocation2Map(jo);
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(jo);
return true;
}

View File

@@ -127,21 +127,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
// });
// }
/*
* 云端下发数据与adas定频传输数据均发送至同一Handler线程处理
*/
// 云端下发的数据
MoGoAiCloudRealTime.registerOnMsgListener(new IMogoCloudOnMsgListener() {
@Override
public void onMsgSend(long id) {
}
@Override
public void onMsgReceived(SocketDownData.LauncherSnapshotProto mogoSnapshotSetData) {
DebugConfig.setStatus(DebugConfig.sDownloadSnapshot, true);
}
});
}

View File

@@ -2,11 +2,8 @@ package com.mogo.module.service.network;
import android.content.Context;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
import com.mogo.module.common.constants.HostConst;
import com.mogo.service.network.IMogoNetwork;
/**
@@ -22,7 +19,6 @@ public class ZhidaoRefreshModel {
private final ZhidaoApiService mRefreshApiService;
public ZhidaoRefreshModel(Context context) {
IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context);
this.mRefreshApiService = MoGoRetrofitFactory.getInstance(HostConst.CARLIFE_HOST).create(ZhidaoApiService.class);
}

View File

@@ -62,7 +62,7 @@ public class MogoRouteOverlayManager implements
}
private void intiDrawer() {
RouteOverlayDrawer.getInstance(mContext).initdraw();
RouteOverlayDrawer.getInstance(mContext).initDraw();
}
@Override

View File

@@ -8,9 +8,9 @@ import android.graphics.BitmapFactory;
import android.graphics.Color;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ColorUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.map.MogoMarkerManager;
import com.mogo.map.MogoOverlayManager;
import com.mogo.map.marker.IMogoMarker;
@@ -18,7 +18,6 @@ import com.mogo.map.marker.MogoMarkerOptions;
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.service.R;
import java.util.ArrayList;
@@ -30,16 +29,16 @@ public class RouteOverlayDrawer {
private IMogoPolyline mMoGoPolyline;
// 连接线参数
private MogoPolylineOptions mPolylineOptions;
private final MogoPolylineOptions mPolylineOptions;
// 线路径集合
private List<MogoLatLng> mPolylinePointList;
private final List<MogoLatLng> mPolylinePointList;
// 渐变色
private List<Integer> mPolylineColors;
private Context mContext;
private final List<Integer> mPolylineColors;
private final Bitmap endingBitmap;
private final Context mContext;
IMogoOverlayManager mogoOverlayManager;
private IMogoMarker endMarker;
private MogoMarkerOptions markderOptions;
private Bitmap endingBitmap;
private MogoMarkerOptions markerOptions;
private static volatile RouteOverlayDrawer sInstance;
private static final String markerType = "route_ending";
@@ -81,8 +80,8 @@ public class RouteOverlayDrawer {
if (endMarker != null) {
return;
}
if (markderOptions == null) {
markderOptions = new MogoMarkerOptions()
if (markerOptions == null) {
markerOptions = new MogoMarkerOptions()
.matchOnRoadSide(true)
.gps(true)
.icon(endingBitmap)
@@ -92,9 +91,9 @@ public class RouteOverlayDrawer {
.zIndex(30001);
// .object(markerShowEntity)
}
markderOptions.latitude(lat).longitude(lon);
markerOptions.latitude(lat).longitude(lon);
//CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG,"addEndingMarker-"+lat+":"+lon);
endMarker = MogoMarkerManager.getInstance(mContext).addMarker(markerType, markderOptions);
endMarker = MogoMarkerManager.getInstance(mContext).addMarker(markerType, markerOptions);
// if (DebugConfig.isDebug()){
// ToastUtils.showLong("绘制终点marker,"+lat+":"+lon);
// }
@@ -152,9 +151,11 @@ public class RouteOverlayDrawer {
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "drawTrajectoryList cost : " + (drawend - drawstart));
}
public void initdraw() {
public void initDraw() {
mPolylinePointList.clear();
MogoLatLng latLng = new MogoLatLng(MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(), MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon());
MogoLatLng latLng = new MogoLatLng(
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat(),
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon());
mPolylinePointList.add(latLng);
mPolylinePointList.add(latLng);
mPolylineColors.clear();