Merge remote-tracking branch 'origin/master'
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -22,6 +22,7 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -36,6 +36,8 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation project(path: ':foudations:mogo-passport')
|
||||
implementation project(path: ':foudations:mogo-commons')
|
||||
implementation project(path: ':modules:mogo-tanlu')
|
||||
|
||||
// implementation 'com.mogo.cloud:passport:1.0.0'
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
package="com.mogo.cloud">
|
||||
|
||||
<application
|
||||
android:name=".MoGoApplication"
|
||||
android:name="com.mogo.cloud.MoGoApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
@@ -25,10 +25,16 @@
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".network.NetworkActivity"
|
||||
android:name="com.mogo.cloud.network.NetworkActivity"
|
||||
android:label="网络测试">
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".RealTimeActivity"
|
||||
android:label="实时数据测试">
|
||||
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -12,6 +12,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private Button btnJumpPassPort;
|
||||
private Button btnJumpNetWorkPort;
|
||||
private Button btnJumpRealTime;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -29,5 +30,11 @@ public class MainActivity extends AppCompatActivity {
|
||||
Intent intent = new Intent(MainActivity.this, NetworkActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
btnJumpRealTime = findViewById(R.id.btnJumpRealTime);
|
||||
btnJumpRealTime.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(MainActivity.this, RealTimeActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.mogo.cloud;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.mogo.cloud.network.NetworkActivity;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
|
||||
/**
|
||||
@@ -17,6 +19,9 @@ public class PassPortActivity extends AppCompatActivity {
|
||||
private TextView tvSn;
|
||||
private TextView tvToken;
|
||||
|
||||
private Button btnJumpToNet;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -25,11 +30,17 @@ public class PassPortActivity extends AppCompatActivity {
|
||||
btnRefreshToken = findViewById(R.id.btnRefreshToken);
|
||||
tvSn = findViewById(R.id.tvSn);
|
||||
tvToken = findViewById(R.id.tvToken);
|
||||
btnJumpToNet = findViewById(R.id.btnJumpToNet);
|
||||
|
||||
btnRefreshToken.setOnClickListener(v -> {
|
||||
tvSn.setText("SN:" + MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn());
|
||||
tvToken.setText("Token:" + MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getToken());
|
||||
});
|
||||
|
||||
btnJumpToNet.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(this, NetworkActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
19
app/src/main/java/com/mogo/cloud/RealTimeActivity.java
Normal file
19
app/src/main/java/com/mogo/cloud/RealTimeActivity.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.mogo.cloud;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 2021/1/21
|
||||
*/
|
||||
public class RealTimeActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_real_time);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.mogo.cloud.network;
|
||||
|
||||
import com.mogo.cloud.network.V2XRoadDataRes;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.cloud.network;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
@@ -10,6 +11,10 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.cloud.R;
|
||||
import com.mogo.cloud.commons.network.RetrofitFactory;
|
||||
import com.mogo.cloud.tanlu.UploadManager;
|
||||
import com.mogo.cloud.tanlu.api.ITanluUploadCallback;
|
||||
import com.mogo.cloud.tanlu.bean.InformationBody;
|
||||
import com.mogo.cloud.tanlu.bean.UploadResult;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -38,16 +43,35 @@ public class NetworkActivity extends AppCompatActivity {
|
||||
tvResult = (TextView) findViewById(R.id.tv_result);
|
||||
apiService = RetrofitFactory.INSTANCE.getInstance("http://dzt-test.zhidaozhixing.com")
|
||||
.create(ApiService.class);
|
||||
|
||||
btn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
tvResult.setText("结果显示");
|
||||
queryRoadData("ZD802C1938L10797");
|
||||
// queryHelpSignal("ZD802C1938L10797");
|
||||
// queryRoadData("ZD802C1938L10797");
|
||||
// queryHelpSignal("ZD802C1938L10797");
|
||||
|
||||
UploadManager.getInstance(NetworkActivity.this).loadUpload(new InformationBody(), new ITanluUploadCallback() {
|
||||
@Override
|
||||
public void onSuccess(UploadResult result) {
|
||||
Log.d("liyz", "result.id = " + result.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(int code) {
|
||||
Log.d("liyz", " code = " + code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.d("liyz", "onError e = " + e);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void queryRoadData(String sn) {
|
||||
if (apiService != null) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
@@ -21,6 +21,12 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="跳转网络基础测试" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnJumpRealTime"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="实时数据测试" />
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
@@ -29,4 +29,11 @@
|
||||
android:text="Token:"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnJumpToNet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="跳转到网络测试" />
|
||||
|
||||
</LinearLayout>
|
||||
16
app/src/main/res/layout/activity_real_time.xml
Normal file
16
app/src/main/res/layout/activity_real_time.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".RealTimeActivity">
|
||||
|
||||
<Button
|
||||
android:id="@+id/snapshot"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="实时定位 数据上传" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -58,8 +58,8 @@ dependencies {
|
||||
api rootProject.ext.dependencies.retrofitadapter
|
||||
api rootProject.ext.dependencies.retrofitconvertergson
|
||||
api rootProject.ext.dependencies.retrofitconverterscalars
|
||||
implementation project(path: ':foudations:mogo-httpdns')
|
||||
implementation project(path: ':foudations:mogo-passport')
|
||||
// api 'com.mogo.cloud:passport:1.0.0'
|
||||
// api 'com.mogo.cloud:httpdns:1.0.0'
|
||||
api project(path: ':foudations:mogo-httpdns')
|
||||
api project(path: ':foudations:mogo-passport')
|
||||
|
||||
|
||||
}
|
||||
@@ -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,54 @@
|
||||
package com.mogo.realtime.Imp;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.realtime.Interface.RealTimeProvider;
|
||||
import com.mogo.realtime.connect.IMogoOnMessageListener;
|
||||
import com.mogo.realtime.connect.MsgBody;
|
||||
import com.mogo.realtime.constant.SnapshotUploadInTime;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.location.MogoRTKLocation;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 2021/1/21
|
||||
*/
|
||||
public class RealTimeProviderImp implements RealTimeProvider {
|
||||
private RealTimeProvider mDelegate;
|
||||
|
||||
@Override
|
||||
public List<ADASRecognizedResult> getLastADASRecognizedResult() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDistanceBetweenTwoPoints() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context, String appId) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.init(context, appId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerOnMessageListener(int msgType, IMogoOnMessageListener listener) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.registerOnMessageListener(msgType, listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg(MsgBody body, IMogoOnMessageListener listener) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.sendMsg(body, listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.realtime.InterfaceManager;
|
||||
package com.mogo.realtime.Interface;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.mogo.realtime.Interface;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.realtime.connect.IMogoOnMessageListener;
|
||||
import com.mogo.realtime.connect.MsgBody;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 2021/1/21
|
||||
*/
|
||||
public interface RealTimeProvider {
|
||||
/**
|
||||
* 获取 adas 识别列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<ADASRecognizedResult> getLastADASRecognizedResult();
|
||||
|
||||
/*
|
||||
* 两个点之间的距离
|
||||
* */
|
||||
float getDistanceBetweenTwoPoints();
|
||||
|
||||
/**
|
||||
* 初始化,各模块不用关心
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param appId 一般为包名,不参与通道的建立,一般用于发消息
|
||||
*/
|
||||
void init(Context context, String appId);
|
||||
|
||||
/**
|
||||
* 注册消息监听
|
||||
*
|
||||
* @param msgType 消息类型
|
||||
* @param listener 回调
|
||||
*/
|
||||
void registerOnMessageListener(int msgType, IMogoOnMessageListener listener);
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*
|
||||
* @param body 消息体
|
||||
* @param listener 回执监听
|
||||
*/
|
||||
void sendMsg(MsgBody body, IMogoOnMessageListener listener );
|
||||
}
|
||||
@@ -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,19 +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 RecognizedResultProvider {
|
||||
/**
|
||||
* 获取 adas 识别列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<ADASRecognizedResult> getLastADASRecognizedResult();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.realtime.connect;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-31
|
||||
* <p>
|
||||
* 消息回调
|
||||
*/
|
||||
public interface IMogoOnMessageListener< T > {
|
||||
|
||||
Class< T > target();
|
||||
|
||||
void onMsgReceived(T obj);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.mogo.realtime.connect;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-31
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MsgBody {
|
||||
|
||||
/**
|
||||
* 消息类型
|
||||
*/
|
||||
private int mMsgType;
|
||||
|
||||
// /**
|
||||
// * 服务端分发,业务线
|
||||
// */
|
||||
// private int mProductLine = MogoCommon.Product.mogoBussiness_VALUE;
|
||||
//
|
||||
// /**
|
||||
// *
|
||||
// */
|
||||
// private int mHeaderType = MogoConnsvr.MsgType.mogoMsgTypeDispatchSvrNoRspReq_VALUE;
|
||||
|
||||
/**
|
||||
* 是否回执
|
||||
*/
|
||||
private boolean mAck = false;
|
||||
|
||||
/**
|
||||
* 消息ID
|
||||
*/
|
||||
private final long mMsgId = System.currentTimeMillis();
|
||||
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
private Object mContent;
|
||||
|
||||
public MsgBody msgType( int msgType ) {
|
||||
this.mMsgType = msgType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MsgBody ack( boolean ack ) {
|
||||
this.mAck = ack;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MsgBody content( Object object ) {
|
||||
this.mContent = object;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getMsgType() {
|
||||
return mMsgType;
|
||||
}
|
||||
|
||||
public boolean isAck() {
|
||||
return mAck;
|
||||
}
|
||||
|
||||
public long getMsgId() {
|
||||
return mMsgId;
|
||||
}
|
||||
|
||||
public Object getContent() {
|
||||
return mContent;
|
||||
}
|
||||
}
|
||||
@@ -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];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
}
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.3"
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 30
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
@@ -29,21 +28,15 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation rootProject.ext.dependencies.androidxccorektx
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
|
||||
implementation rootProject.ext.dependencies.retrofit
|
||||
implementation rootProject.ext.dependencies.retrofitconvertergson
|
||||
implementation rootProject.ext.dependencies.gson
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
|
||||
implementation 'com.elegant.spi:api:1.0.9'
|
||||
annotationProcessor 'com.elegant.spi:compiler:1.0.3'
|
||||
|
||||
implementation project(path: ':foudations:mogo-passport')
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation project(path: ':foudations:mogo-commons')
|
||||
|
||||
}
|
||||
4
modules/mogo-tanlu/gradle.properties
Normal file
4
modules/mogo-tanlu/gradle.properties
Normal file
@@ -0,0 +1,4 @@
|
||||
GROUP=com.mogo.cloud
|
||||
POM_ARTIFACT_ID=tanlu
|
||||
VERSION_CODE=1
|
||||
VERSION_NAME=1.0.0
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.mogo.cloud;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.mogo.tanlu.test", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.cloud">
|
||||
package="com.mogo.cloud.tanlu">
|
||||
|
||||
</manifest>
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.mogo.cloud;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.cloud.api.ITanluUploadCallback;
|
||||
import com.mogo.cloud.bean.InformationBody;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2021/1/21
|
||||
*/
|
||||
public class UploadManager {
|
||||
private static UploadManager sInstance;
|
||||
private Context mContext;
|
||||
|
||||
private UploadManager (Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public static UploadManager getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
synchronized (UploadManager.class) {
|
||||
sInstance = new UploadManager(context);
|
||||
}
|
||||
}
|
||||
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sn
|
||||
* @param informationBody
|
||||
* @param callback
|
||||
*/
|
||||
public void loadUpload(String sn, InformationBody informationBody, ITanluUploadCallback callback) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.cloud.impl;
|
||||
|
||||
import com.mogo.cloud.api.ILoadUpload;
|
||||
import com.mogo.cloud.api.ITanluUploadCallback;
|
||||
import com.mogo.cloud.bean.InformationBody;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 请求上报
|
||||
* @since 2021/1/20
|
||||
*/
|
||||
public class LoadUploadImpl {
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.mogo.cloud.tanlu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.cloud.commons.network.RetrofitFactory;
|
||||
import com.mogo.cloud.tanlu.api.ITanluUploadCallback;
|
||||
import com.mogo.cloud.tanlu.bean.InformationBody;
|
||||
import com.mogo.cloud.tanlu.bean.UploadResult;
|
||||
import com.mogo.cloud.tanlu.net.TanluApiService;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2021/1/21
|
||||
*/
|
||||
public class UploadManager {
|
||||
private static final String TAG = "UploadManager";
|
||||
private static UploadManager sInstance;
|
||||
private Context mContext;
|
||||
private TanluApiService apiService;
|
||||
|
||||
|
||||
private UploadManager (Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public static UploadManager getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
synchronized (UploadManager.class) {
|
||||
sInstance = new UploadManager(context);
|
||||
}
|
||||
}
|
||||
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param informationBody
|
||||
* @param callback
|
||||
*
|
||||
*/
|
||||
public void loadUpload(InformationBody informationBody, ITanluUploadCallback callback) {
|
||||
apiService = RetrofitFactory.INSTANCE.getInstance("http://dzt-test.zhidaozhixing.com")
|
||||
.create(TanluApiService.class);
|
||||
|
||||
Gson gson = new Gson();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
// map.put("sn", MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn()); //TODO
|
||||
// map.put("data", gson.toJson(informationBody));
|
||||
|
||||
map.put("sn", "F803EB2046PZD00228");
|
||||
map.put("data", "{\"addr\":\"北京市东城区小黄庄北街2号靠近中国银行(北京安贞桥支行)\",\"areaCode\":\"110101\",\"areaName\":\"东城区\",\"cityCode\":\"010\",\"cityName\":\"北京市\",\"data\":\"[{\\\"thumbnail\\\":\\\"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/CarPad/com.zhidao.roadcondition/F803EB2046PZD00228/F803EB2046PZD00228_20210121165329/Thumbnail1611219200669.jpg\\\",\\\"url\\\":\\\"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/CarPad/com.zhidao.roadcondition/F803EB2046PZD00228/F803EB2046PZD00228_20210121165329/compress_video_20210121165307.mp4\\\"}]\",\"direction\":0.0,\"fromType\":\"2\",\"generateTime\":1611219213616,\"infoTimeout\":240,\"infoType\":1,\"isShare\":false,\"lat\":39.968317,\"lon\":116.410892,\"mainInfoId\":0,\"poiType\":\"10008\",\"provinceName\":\"北京市\",\"sn\":\"F803EB2046PZD00228\",\"speed\":0.0,\"street\":\"小黄庄北街\",\"trafficInfoType\":\"\",\"type\":1,\"uid\":0}");
|
||||
|
||||
Log.d(TAG, "sn = " + MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn());
|
||||
apiService.uploadInformation(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<UploadResult>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.d(TAG, "onSubscribe -----> ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(UploadResult result) {
|
||||
Log.d(TAG, "onNext -----> ");
|
||||
callback.onSuccess(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e(TAG, "onError -----> e " + e);
|
||||
callback.onError(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.d(TAG, "onComplete -----> ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.cloud.api;
|
||||
package com.mogo.cloud.tanlu.api;
|
||||
|
||||
|
||||
import com.mogo.cloud.bean.InformationBody;
|
||||
import com.mogo.cloud.tanlu.bean.InformationBody;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.cloud.api;
|
||||
package com.mogo.cloud.tanlu.api;
|
||||
|
||||
import com.mogo.cloud.bean.RoadInfos;
|
||||
import com.mogo.cloud.tanlu.bean.RoadInfos;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -10,4 +10,5 @@ import com.mogo.cloud.bean.RoadInfos;
|
||||
public interface IRoadInfoSearchCallback {
|
||||
void onSuccess(RoadInfos result);
|
||||
void onFailure(int code);
|
||||
void onError(Throwable e);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.cloud.api;
|
||||
package com.mogo.cloud.tanlu.api;
|
||||
|
||||
import com.mogo.cloud.bean.UploadResult;
|
||||
import com.mogo.cloud.tanlu.bean.UploadResult;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -10,4 +10,5 @@ import com.mogo.cloud.bean.UploadResult;
|
||||
public interface ITanluUploadCallback {
|
||||
void onSuccess(UploadResult result);
|
||||
void onFailure(int code);
|
||||
void onError(Throwable e);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.bean.location.MarkerLocation;
|
||||
import com.mogo.cloud.tanlu.bean.location.MarkerLocation;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import com.mogo.cloud.bean.location.Location;
|
||||
import com.mogo.cloud.tanlu.bean.location.Location;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean.location;
|
||||
package com.mogo.cloud.tanlu.bean.location;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean.location;
|
||||
package com.mogo.cloud.tanlu.bean.location;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean.location;
|
||||
package com.mogo.cloud.tanlu.bean.location;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.constant;
|
||||
package com.mogo.cloud.tanlu.constant;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.cloud.net;
|
||||
package com.mogo.cloud.tanlu.net;
|
||||
|
||||
import com.mogo.cloud.bean.RoadInfos;
|
||||
import com.mogo.cloud.bean.UploadResult;
|
||||
import com.mogo.cloud.tanlu.bean.RoadInfos;
|
||||
import com.mogo.cloud.tanlu.bean.UploadResult;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.cloud;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user