remove networkold api and union the adasapis and adasstatus lat lon data
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.common.datacenter;
|
||||
package com.mogo.module.common.mock;
|
||||
|
||||
public class RealTimeData {
|
||||
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user