[3.2.0] fix bug of aiCloud sn problem and delay httpdns loc change until 10s
This commit is contained in:
@@ -13,7 +13,6 @@ class AiCloudSocketBizProvider : IMoGoFunctionServerProvider {
|
||||
|
||||
override fun init(context: Context?) {
|
||||
context?.let {
|
||||
SocketManager.getInstance().init(it, 0.0, 0.0)
|
||||
SocketManager.getInstance().registerOnMessageListener(401012, V2XMessageListener401012())
|
||||
SocketManager.getInstance().registerOnMessageListener(401018, V2XMessageListener401018())
|
||||
SocketManager.getInstance().registerOnMessageListener(402000, V2XMessageListener402000())
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Process;
|
||||
|
||||
import com.bytedance.boost_multidex.BoostMultiDex;
|
||||
import com.mogo.cloud.socket.SocketBuildConfig;
|
||||
@@ -20,7 +19,6 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@@ -73,7 +71,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
}
|
||||
|
||||
private void initModules() {
|
||||
CallerLogger.INSTANCE.d(M_HMI + TAG, "initModules");
|
||||
CallerLogger.INSTANCE.d(M_MAIN + TAG, "initModules");
|
||||
// OBU 模块
|
||||
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_V2X_OBU_MOGO, "IMoGoObuProvider"));
|
||||
// BIZ
|
||||
@@ -85,7 +83,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
// 后置 地图数据收集模块
|
||||
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_MAP_DATA_COLLECT_PROVIDER, "MoGoMapDataCollector"));
|
||||
}
|
||||
CallerLogger.INSTANCE.i(M_HMI + TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
CallerLogger.INSTANCE.i(M_MAIN + TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.mogo.eagle.core.function.startup.stageone
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import com.mogo.aicloud.services.locationinfo.MogoLocationInfoServices
|
||||
import com.mogo.aicloud.services.socket.IMogoLifecycleListener
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
|
||||
@@ -50,6 +54,14 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
|
||||
MoGoAiCloudClientConfig.getInstance()
|
||||
}
|
||||
|
||||
private val handler = Handler(Looper.getMainLooper()){
|
||||
if(it.what == 1){
|
||||
val value = it.obj as Pair<String, String>
|
||||
reConnectSocket(value.first, value.second)
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
private var context: Context? = null
|
||||
|
||||
@Volatile
|
||||
@@ -57,7 +69,13 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
|
||||
|
||||
private var httpDnsSimpleLocation by Delegates.observable(getDefaultSimpleLocation()) { _, oldValue, newValue ->
|
||||
if (gotToken && oldValue.cityCode != newValue.cityCode) {
|
||||
reConnectSocket(oldValue.cityCode, newValue.cityCode)
|
||||
if(handler.hasMessages(1)){
|
||||
handler.removeMessages(1)
|
||||
}
|
||||
val msg = Message.obtain()
|
||||
msg.what = 1
|
||||
msg.obj = Pair(oldValue.cityCode,newValue.cityCode)
|
||||
handler.sendMessageDelayed(msg,1000L * 10)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,13 +201,14 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
|
||||
)
|
||||
override fun onTokenGot(token: String, sn: String) {
|
||||
clientConfig.token = token
|
||||
clientConfig.sn = sn
|
||||
// 由于存在token过期问题,在更新后会回调至此处,增加二次判定
|
||||
if (!gotToken) {
|
||||
CallerLogger.d("$M_MAIN$TAG", "onTokenGot token : $token , sn :$sn")
|
||||
CallerCloudListenerManager.invokeCloudTokenGot(token, sn)
|
||||
// 异步初始化NetConfig
|
||||
asyncInit()
|
||||
startSocketService()
|
||||
startSocketService(sn)
|
||||
// 开启每5s/次定位上报
|
||||
uploadLocPerFiveSecond()
|
||||
gotToken = true
|
||||
@@ -253,7 +272,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun startSocketService() {
|
||||
private fun startSocketService(sn:String) {
|
||||
CallerLogger.d("$M_MAIN$TAG", "startSocketService")
|
||||
val location = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
|
||||
MogoAiCloudSocketManager.getInstance(context)
|
||||
@@ -315,7 +334,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
|
||||
val lon = location?.longitude
|
||||
?: CallerMapUIServiceManager.getGDLocationServer(context!!)!!.lastLon
|
||||
MogoAiCloudSocketManager.getInstance(context)
|
||||
.init(context, DebugConfig.getSocketAppId(), lat, lon)
|
||||
.init(context, sn, DebugConfig.getSocketAppId(), lat, lon)
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
|
||||
@@ -19,7 +19,7 @@ public interface IMogoSocketManager extends IProvider {
|
||||
* @param context 上下文
|
||||
* @param appId 一般为包名,不参与通道的建立,一般用于发消息
|
||||
*/
|
||||
void init( Context context, String appId , double lat, double lon);
|
||||
void init( Context context, String sn ,String appId , double lat, double lon);
|
||||
|
||||
/**
|
||||
* 重新连接
|
||||
|
||||
@@ -68,14 +68,14 @@ public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implem
|
||||
private final Map<Long, IMogoMsgAckListener> mAckListeners = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public void init(Context context, String appId, double lat, double lon) {
|
||||
public void init(Context context, String sn, String appId, double lat, double lon) {
|
||||
if(!ProcessUtils.isMainProcess()){
|
||||
return;
|
||||
}
|
||||
this.mAppId = appId;
|
||||
SocketManager.getInstance().registerSocketConnCallback(this);
|
||||
SocketManager.getInstance().registerSocketErrorCallback(TAG, this);
|
||||
SocketManager.getInstance().init(context, lat, lon);
|
||||
SocketManager.getInstance().init(context, sn, lat, lon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -66,23 +66,23 @@ SERVICE_BIZ_VERSION=1.2.4
|
||||
LOGLIB_VERSION=1.5.27
|
||||
######## MogoAiCloudSDK Version ########
|
||||
# 网络请求LOGLIB_VERSION
|
||||
MOGO_NETWORK_VERSION=1.4.6.8
|
||||
MOGO_NETWORK_VERSION=1.4.7.2
|
||||
# 鉴权
|
||||
MOGO_PASSPORT_VERSION=1.4.6.8
|
||||
MOGO_PASSPORT_VERSION=1.4.7.2
|
||||
# 常链接
|
||||
MOGO_SOCKET_VERSION=1.4.6.8
|
||||
MOGO_SOCKET_VERSION=1.4.7.2
|
||||
# 数据采集
|
||||
MOGO_REALTIME_VERSION=1.4.6.8
|
||||
MOGO_REALTIME_VERSION=1.4.7.2
|
||||
# 探路,道路事件发布,获取
|
||||
MOGO_TANLU_VERSION=1.4.6.8
|
||||
MOGO_TANLU_VERSION=1.4.7.2
|
||||
# 直播推流
|
||||
MOGO_LIVE_VERSION=1.4.6.8
|
||||
MOGO_LIVE_VERSION=1.4.7.2
|
||||
# 直播拉流
|
||||
MOGO_TRAFFICLIVE_VERSION=1.4.6.8
|
||||
MOGO_TRAFFICLIVE_VERSION=1.4.7.2
|
||||
# 定位服务
|
||||
MOGO_LOCATION_VERSION=1.4.6.8
|
||||
MOGO_LOCATION_VERSION=1.4.7.2
|
||||
# 远程通讯模块
|
||||
MOGO_TELEMATIC_VERSION=1.4.6.8
|
||||
MOGO_TELEMATIC_VERSION=1.4.7.2
|
||||
######## MogoAiCloudSDK Version ########
|
||||
# 自研地图
|
||||
MAP_SDK_VERSION=2.12.1.1
|
||||
|
||||
Reference in New Issue
Block a user