This commit is contained in:
zhongchao
2021-01-25 17:24:26 +08:00
27 changed files with 155 additions and 112 deletions

View File

@@ -28,6 +28,13 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation project(path: ':foudations:mogo-passport')
implementation project(":foudations:mogo-commons")
implementation project(":foudations:mogo-socket")
if (Boolean.valueOf(RELEASE)) {
implementation "com.mogo.cloud:commons:${MOGO_COMMONS_VERSION}"
implementation "com.mogo.cloud:socket:${MOGO_SOCKET_VERSION}"
} else {
implementation project(":foudations:mogo-socket")
implementation project(":foudations:mogo-commons")
}
}

View File

@@ -0,0 +1,4 @@
GROUP=com.mogo.cloud
POM_ARTIFACT_ID=realtime
VERSION_CODE=1
VERSION_NAME=1.0.1-SNAPSHOT

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

@@ -9,7 +9,6 @@ import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
import com.mogo.cloud.socket.MsgBody;
import com.mogo.cloud.socket.SocketManager;
import com.mogo.cloud.socket.WebSocketData;
import com.mogo.realtime.Interface.RealTimeApisHandler;
import com.mogo.realtime.constant.SimpleLocationCorrectStrategy;
import com.mogo.realtime.entity.ADASRecognizedResult;
import com.mogo.realtime.entity.CloudLocationInfo;
@@ -118,10 +117,11 @@ public class SocketHandler {
locationResult.sn = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
locationResult.coordinates.addAll(cloudLocationInfo);
}
List<ADASRecognizedResult> recognizedResults = RealTimeApisHandler.getInstance().getApis().getRecognizedResultManager().getLastADASRecognizedResult();//外显接口返回
//todo 改造
// List<ADASRecognizedResult> recognizedResults = RealTimeApisHandler.getInstance().getApis().getRecognizedResultManager().getLastADASRecognizedResult();//外显接口返回
OnePerSecondSendContent content = new OnePerSecondSendContent();
content.self = locationResult;
content.adas = recognizedResults;
// content.adas = recognizedResults;
if (content.self == null &&
(content.adas == null || content.adas.isEmpty())) {

View File

@@ -37,6 +37,13 @@ dependencies {
implementation rootProject.ext.dependencies.rxjava
implementation rootProject.ext.dependencies.rxandroid
implementation project(path: ':foudations:mogo-commons')
}
if (Boolean.valueOf(RELEASE)) {
implementation "com.mogo.cloud:commons:${MOGO_COMMONS_VERSION}"
} else {
implementation project(path: ':foudations:mogo-commons')
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -1,4 +1,4 @@
GROUP=com.mogo.cloud
POM_ARTIFACT_ID=tanlu
VERSION_CODE=1
VERSION_NAME=1.0.0
VERSION_NAME=1.0.1-SNAPSHOT

View File

@@ -120,12 +120,16 @@ public class UploadManager {
Location location = new Location();
location.setLat(39.968317);
location.setLon(116.410892);
RoadInfoRequest request = new RoadInfoRequest(location, "", list, false, false);
RoadInfoRequest request = new RoadInfoRequest(location, "中关村", list, false, false);
Map<String, Object> map = new HashMap<>();
map.put("sn", "F803EB2046PZD00228");
map.put("data", GsonUtil.jsonFromObject(request));
// Map<String, Object> map = new HashMap<>();
// map.put("sn", MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn());
// map.put("data", GsonUtil.jsonFromObject(roadInfoRequest));
apiService.queryRoadInfos(map)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())

View File

@@ -11,8 +11,8 @@ import java.util.ArrayList;
*/
public class RoadInfoRequest {
private Location location; //没有定位信息,可传空对象。如果没有,服务端将更加文字逆序成经纬度查询
private String inputText;
private Location location; //没有定位信息,可传空对象。如果没有,服务端将根据文字逆序成经纬度查询
private String inputText; //必须是有效的地理信息,否则可能会报错
private ArrayList<String> poiTypes;
private boolean onlyFocus;
private boolean onlySameCity;
@@ -33,6 +33,14 @@ public class RoadInfoRequest {
this.location = location;
}
public String getInputText() {
return inputText;
}
public void setInputText(String inputText) {
this.inputText = inputText;
}
public ArrayList<String> getPoiTypes() {
return poiTypes;
}
@@ -57,13 +65,5 @@ public class RoadInfoRequest {
this.onlySameCity = onlySameCity;
}
@Override
public String toString() {
return "RoadInfoRequest{" +
"location=" + location +
", poiTypes=" + poiTypes +
", onlyFocus=" + onlyFocus +
", onlySameCity=" + onlySameCity +
'}';
}
}