[add] SnapshotUploadInTime 类补全编译通过,缺接口
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.3"
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 30
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
@@ -20,6 +20,10 @@ android {
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.realtime">
|
||||
<uses-permission
|
||||
android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
|
||||
/
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
</manifest>
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.mogo.realtime.Imp;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.realtime.Interface.RealTimeProvider;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.location.MogoRTKLocation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 2021/1/21
|
||||
*/
|
||||
class RealTimeProviderImp implements RealTimeProvider {
|
||||
@Override
|
||||
public List<ADASRecognizedResult> getLastADASRecognizedResult() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
MogoRTKLocation.getInstance().init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDistanceBetweenTwoPoints() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.realtime.InterfaceManager;
|
||||
package com.mogo.realtime.Interface;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
@@ -1,4 +1,6 @@
|
||||
package com.mogo.realtime.InterfaceManager;
|
||||
package com.mogo.realtime.Interface;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
|
||||
@@ -9,11 +11,15 @@ import java.util.List;
|
||||
* @description 描述
|
||||
* @since: 2021/1/21
|
||||
*/
|
||||
public interface RecognizedResultProvider {
|
||||
public interface RealTimeProvider {
|
||||
/**
|
||||
* 获取 adas 识别列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<ADASRecognizedResult> getLastADASRecognizedResult();
|
||||
|
||||
void init(Context context);
|
||||
|
||||
float getDistanceBetweenTwoPoints();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.realtime.Interface;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 2021/1/21
|
||||
*/
|
||||
public interface RealTimeServiceApis {
|
||||
RealTimeProvider getRecognizedResultManager();
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.mogo.realtime.InterfaceManager;
|
||||
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 2021/1/21
|
||||
*/
|
||||
public interface RealTimeServiceApis {
|
||||
RecognizedResultProvider getRecognizedResultManager();
|
||||
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.mogo.realtime.util;
|
||||
package com.mogo.realtime.constant;
|
||||
|
||||
import android.os.SystemClock;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.CloudLocationInfo;
|
||||
import com.mogo.realtime.Interface.RealTimeApisHandler;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.realtime.util.MogoLatLng;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -62,7 +61,7 @@ public class SimpleLocationCorrectStrategy {
|
||||
try {
|
||||
float targetDistance =
|
||||
(float) (lastLocation.getSpeed() * (SystemClock.elapsedRealtime() - anchorTime) / 1000) + TARGET_DISTANCE_DEVIATION;
|
||||
float distance = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().calculateLineDistance(LocationParseUtil.cloudLocationToMogoLatLng(lastLocation), LocationParseUtil.cloudLocationToMogoLatLng(info));
|
||||
float distance = RealTimeApisHandler.getInstance().getApis().getRecognizedResultManager().getDistanceBetweenTwoPoints();
|
||||
Logger.d(TAG,
|
||||
"准备计算{ lastInfo: " + lastLocation.print() + " info: " + info.print() + " targetDistance: " + targetDistance + " distance : " + distance + "}");
|
||||
if (distance <= targetDistance) {
|
||||
@@ -122,7 +121,7 @@ public class SimpleLocationCorrectStrategy {
|
||||
try {
|
||||
float targetDistance =
|
||||
(float) (lastLocation.getSpeed() * (SystemClock.elapsedRealtime() - anchorTime) / 1000) + TARGET_DISTANCE_DEVIATION;
|
||||
float distance = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().calculateLineDistance(LocationParseUtil.cloudLocationToMogoLatLng(lastLocation), LocationParseUtil.cloudLocationToMogoLatLng(info));
|
||||
float distance = RealTimeApisHandler.getInstance().getApis().getRecognizedResultManager().getDistanceBetweenTwoPoints();
|
||||
Logger.d(TAG,
|
||||
"异常定位点\n准备计算{ lastInfo: " + lastLocation.print() + " info: " + info.print() + " targetDistance: " + targetDistance + " distance : " + distance + "}");
|
||||
// 按照上一个点的方向和速度,计算下一个点的位置,下一个点除坐标点外,其余数据与上一个点相同
|
||||
@@ -4,18 +4,15 @@ import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.realtime.InterfaceManager.RealTimeApisHandler;
|
||||
import com.mogo.realtime.InterfaceManager.RealTimeServiceApis;
|
||||
import com.mogo.realtime.Interface.RealTimeApisHandler;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.realtime.location.LocationResult;
|
||||
import com.mogo.realtime.location.MogoRTKLocation;
|
||||
import com.mogo.realtime.util.MortonCode;
|
||||
import com.mogo.realtime.util.SimpleLocationCorrectStrategy;
|
||||
import com.mogo.realtime.websocket.OnePerSecondSendContent;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.mogo.realtime.entity;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.mogo.utils.CoordinateUtils;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -167,6 +169,7 @@ public class CloudLocationInfo implements Parcelable {
|
||||
Double.compare( that.lon, lon ) == 0;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash( lat, lon );
|
||||
|
||||
@@ -12,11 +12,13 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class MogoRTKLocation {
|
||||
|
||||
@@ -38,7 +40,7 @@ public class MogoRTKLocation {
|
||||
}
|
||||
|
||||
private MogoRTKLocation() {
|
||||
mHandler = new Handler(WorkThreadHandler.newInstance( TAG ).getLooper() ) {
|
||||
mHandler = new Handler(WorkThreadHandler.newInstance(TAG).getLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
@@ -51,7 +53,7 @@ public class MogoRTKLocation {
|
||||
}
|
||||
};
|
||||
mHandler.sendEmptyMessage(MSG_DATA_CHANGED);
|
||||
Logger.d(TAG,"构造方法开始发送消息");
|
||||
Logger.d(TAG, "构造方法开始发送消息");
|
||||
}
|
||||
|
||||
public interface RTKLocationListener {
|
||||
@@ -73,12 +75,12 @@ public class MogoRTKLocation {
|
||||
rtkLocationListener = locationListener;
|
||||
}
|
||||
|
||||
public void unregisterRTKLocationListener(){
|
||||
public void unregisterRTKLocationListener() {
|
||||
rtkLocationListener = null;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
locationManager = (LocationManager) AbsMogoApplication.getApp().getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
|
||||
locationManager = (LocationManager) MoGoAiCloudClient.getInstance().getContext().getSystemService(Context.LOCATION_SERVICE);
|
||||
String provider = locationManager.getBestProvider(getCriteria(), true);
|
||||
Logger.d(TAG, "init provider : " + provider);
|
||||
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
|
||||
@@ -96,9 +98,6 @@ public class MogoRTKLocation {
|
||||
Logger.d(TAG, "RTK LocationManager Provider GPS_PROVIDER unable");
|
||||
}
|
||||
|
||||
// 注册修改上报间隔的广播, 临时使用,后面可直接干掉,发送广播的地方在EntranceFragment
|
||||
IntentFilter filter = new IntentFilter("com.mogo.launcher.action.FIX_UPLOAT_DELAY");
|
||||
AbsMogoApplication.getApp().registerReceiver(fixUploadDelayReceiver, filter);
|
||||
}
|
||||
|
||||
private Criteria getCriteria() {
|
||||
@@ -159,7 +158,7 @@ public class MogoRTKLocation {
|
||||
|
||||
private FixUploadDelayReceiver fixUploadDelayReceiver = new FixUploadDelayReceiver();
|
||||
|
||||
private class FixUploadDelayReceiver extends BroadcastReceiver{
|
||||
private class FixUploadDelayReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
uploadDelay = intent.getIntExtra("fixTime", 0);
|
||||
@@ -168,6 +167,7 @@ public class MogoRTKLocation {
|
||||
|
||||
/**
|
||||
* 默认保持{@link #uploadDelay}间隔进行位置上报,如遇服务端控制,进行上报间隔修改
|
||||
*
|
||||
* @param delay 上报间隔
|
||||
*/
|
||||
public void resetUploadDelay(long delay) {
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.mogo.realtime.util;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 经纬度
|
||||
*/
|
||||
public class MogoLatLng implements Parcelable {
|
||||
|
||||
public final double lat;
|
||||
@Deprecated
|
||||
public final double lng;
|
||||
public final double lon;
|
||||
|
||||
public MogoLatLng(double lat, double lon ) {
|
||||
this.lat = lat;
|
||||
this.lng = lon;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated, use {@link #getLon()} instead.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public double getLng() {
|
||||
return lng;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o ) {
|
||||
if ( this == o ) return true;
|
||||
if ( o == null || getClass() != o.getClass() ) return false;
|
||||
MogoLatLng latLng = ( MogoLatLng ) o;
|
||||
return Double.compare( latLng.lat, lat ) == 0 &&
|
||||
Double.compare( latLng.lon, lon ) == 0;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash( lat, lng, lon );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoLatLng{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel( Parcel dest, int flags ) {
|
||||
dest.writeDouble( this.lat );
|
||||
dest.writeDouble( this.lng );
|
||||
dest.writeDouble( this.lon );
|
||||
}
|
||||
|
||||
protected MogoLatLng(Parcel in ) {
|
||||
this.lat = in.readDouble();
|
||||
this.lng = in.readDouble();
|
||||
this.lon = in.readDouble();
|
||||
}
|
||||
|
||||
public static final Creator< MogoLatLng > CREATOR = new Creator< MogoLatLng >() {
|
||||
@Override
|
||||
public MogoLatLng createFromParcel( Parcel source ) {
|
||||
return new MogoLatLng( source );
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng[] newArray( int size ) {
|
||||
return new MogoLatLng[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user