From c64086720323de6b4047fea5b50a71c316fee0d2 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Mon, 25 Jan 2021 15:54:25 +0800 Subject: [PATCH 1/5] opt --- .../mogo/cloud/network/NetworkActivity.java | 17 +++++++++----- .../com/mogo/cloud/tanlu/UploadManager.java | 6 ++++- .../cloud/tanlu/bean/RoadInfoRequest.java | 22 +++++++++---------- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/com/mogo/cloud/network/NetworkActivity.java b/app/src/main/java/com/mogo/cloud/network/NetworkActivity.java index af8d6e2..fad6094 100644 --- a/app/src/main/java/com/mogo/cloud/network/NetworkActivity.java +++ b/app/src/main/java/com/mogo/cloud/network/NetworkActivity.java @@ -37,6 +37,7 @@ public class NetworkActivity extends AppCompatActivity { private Button btn; private TextView tvResult; private ApiService apiService; + private static final String TAG = "NetworkActivity"; @Override @@ -55,7 +56,9 @@ public class NetworkActivity extends AppCompatActivity { queryRoadData("ZD802C1938L10797"); // queryHelpSignal("ZD802C1938L10797"); + //上报路况到服务端 // uploadRoadInfo(); + //查询路况 // queryRoad(); } }); @@ -72,17 +75,18 @@ public class NetworkActivity extends AppCompatActivity { UploadManager.getInstance(NetworkActivity.this).queryRoadInfoByLocationInfo(null , new IRoadInfoSearchCallback() { @Override public void onSuccess(RoadInfos result) { - Log.d("liyz", "queryRoad size() = " + result.getData().size()); + Log.d(TAG, "queryRoad size() = " + result.getData().size()); + tvResult.setText(new Gson().toJson(result)); } @Override public void onFailure(int code) { - Log.d("liyz", "queryRoad code = " + code); + Log.d(TAG, "queryRoad code = " + code); } @Override public void onError(Throwable e) { - Log.d("liyz", "queryRoad e = " + e); + Log.d(TAG, "queryRoad e = " + e); } }); } @@ -92,17 +96,18 @@ public class NetworkActivity extends AppCompatActivity { UploadManager.getInstance(NetworkActivity.this).loadUpload(new InformationBody(), new ITanluUploadCallback() { @Override public void onSuccess(UploadResult result) { - Log.d("liyz", "uploadRoadInfo result.id = " + result.id); + Log.d(TAG, "uploadRoadInfo result.id = " + result.id); + tvResult.setText("onSuccess - " + result.id + ""); } @Override public void onFailure(int code) { - Log.d("liyz", " uploadRoadInfo code = " + code); + Log.d(TAG, " uploadRoadInfo code = " + code); } @Override public void onError(Throwable e) { - Log.d("liyz", "uploadRoadInfo onError e = " + e); + Log.d(TAG, "uploadRoadInfo onError e = " + e); } }); } diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/cloud/tanlu/UploadManager.java b/modules/mogo-tanlu/src/main/java/com/mogo/cloud/tanlu/UploadManager.java index 4f97dce..4e69055 100644 --- a/modules/mogo-tanlu/src/main/java/com/mogo/cloud/tanlu/UploadManager.java +++ b/modules/mogo-tanlu/src/main/java/com/mogo/cloud/tanlu/UploadManager.java @@ -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 map = new HashMap<>(); map.put("sn", "F803EB2046PZD00228"); map.put("data", GsonUtil.jsonFromObject(request)); +// Map 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()) diff --git a/modules/mogo-tanlu/src/main/java/com/mogo/cloud/tanlu/bean/RoadInfoRequest.java b/modules/mogo-tanlu/src/main/java/com/mogo/cloud/tanlu/bean/RoadInfoRequest.java index 9de1163..f49be4b 100644 --- a/modules/mogo-tanlu/src/main/java/com/mogo/cloud/tanlu/bean/RoadInfoRequest.java +++ b/modules/mogo-tanlu/src/main/java/com/mogo/cloud/tanlu/bean/RoadInfoRequest.java @@ -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 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 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 + - '}'; - } + } From 68ce7a4e402c013d78cf298b6cf467e0349c9b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Mon, 25 Jan 2021 16:10:06 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86Maven=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 16 +++++++++++----- .../java/com/mogo/cloud/MoGoApplication.java | 4 +++- foudations/mogo-commons/build.gradle | 12 ++++++------ foudations/mogo-commons/gradle.properties | 2 +- foudations/mogo-passport/build.gradle | 4 ++-- foudations/mogo-passport/gradle.properties | 2 +- foudations/mogo-socket/build.gradle | 6 ++++-- foudations/mogo-socket/gradle.properties | 2 +- modules/mogo-realtime/build.gradle | 8 ++++++-- modules/mogo-realtime/gradle.properties | 4 ++++ modules/mogo-tanlu/build.gradle | 8 ++++++-- modules/mogo-tanlu/gradle.properties | 2 +- 12 files changed, 46 insertions(+), 24 deletions(-) create mode 100644 modules/mogo-realtime/gradle.properties diff --git a/app/build.gradle b/app/build.gradle index 50cb338..15001c0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,7 +11,7 @@ android { versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - + multiDexEnabled true packagingOptions { //解决编译时com.android.builder.merge.DuplicateRelativeFileException: More than one file was found with OS independent path 'META-INF/rxjava.properties'这个错误 exclude 'META-INF/rxjava.properties' @@ -32,13 +32,19 @@ android { dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation 'com.android.support:multidex:1.0.3' + implementation rootProject.ext.dependencies.androidxappcompat implementation rootProject.ext.dependencies.androidxconstraintlayout - implementation project(path: ':foudations:mogo-passport') - implementation project(path: ':foudations:mogo-commons') - implementation project(path: ':modules:mogo-tanlu') +// implementation project(path: ':foudations:mogo-passport') + implementation 'com.mogo.cloud:passport:1.0.2-SNAPSHOT' + +// implementation project(path: ':foudations:mogo-commons') + implementation 'com.mogo.cloud:commons:1.0.2-SNAPSHOT' + +// implementation project(path: ':modules:mogo-tanlu') + implementation 'com.mogo.cloud:tanlu:1.0.1-SNAPSHOT' -// implementation 'com.mogo.cloud:passport:1.0.0' implementation rootProject.ext.dependencies.rxjava implementation rootProject.ext.dependencies.rxandroid } \ No newline at end of file diff --git a/app/src/main/java/com/mogo/cloud/MoGoApplication.java b/app/src/main/java/com/mogo/cloud/MoGoApplication.java index 56f6ed5..b87e639 100644 --- a/app/src/main/java/com/mogo/cloud/MoGoApplication.java +++ b/app/src/main/java/com/mogo/cloud/MoGoApplication.java @@ -2,6 +2,8 @@ package com.mogo.cloud; import android.app.Application; +import androidx.multidex.MultiDexApplication; + import com.mogo.cloud.httpdns.MogoHttpDnsConfig; import com.mogo.cloud.httpdns.bean.HttpDnsSimpleLocation; import com.mogo.cloud.httpdns.listener.IHttpDnsCurrentLocation; @@ -15,7 +17,7 @@ import java.util.Random; /** * */ -public class MoGoApplication extends Application { +public class MoGoApplication extends MultiDexApplication { @Override public void onCreate() { super.onCreate(); diff --git a/foudations/mogo-commons/build.gradle b/foudations/mogo-commons/build.gradle index 206caa2..67e6d0a 100644 --- a/foudations/mogo-commons/build.gradle +++ b/foudations/mogo-commons/build.gradle @@ -54,12 +54,12 @@ dependencies { implementation rootProject.ext.dependencies.androidxccorektx implementation rootProject.ext.dependencies.androidxappcompat implementation rootProject.ext.dependencies.okhttpinterceptor - api rootProject.ext.dependencies.retrofit - api rootProject.ext.dependencies.retrofitadapter - api rootProject.ext.dependencies.retrofitconvertergson - api rootProject.ext.dependencies.retrofitconverterscalars - api project(path: ':foudations:mogo-httpdns') - api project(path: ':foudations:mogo-passport') + implementation rootProject.ext.dependencies.retrofit + implementation rootProject.ext.dependencies.retrofitadapter + implementation rootProject.ext.dependencies.retrofitconvertergson + implementation rootProject.ext.dependencies.retrofitconverterscalars +// api project(path: ':foudations:mogo-passport') + api 'com.mogo.cloud:passport:1.0.2-SNAPSHOT' } \ No newline at end of file diff --git a/foudations/mogo-commons/gradle.properties b/foudations/mogo-commons/gradle.properties index ac8dffd..6fc76aa 100644 --- a/foudations/mogo-commons/gradle.properties +++ b/foudations/mogo-commons/gradle.properties @@ -1,4 +1,4 @@ GROUP=com.mogo.cloud POM_ARTIFACT_ID=commons VERSION_CODE=1 -VERSION_NAME=1.0.1-SNAPSHOT \ No newline at end of file +VERSION_NAME=1.0.2-SNAPSHOT \ No newline at end of file diff --git a/foudations/mogo-passport/build.gradle b/foudations/mogo-passport/build.gradle index 86a3073..052799b 100644 --- a/foudations/mogo-passport/build.gradle +++ b/foudations/mogo-passport/build.gradle @@ -33,9 +33,9 @@ dependencies { // passport implementation 'com.zhidao.thirdlogin:third-login:1.0.1' implementation 'com.zhidao.account:accountsdk:1.0.16.1' - api project(path: ':foudations:mogo-httpdns') -// api 'com.mogo.cloud:httpdns:1.0.0' +// api project(path: ':foudations:mogo-httpdns') + api 'com.mogo.cloud:httpdns:1.0.0' } apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() \ No newline at end of file diff --git a/foudations/mogo-passport/gradle.properties b/foudations/mogo-passport/gradle.properties index 81fbcd5..237b8d3 100644 --- a/foudations/mogo-passport/gradle.properties +++ b/foudations/mogo-passport/gradle.properties @@ -1,4 +1,4 @@ GROUP=com.mogo.cloud POM_ARTIFACT_ID=passport VERSION_CODE=1 -VERSION_NAME=1.0.0-SNAPSHOT \ No newline at end of file +VERSION_NAME=1.0.2-SNAPSHOT \ No newline at end of file diff --git a/foudations/mogo-socket/build.gradle b/foudations/mogo-socket/build.gradle index 894668f..3aa48c4 100644 --- a/foudations/mogo-socket/build.gradle +++ b/foudations/mogo-socket/build.gradle @@ -30,8 +30,10 @@ dependencies { api 'com.zhidao.socket:built-in-socket:1.0.17' // 上报位置 implementation 'com.zhidao.locupload:loc-upload-sdk:1.1.7' - implementation project(path: ':foudations:mogo-passport') - api rootProject.ext.dependencies.mogoutils + +// implementation project(path: ':foudations:mogo-passport') + implementation 'com.mogo.cloud:passport:1.0.2-SNAPSHOT' + } apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() \ No newline at end of file diff --git a/foudations/mogo-socket/gradle.properties b/foudations/mogo-socket/gradle.properties index 59ae673..a3f647d 100644 --- a/foudations/mogo-socket/gradle.properties +++ b/foudations/mogo-socket/gradle.properties @@ -1,4 +1,4 @@ GROUP=com.mogo.cloud POM_ARTIFACT_ID=socket VERSION_CODE=1 -VERSION_NAME=1.0.0 \ No newline at end of file +VERSION_NAME=1.0.2-SNAPSHOT \ No newline at end of file diff --git a/modules/mogo-realtime/build.gradle b/modules/mogo-realtime/build.gradle index e4d20e9..3301054 100644 --- a/modules/mogo-realtime/build.gradle +++ b/modules/mogo-realtime/build.gradle @@ -28,6 +28,10 @@ android { dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation project(path: ':foudations:mogo-passport') - implementation project(":foudations:mogo-commons") - implementation project(":foudations:mogo-socket") + +// implementation project(":foudations:mogo-commons") + implementation 'com.mogo.cloud:commons:1.0.2-SNAPSHOT' +// implementation project(":foudations:mogo-socket") + implementation 'com.mogo.cloud:socket:1.0.2-SNAPSHOT' + } \ No newline at end of file diff --git a/modules/mogo-realtime/gradle.properties b/modules/mogo-realtime/gradle.properties new file mode 100644 index 0000000..25abd37 --- /dev/null +++ b/modules/mogo-realtime/gradle.properties @@ -0,0 +1,4 @@ +GROUP=com.mogo.cloud +POM_ARTIFACT_ID=realtime +VERSION_CODE=1 +VERSION_NAME=1.0.1-SNAPSHOT \ No newline at end of file diff --git a/modules/mogo-tanlu/build.gradle b/modules/mogo-tanlu/build.gradle index 9f280b6..0bf8d65 100644 --- a/modules/mogo-tanlu/build.gradle +++ b/modules/mogo-tanlu/build.gradle @@ -37,6 +37,10 @@ dependencies { implementation rootProject.ext.dependencies.rxjava implementation rootProject.ext.dependencies.rxandroid - implementation project(path: ':foudations:mogo-commons') -} \ No newline at end of file +// implementation project(path: ':foudations:mogo-commons') + implementation 'com.mogo.cloud:commons:1.0.2-SNAPSHOT' + +} + +apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() \ No newline at end of file diff --git a/modules/mogo-tanlu/gradle.properties b/modules/mogo-tanlu/gradle.properties index 7aa6551..55fd76b 100644 --- a/modules/mogo-tanlu/gradle.properties +++ b/modules/mogo-tanlu/gradle.properties @@ -1,4 +1,4 @@ GROUP=com.mogo.cloud POM_ARTIFACT_ID=tanlu VERSION_CODE=1 -VERSION_NAME=1.0.0 \ No newline at end of file +VERSION_NAME=1.0.1-SNAPSHOT \ No newline at end of file From 84cd34bbd427a89d3c657d7ce8ff513b9078d533 Mon Sep 17 00:00:00 2001 From: liujing Date: Mon, 25 Jan 2021 16:34:55 +0800 Subject: [PATCH 3/5] =?UTF-8?q?[re]=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Interface/RealTimeApisHandler.java | 35 ------------------- .../realtime/Interface/RealTimeProvider.java | 8 ++--- .../Interface/RealTimeServiceApis.java | 11 ------ .../SimpleLocationCorrectStrategy.java | 6 ++-- .../constant/SnapshotUploadInTime.java | 5 +-- .../mogo/realtime/socket/SocketHandler.java | 6 ++++ 6 files changed, 14 insertions(+), 57 deletions(-) delete mode 100644 modules/mogo-realtime/src/main/java/com/mogo/realtime/Interface/RealTimeApisHandler.java delete mode 100644 modules/mogo-realtime/src/main/java/com/mogo/realtime/Interface/RealTimeServiceApis.java diff --git a/modules/mogo-realtime/src/main/java/com/mogo/realtime/Interface/RealTimeApisHandler.java b/modules/mogo-realtime/src/main/java/com/mogo/realtime/Interface/RealTimeApisHandler.java deleted file mode 100644 index 726744e..0000000 --- a/modules/mogo-realtime/src/main/java/com/mogo/realtime/Interface/RealTimeApisHandler.java +++ /dev/null @@ -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; - } - - -} diff --git a/modules/mogo-realtime/src/main/java/com/mogo/realtime/Interface/RealTimeProvider.java b/modules/mogo-realtime/src/main/java/com/mogo/realtime/Interface/RealTimeProvider.java index dffb7a5..c0aac9f 100644 --- a/modules/mogo-realtime/src/main/java/com/mogo/realtime/Interface/RealTimeProvider.java +++ b/modules/mogo-realtime/src/main/java/com/mogo/realtime/Interface/RealTimeProvider.java @@ -13,7 +13,7 @@ import java.util.List; * @description 描述 * @since: 2021/1/21 */ -public interface RealTimeProvider { +public interface RealTimeProvider { /** * 获取 adas 识别列表 * @@ -22,8 +22,8 @@ public interface RealTimeProvider { List getLastADASRecognizedResult(); /* - * 两个点之间的距离 - * */ + * 两个点之间的距离 + * */ float getDistanceBetweenTwoPoints(); /** @@ -48,5 +48,5 @@ public interface RealTimeProvider { * @param list 消息体 * @param listener 回执监听 */ - public void sendMsg(List list, IMogoCloudSocketOnMessageListener listener); + public void sendMsg(List list, IMogoCloudSocketOnMessageListener listener); } diff --git a/modules/mogo-realtime/src/main/java/com/mogo/realtime/Interface/RealTimeServiceApis.java b/modules/mogo-realtime/src/main/java/com/mogo/realtime/Interface/RealTimeServiceApis.java deleted file mode 100644 index eec2e5e..0000000 --- a/modules/mogo-realtime/src/main/java/com/mogo/realtime/Interface/RealTimeServiceApis.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.mogo.realtime.Interface; - -/** - * @author liujing - * @description 描述 - * @since: 2021/1/21 - */ -public interface RealTimeServiceApis { - RealTimeProvider getRecognizedResultManager(); - -} diff --git a/modules/mogo-realtime/src/main/java/com/mogo/realtime/constant/SimpleLocationCorrectStrategy.java b/modules/mogo-realtime/src/main/java/com/mogo/realtime/constant/SimpleLocationCorrectStrategy.java index d1b8229..9911d8d 100644 --- a/modules/mogo-realtime/src/main/java/com/mogo/realtime/constant/SimpleLocationCorrectStrategy.java +++ b/modules/mogo-realtime/src/main/java/com/mogo/realtime/constant/SimpleLocationCorrectStrategy.java @@ -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 + "}"); // 按照上一个点的方向和速度,计算下一个点的位置,下一个点除坐标点外,其余数据与上一个点相同 diff --git a/modules/mogo-realtime/src/main/java/com/mogo/realtime/constant/SnapshotUploadInTime.java b/modules/mogo-realtime/src/main/java/com/mogo/realtime/constant/SnapshotUploadInTime.java index 76dc0ca..2317553 100644 --- a/modules/mogo-realtime/src/main/java/com/mogo/realtime/constant/SnapshotUploadInTime.java +++ b/modules/mogo-realtime/src/main/java/com/mogo/realtime/constant/SnapshotUploadInTime.java @@ -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 recognizedResults = RealTimeApisHandler.getInstance().getApis().getRecognizedResultManager().getLastADASRecognizedResult();//外显接口返回 + List recognizedResults = SocketHandler.getInstance().getRealTimeProvider().getLastADASRecognizedResult();//外显接口返回 OnePerSecondSendContent content = new OnePerSecondSendContent(); content.self = locationResult; content.adas = recognizedResults; diff --git a/modules/mogo-realtime/src/main/java/com/mogo/realtime/socket/SocketHandler.java b/modules/mogo-realtime/src/main/java/com/mogo/realtime/socket/SocketHandler.java index 0d9127a..4c5c088 100644 --- a/modules/mogo-realtime/src/main/java/com/mogo/realtime/socket/SocketHandler.java +++ b/modules/mogo-realtime/src/main/java/com/mogo/realtime/socket/SocketHandler.java @@ -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 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: 是否注册自己内部的监听 * */ From 5f2f2653b6ba47d401e3df9034cdf4a384225a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Mon, 25 Jan 2021 17:14:35 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=A7=A3=E5=86=B3=EF=BC=8C=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 16 ++++++----- .../java/com/mogo/cloud/MoGoApplication.java | 2 +- foudations/mogo-commons/build.gradle | 7 +++-- foudations/mogo-httpdns/gradle.properties | 2 +- foudations/mogo-passport/build.gradle | 11 +++++--- .../cloud/passport/MoGoAiCloudClient.java | 6 +++-- foudations/mogo-socket/build.gradle | 12 ++++++--- gradle.properties | 13 +++++---- gradle/upload.gradle | 27 ++++++++++++++++++- modules.txt | 6 +++++ modules/mogo-realtime/build.gradle | 11 +++++--- modules/mogo-tanlu/build.gradle | 7 +++-- upload.sh | 3 +++ 13 files changed, 90 insertions(+), 33 deletions(-) create mode 100644 modules.txt create mode 100755 upload.sh diff --git a/app/build.gradle b/app/build.gradle index 15001c0..264531f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -36,14 +36,16 @@ dependencies { implementation rootProject.ext.dependencies.androidxappcompat implementation rootProject.ext.dependencies.androidxconstraintlayout -// implementation project(path: ':foudations:mogo-passport') - implementation 'com.mogo.cloud:passport:1.0.2-SNAPSHOT' -// implementation project(path: ':foudations:mogo-commons') - implementation 'com.mogo.cloud:commons:1.0.2-SNAPSHOT' - -// implementation project(path: ':modules:mogo-tanlu') - implementation 'com.mogo.cloud:tanlu:1.0.1-SNAPSHOT' + if (Boolean.valueOf(RELEASE)) { + implementation "com.mogo.cloud:commons:${MOGO_COMMONS_VERSION}" + implementation "com.mogo.cloud:socket:${MOGO_SOCKET_VERSION}" + implementation "com.mogo.cloud:tanlu:${MOGO_TANLU_VERSION}" + } else { + implementation project(":foudations:mogo-socket") + implementation project(":foudations:mogo-commons") + implementation project(path: ':modules:mogo-tanlu') + } implementation rootProject.ext.dependencies.rxjava implementation rootProject.ext.dependencies.rxandroid diff --git a/app/src/main/java/com/mogo/cloud/MoGoApplication.java b/app/src/main/java/com/mogo/cloud/MoGoApplication.java index b87e639..17d2762 100644 --- a/app/src/main/java/com/mogo/cloud/MoGoApplication.java +++ b/app/src/main/java/com/mogo/cloud/MoGoApplication.java @@ -43,7 +43,7 @@ public class MoGoApplication extends MultiDexApplication { } }); - MoGoAiCloudClient.getInstance().init(this, clientConfig); + MoGoAiCloudClient.getInstance().init(this, clientConfig, null); } } diff --git a/foudations/mogo-commons/build.gradle b/foudations/mogo-commons/build.gradle index 67e6d0a..2c8f9e8 100644 --- a/foudations/mogo-commons/build.gradle +++ b/foudations/mogo-commons/build.gradle @@ -59,7 +59,10 @@ dependencies { implementation rootProject.ext.dependencies.retrofitconvertergson implementation rootProject.ext.dependencies.retrofitconverterscalars -// api project(path: ':foudations:mogo-passport') - api 'com.mogo.cloud:passport:1.0.2-SNAPSHOT' + if (Boolean.valueOf(RELEASE)) { + api "com.mogo.cloud:passport:${MOGO_PASSPORT_VERSION}" + } else { + api project(path: ':foudations:mogo-passport') + } } \ No newline at end of file diff --git a/foudations/mogo-httpdns/gradle.properties b/foudations/mogo-httpdns/gradle.properties index 91b4997..7f693e7 100644 --- a/foudations/mogo-httpdns/gradle.properties +++ b/foudations/mogo-httpdns/gradle.properties @@ -1,4 +1,4 @@ GROUP=com.mogo.cloud POM_ARTIFACT_ID=httpdns VERSION_CODE=1 -VERSION_NAME=1.0.0 \ No newline at end of file +VERSION_NAME=1.0.0-SNAPSHOT \ No newline at end of file diff --git a/foudations/mogo-passport/build.gradle b/foudations/mogo-passport/build.gradle index 052799b..d51b6a0 100644 --- a/foudations/mogo-passport/build.gradle +++ b/foudations/mogo-passport/build.gradle @@ -31,11 +31,14 @@ dependencies { implementation rootProject.ext.dependencies.androidxappcompat api rootProject.ext.dependencies.mogoutils // passport - implementation 'com.zhidao.thirdlogin:third-login:1.0.1' - implementation 'com.zhidao.account:accountsdk:1.0.16.1' + implementation 'com.zhidao.thirdlogin:third-login:1.0.2' + + if (Boolean.valueOf(RELEASE)) { + api "com.mogo.cloud:httpdns:${MOGO_HTTPDNS_VERSION}" + } else { + api project(path: ':foudations:mogo-httpdns') + } -// api project(path: ':foudations:mogo-httpdns') - api 'com.mogo.cloud:httpdns:1.0.0' } apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() \ No newline at end of file diff --git a/foudations/mogo-passport/src/main/java/com/mogo/cloud/passport/MoGoAiCloudClient.java b/foudations/mogo-passport/src/main/java/com/mogo/cloud/passport/MoGoAiCloudClient.java index fbea8b4..bf16e12 100644 --- a/foudations/mogo-passport/src/main/java/com/mogo/cloud/passport/MoGoAiCloudClient.java +++ b/foudations/mogo-passport/src/main/java/com/mogo/cloud/passport/MoGoAiCloudClient.java @@ -47,14 +47,16 @@ public class MoGoAiCloudClient { * * @param context 上下文 * @param aiCloudClientConfig SDK配置信息 + * @param tokenCallback 获取令牌回调,使用端可根据回调的方法判断是否获取令牌成功,可为空 */ public MoGoAiCloudClient init(Context context, - MoGoAiCloudClientConfig aiCloudClientConfig + MoGoAiCloudClientConfig aiCloudClientConfig, + final IMoGoTokenCallback tokenCallback ) { mContext = context; mAiCloudClientConfig = aiCloudClientConfig; // 刷新令牌 - refreshToken(null); + refreshToken(tokenCallback); return sInstance; } diff --git a/foudations/mogo-socket/build.gradle b/foudations/mogo-socket/build.gradle index 3aa48c4..f3b5e2d 100644 --- a/foudations/mogo-socket/build.gradle +++ b/foudations/mogo-socket/build.gradle @@ -27,12 +27,16 @@ android { dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) // 长链 - api 'com.zhidao.socket:built-in-socket:1.0.17' + api 'com.zhidao.socket:built-in-socket:1.0.21' // 上报位置 - implementation 'com.zhidao.locupload:loc-upload-sdk:1.1.7' + implementation 'com.zhidao.locupload:loc-upload-sdk:1.1.8' + + if (Boolean.valueOf(RELEASE)) { + implementation "com.mogo.cloud:passport:${MOGO_PASSPORT_VERSION}" + } else { + implementation project(path: ':foudations:mogo-passport') + } -// implementation project(path: ':foudations:mogo-passport') - implementation 'com.mogo.cloud:passport:1.0.2-SNAPSHOT' } diff --git a/gradle.properties b/gradle.properties index 5d0e279..5fba8d5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,9 +22,12 @@ RELEASE_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-releases/ SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/ USERNAME=xintai PASSWORD=xintai2018 +# 编译模式: false - 依赖本地版本, true - 依赖 maven 版本 +RELEASE=false # AI CLOUD 云平台 -MOGO_CLOUD_COMMONS_VERSION= 1.0.0 -MOGO_CLOUD_HTTPDNS_VERSION= 1.0.0 -MOGO_CLOUD_PASSPORT_VERSION=1.0.0 -MOGO_CLOUD_TANLU_VERSION= 1.0.0 -MOGO_CLOUD_REALTIME_VERSION=1.0.0 \ No newline at end of file +MOGO_COMMONS_VERSION=1.0.4-SNAPSHOT +MOGO_HTTPDNS_VERSION=1.0.4-SNAPSHOT +MOGO_PASSPORT_VERSION=1.0.4-SNAPSHOT +MOGO_SOCKET_VERSION=1.0.4-SNAPSHOT +MOGO_REALTIME_VERSION=1.0.4-SNAPSHOT +MOGO_TANLU_VERSION=1.0.4-SNAPSHOT diff --git a/gradle/upload.gradle b/gradle/upload.gradle index c1c3455..908c41b 100644 --- a/gradle/upload.gradle +++ b/gradle/upload.gradle @@ -26,11 +26,20 @@ uploadArchives { mavenDeployer { println project.name + + String versionNameKey = "${project.name.replace("-", "_").toUpperCase()}_VERSION" + String versionName = getVersionNameValue(versionNameKey) + println versionName + + if (versionName == null || versionName.equals("")) { + project.logger.error("undefined versionName in root gradle.properties by ${versionNameKey}") + } + pom.project { packaging = 'aar' groupId = GROUP artifactId = POM_ARTIFACT_ID - version = VERSION_NAME + version = versionName } repository(url: rootProject.RELEASE_REPOSITORY_URL) { @@ -43,3 +52,19 @@ uploadArchives { } } } + +def getVersionNameValue(String key) { + File file = rootProject.file('gradle.properties') + String value = ""; + if (file.exists()) { + //加载资源 + InputStream inputStream = file.newDataInputStream(); + Properties properties = new Properties() + properties.load(inputStream) + + if (properties.containsKey(key)) { + value = properties.getProperty(key) + } + } + return value +} diff --git a/modules.txt b/modules.txt new file mode 100644 index 0000000..b761e77 --- /dev/null +++ b/modules.txt @@ -0,0 +1,6 @@ +:foudations:mogo-httpdns +:foudations:mogo-passport +:foudations:mogo-commons +:foudations:mogo-socket +:modules:mogo-realtime +:modules:mogo-tanlu \ No newline at end of file diff --git a/modules/mogo-realtime/build.gradle b/modules/mogo-realtime/build.gradle index 3301054..dc28e0e 100644 --- a/modules/mogo-realtime/build.gradle +++ b/modules/mogo-realtime/build.gradle @@ -29,9 +29,12 @@ dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation project(path: ':foudations:mogo-passport') -// implementation project(":foudations:mogo-commons") - implementation 'com.mogo.cloud:commons:1.0.2-SNAPSHOT' -// implementation project(":foudations:mogo-socket") - implementation 'com.mogo.cloud:socket:1.0.2-SNAPSHOT' + 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") + } } \ No newline at end of file diff --git a/modules/mogo-tanlu/build.gradle b/modules/mogo-tanlu/build.gradle index 0bf8d65..ee138d7 100644 --- a/modules/mogo-tanlu/build.gradle +++ b/modules/mogo-tanlu/build.gradle @@ -38,8 +38,11 @@ dependencies { implementation rootProject.ext.dependencies.rxjava implementation rootProject.ext.dependencies.rxandroid -// implementation project(path: ':foudations:mogo-commons') - implementation 'com.mogo.cloud:commons:1.0.2-SNAPSHOT' + if (Boolean.valueOf(RELEASE)) { + implementation "com.mogo.cloud:commons:${MOGO_COMMONS_VERSION}" + } else { + implementation project(path: ':foudations:mogo-commons') + } } diff --git a/upload.sh b/upload.sh new file mode 100755 index 0000000..a7ff20c --- /dev/null +++ b/upload.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +./gradlew :foudations:mogo-httpdns:clean :foudations:mogo-httpdns:uploadArchives From 123839b52f9411c1f1935579f8e8b71f2dbdd930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Mon, 25 Jan 2021 17:16:26 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0Socket=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mogo/cloud/socket/SocketManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/foudations/mogo-socket/src/main/java/com/mogo/cloud/socket/SocketManager.java b/foudations/mogo-socket/src/main/java/com/mogo/cloud/socket/SocketManager.java index a854ce2..147cbb8 100644 --- a/foudations/mogo-socket/src/main/java/com/mogo/cloud/socket/SocketManager.java +++ b/foudations/mogo-socket/src/main/java/com/mogo/cloud/socket/SocketManager.java @@ -78,6 +78,7 @@ public class SocketManager implements IMogoCloudSocketManager, Callback { .setChannelId(SocketServicesConstants.SOCKET_CHANNEL_ID) .setOpenAnalytics(true) .setSn(cloudClientConfig.getSn()) + .setToken(cloudClientConfig.getToken()) .setDebug(cloudClientConfig.isShowDebugLog()); SocketClient.getInstance().start(context); }