Merge remote-tracking branch 'origin/master'

This commit is contained in:
董宏宇
2021-01-25 17:14:39 +08:00
6 changed files with 14 additions and 57 deletions

View File

@@ -1,35 +0,0 @@
package com.mogo.realtime.Interface;
/**
* @author liujing
* @description 描述
* @since: 2021/1/21
*/
public final class RealTimeApisHandler {
private static volatile RealTimeApisHandler sInstance;
private static volatile RealTimeServiceApis sApis;
public static RealTimeApisHandler getInstance() {
if (sInstance == null) {
synchronized (RealTimeApisHandler.class) {
sInstance = new RealTimeApisHandler();
}
}
return sInstance;
}
public void initRealTimeEnvironment() {
//socketeinit locationinit rtkinit
}
public RealTimeServiceApis getApis() {
if (sApis == null) {
synchronized (this) {
// sApis = new RealTimeServiceApis();
}
}
return sApis;
}
}

View File

@@ -13,7 +13,7 @@ import java.util.List;
* @description 描述
* @since: 2021/1/21
*/
public interface RealTimeProvider<T> {
public interface RealTimeProvider<T> {
/**
* 获取 adas 识别列表
*
@@ -22,8 +22,8 @@ public interface RealTimeProvider<T> {
List<ADASRecognizedResult> getLastADASRecognizedResult();
/*
* 两个点之间的距离
* */
* 两个点之间的距离
* */
float getDistanceBetweenTwoPoints();
/**
@@ -48,5 +48,5 @@ public interface RealTimeProvider<T> {
* @param list 消息体
* @param listener 回执监听
*/
public void sendMsg(List <CloudLocationInfo> list, IMogoCloudSocketOnMessageListener listener);
public void sendMsg(List<CloudLocationInfo> list, IMogoCloudSocketOnMessageListener listener);
}

View File

@@ -1,11 +0,0 @@
package com.mogo.realtime.Interface;
/**
* @author liujing
* @description 描述
* @since: 2021/1/21
*/
public interface RealTimeServiceApis {
RealTimeProvider getRecognizedResultManager();
}

View File

@@ -2,8 +2,8 @@ package com.mogo.realtime.constant;
import android.os.SystemClock;
import com.mogo.realtime.Interface.RealTimeApisHandler;
import com.mogo.realtime.entity.CloudLocationInfo;
import com.mogo.realtime.socket.SocketHandler;
import com.mogo.realtime.util.MogoLatLng;
import com.mogo.utils.logger.Logger;
@@ -61,7 +61,7 @@ public class SimpleLocationCorrectStrategy {
try {
float targetDistance =
(float) (lastLocation.getSpeed() * (SystemClock.elapsedRealtime() - anchorTime) / 1000) + TARGET_DISTANCE_DEVIATION;
float distance = RealTimeApisHandler.getInstance().getApis().getRecognizedResultManager().getDistanceBetweenTwoPoints();
float distance = SocketHandler.getInstance().getRealTimeProvider().getDistanceBetweenTwoPoints();
Logger.d(TAG,
"准备计算{ lastInfo: " + lastLocation.print() + " info: " + info.print() + " targetDistance: " + targetDistance + " distance : " + distance + "}");
if (distance <= targetDistance) {
@@ -121,7 +121,7 @@ public class SimpleLocationCorrectStrategy {
try {
float targetDistance =
(float) (lastLocation.getSpeed() * (SystemClock.elapsedRealtime() - anchorTime) / 1000) + TARGET_DISTANCE_DEVIATION;
float distance = RealTimeApisHandler.getInstance().getApis().getRecognizedResultManager().getDistanceBetweenTwoPoints();
float distance = SocketHandler.getInstance().getRealTimeProvider().getDistanceBetweenTwoPoints();
Logger.d(TAG,
"异常定位点\n准备计算{ lastInfo: " + lastLocation.print() + " info: " + info.print() + " targetDistance: " + targetDistance + " distance : " + distance + "}");
// 按照上一个点的方向和速度,计算下一个点的位置,下一个点除坐标点外,其余数据与上一个点相同

View File

@@ -8,7 +8,6 @@ import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
import com.mogo.cloud.socket.MsgBody;
import com.mogo.cloud.socket.SocketManager;
import com.mogo.realtime.Interface.RealTimeApisHandler;
import com.mogo.realtime.entity.ADASRecognizedResult;
import com.mogo.realtime.entity.CloudLocationInfo;
import com.mogo.cloud.socket.WebSocketData;
@@ -22,8 +21,6 @@ import com.mogo.utils.network.utils.GsonUtil;
import java.util.ArrayList;
import java.util.List;
import static com.mogo.cloud.socket.WebSocketMsgType.MSG_TYPE_ACK;
/**
* @author congtaowang
* @since 2020/12/14
@@ -102,7 +99,7 @@ public class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener
locationResult.sn = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
locationResult.coordinates.addAll(cloudLocationInfo);
}
List<ADASRecognizedResult> recognizedResults = RealTimeApisHandler.getInstance().getApis().getRecognizedResultManager().getLastADASRecognizedResult();//外显接口返回
List<ADASRecognizedResult> recognizedResults = SocketHandler.getInstance().getRealTimeProvider().getLastADASRecognizedResult();//外显接口返回
OnePerSecondSendContent content = new OnePerSecondSendContent();
content.self = locationResult;
content.adas = recognizedResults;

View File

@@ -6,6 +6,7 @@ import android.os.SystemClock;
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
import com.mogo.cloud.socket.SocketManager;
import com.mogo.cloud.socket.WebSocketData;
import com.mogo.realtime.Interface.RealTimeProvider;
import com.mogo.utils.network.utils.GsonUtil;
import java.util.List;
@@ -22,6 +23,7 @@ public class SocketHandler {
private long serverTime = 0;
private long receiveMsgTime = 0;
private List<IMogoCloudSocketOnMessageListener> listenerList;
public RealTimeProvider realTimeProvider;
public static SocketHandler getInstance() {
if (mInstance == null) {
@@ -34,6 +36,10 @@ public class SocketHandler {
return mInstance;
}
public RealTimeProvider getRealTimeProvider() {
return realTimeProvider;
}
/*
* useInner: 是否注册自己内部的监听
* */