Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
* @description 描述
|
* @description 描述
|
||||||
* @since: 2021/1/21
|
* @since: 2021/1/21
|
||||||
*/
|
*/
|
||||||
public interface RealTimeProvider<T> {
|
public interface RealTimeProvider<T> {
|
||||||
/**
|
/**
|
||||||
* 获取 adas 识别列表
|
* 获取 adas 识别列表
|
||||||
*
|
*
|
||||||
@@ -22,8 +22,8 @@ public interface RealTimeProvider<T> {
|
|||||||
List<ADASRecognizedResult> getLastADASRecognizedResult();
|
List<ADASRecognizedResult> getLastADASRecognizedResult();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 两个点之间的距离
|
* 两个点之间的距离
|
||||||
* */
|
* */
|
||||||
float getDistanceBetweenTwoPoints();
|
float getDistanceBetweenTwoPoints();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,5 +48,5 @@ public interface RealTimeProvider<T> {
|
|||||||
* @param list 消息体
|
* @param list 消息体
|
||||||
* @param listener 回执监听
|
* @param listener 回执监听
|
||||||
*/
|
*/
|
||||||
public void sendMsg(List <CloudLocationInfo> list, IMogoCloudSocketOnMessageListener listener);
|
public void sendMsg(List<CloudLocationInfo> list, IMogoCloudSocketOnMessageListener listener);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
package com.mogo.realtime.Interface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author liujing
|
|
||||||
* @description 描述
|
|
||||||
* @since: 2021/1/21
|
|
||||||
*/
|
|
||||||
public interface RealTimeServiceApis {
|
|
||||||
RealTimeProvider getRecognizedResultManager();
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -2,8 +2,8 @@ package com.mogo.realtime.constant;
|
|||||||
|
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
|
||||||
import com.mogo.realtime.Interface.RealTimeApisHandler;
|
|
||||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||||
|
import com.mogo.realtime.socket.SocketHandler;
|
||||||
import com.mogo.realtime.util.MogoLatLng;
|
import com.mogo.realtime.util.MogoLatLng;
|
||||||
import com.mogo.utils.logger.Logger;
|
import com.mogo.utils.logger.Logger;
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ public class SimpleLocationCorrectStrategy {
|
|||||||
try {
|
try {
|
||||||
float targetDistance =
|
float targetDistance =
|
||||||
(float) (lastLocation.getSpeed() * (SystemClock.elapsedRealtime() - anchorTime) / 1000) + TARGET_DISTANCE_DEVIATION;
|
(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,
|
Logger.d(TAG,
|
||||||
"准备计算{ lastInfo: " + lastLocation.print() + " info: " + info.print() + " targetDistance: " + targetDistance + " distance : " + distance + "}");
|
"准备计算{ lastInfo: " + lastLocation.print() + " info: " + info.print() + " targetDistance: " + targetDistance + " distance : " + distance + "}");
|
||||||
if (distance <= targetDistance) {
|
if (distance <= targetDistance) {
|
||||||
@@ -121,7 +121,7 @@ public class SimpleLocationCorrectStrategy {
|
|||||||
try {
|
try {
|
||||||
float targetDistance =
|
float targetDistance =
|
||||||
(float) (lastLocation.getSpeed() * (SystemClock.elapsedRealtime() - anchorTime) / 1000) + TARGET_DISTANCE_DEVIATION;
|
(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,
|
Logger.d(TAG,
|
||||||
"异常定位点\n准备计算{ lastInfo: " + lastLocation.print() + " info: " + info.print() + " targetDistance: " + targetDistance + " distance : " + distance + "}");
|
"异常定位点\n准备计算{ lastInfo: " + lastLocation.print() + " info: " + info.print() + " targetDistance: " + targetDistance + " distance : " + distance + "}");
|
||||||
// 按照上一个点的方向和速度,计算下一个点的位置,下一个点除坐标点外,其余数据与上一个点相同
|
// 按照上一个点的方向和速度,计算下一个点的位置,下一个点除坐标点外,其余数据与上一个点相同
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import com.mogo.cloud.passport.MoGoAiCloudClient;
|
|||||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
|
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
|
||||||
import com.mogo.cloud.socket.MsgBody;
|
import com.mogo.cloud.socket.MsgBody;
|
||||||
import com.mogo.cloud.socket.SocketManager;
|
import com.mogo.cloud.socket.SocketManager;
|
||||||
import com.mogo.realtime.Interface.RealTimeApisHandler;
|
|
||||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||||
import com.mogo.cloud.socket.WebSocketData;
|
import com.mogo.cloud.socket.WebSocketData;
|
||||||
@@ -22,8 +21,6 @@ import com.mogo.utils.network.utils.GsonUtil;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.mogo.cloud.socket.WebSocketMsgType.MSG_TYPE_ACK;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author congtaowang
|
* @author congtaowang
|
||||||
* @since 2020/12/14
|
* @since 2020/12/14
|
||||||
@@ -102,7 +99,7 @@ public class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener
|
|||||||
locationResult.sn = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
|
locationResult.sn = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
|
||||||
locationResult.coordinates.addAll(cloudLocationInfo);
|
locationResult.coordinates.addAll(cloudLocationInfo);
|
||||||
}
|
}
|
||||||
List<ADASRecognizedResult> recognizedResults = RealTimeApisHandler.getInstance().getApis().getRecognizedResultManager().getLastADASRecognizedResult();//外显接口返回
|
List<ADASRecognizedResult> recognizedResults = SocketHandler.getInstance().getRealTimeProvider().getLastADASRecognizedResult();//外显接口返回
|
||||||
OnePerSecondSendContent content = new OnePerSecondSendContent();
|
OnePerSecondSendContent content = new OnePerSecondSendContent();
|
||||||
content.self = locationResult;
|
content.self = locationResult;
|
||||||
content.adas = recognizedResults;
|
content.adas = recognizedResults;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import android.os.SystemClock;
|
|||||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
|
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
|
||||||
import com.mogo.cloud.socket.SocketManager;
|
import com.mogo.cloud.socket.SocketManager;
|
||||||
import com.mogo.cloud.socket.WebSocketData;
|
import com.mogo.cloud.socket.WebSocketData;
|
||||||
|
import com.mogo.realtime.Interface.RealTimeProvider;
|
||||||
import com.mogo.utils.network.utils.GsonUtil;
|
import com.mogo.utils.network.utils.GsonUtil;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -22,6 +23,7 @@ public class SocketHandler {
|
|||||||
private long serverTime = 0;
|
private long serverTime = 0;
|
||||||
private long receiveMsgTime = 0;
|
private long receiveMsgTime = 0;
|
||||||
private List<IMogoCloudSocketOnMessageListener> listenerList;
|
private List<IMogoCloudSocketOnMessageListener> listenerList;
|
||||||
|
public RealTimeProvider realTimeProvider;
|
||||||
|
|
||||||
public static SocketHandler getInstance() {
|
public static SocketHandler getInstance() {
|
||||||
if (mInstance == null) {
|
if (mInstance == null) {
|
||||||
@@ -34,6 +36,10 @@ public class SocketHandler {
|
|||||||
return mInstance;
|
return mInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RealTimeProvider getRealTimeProvider() {
|
||||||
|
return realTimeProvider;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* useInner: 是否注册自己内部的监听
|
* useInner: 是否注册自己内部的监听
|
||||||
* */
|
* */
|
||||||
|
|||||||
Reference in New Issue
Block a user