Merge branch 'dev_arch_opt_3.0' into dev_robobus-m1-p-app-module_1.0.0_230112_1.0.0

# Conflicts:
#	core/function-impl/mogo-core-function-startup/src/main/java/com/mogo/eagle/core/function/startup/stageone/HttpDnsStartUp.kt
#	libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java
#	libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasManager.java
This commit is contained in:
yangyakun
2023-02-21 16:28:51 +08:00
34 changed files with 797 additions and 315 deletions

View File

@@ -13,7 +13,6 @@ import com.mogo.eagle.core.function.call.obu.CallerObuSaveMessageListenerManager
* 处理obu分发出来在消息盒子展示的消息
*/
object V2xObuEventManager : IMoGoObuSaveMessageListener {
private const val TAG = "V2xObuEventManager"
fun init(context: Context) {
@@ -33,7 +32,7 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener {
* @param content 事件内容
* @param tts 事件语音播报
*/
override fun onMoGoObuSaveMessage(type: String, content: String, tts: String) {
override fun onMoGoObuSaveMessage(type: String, content: String, tts: String, source: DataSourceType) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
@@ -43,7 +42,7 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener {
tts
)
).apply {
sourceType = DataSourceType.OBU
sourceType = source
}
)
}

View File

@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.datacenter.autopilot
import android.Manifest.permission
import android.content.Context
import android.util.Log
import androidx.annotation.RequiresPermission
import chassis.SpecialVehicleTaskCmdOuterClass
import com.alibaba.android.arouter.facade.annotation.Route
@@ -737,4 +736,37 @@ class MoGoAutopilotControlProvider :
MessageType.TYPE_RECEIVE_POINT_CLOUD)
}
}
override fun sendRoboBusJinlvM1FrontDoorCmd(switchCmd: Int): Boolean {
return AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(switchCmd)
}
override fun sendRoboBusJinlvM1AirConditionerCmd(
switchCmd: Int,
modeCmd: Int,
windSpeedCmd: Int,
temperatureCmd: Int
): Boolean {
return AdasManager.getInstance().sendRoboBusJinlvM1AirConditionerCmd(switchCmd, modeCmd, windSpeedCmd, temperatureCmd)
}
override fun sendRoboBusJinlvM1HeaderCmd(switchCmd: Int, windSpeedCmd: Int): Boolean {
return AdasManager.getInstance().sendRoboBusJinlvM1HeaderCmd(switchCmd, windSpeedCmd)
}
override fun sendRoboBusJinlvM1MainLamp1Cmd(switchCmd: Int): Boolean {
return AdasManager.getInstance().sendRoboBusJinlvM1MainLamp1Cmd(switchCmd)
}
override fun sendRoboBusJinlvM1MainLamp2Cmd(switchCmd: Int): Boolean {
return AdasManager.getInstance().sendRoboBusJinlvM1MainLamp2Cmd(switchCmd)
}
override fun sendRoboBusJinlvM1SmallLampCmd(switchCmd: Int): Boolean {
return AdasManager.getInstance().sendRoboBusJinlvM1SmallLampCmd(switchCmd)
}
override fun sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd: SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd): Boolean {
return AdasManager.getInstance().sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd)
}
}

View File

@@ -173,7 +173,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
CallerChassisLamplightListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus)
//方向盘转向角数据
CallerChassisSteeringStateListenerManager.invokeAutopilotSteeringData(vehicleState.steering)
//挂档位数据
//挂档位数据
CallerChassisGearStateListenerManager.invokeAutopilotGearData(vehicleState.gear)
//加速度
CallerChassisAccStateListenerManager.invokeAutopilotAcc(vehicleState.accel)
@@ -237,7 +237,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
}
chassisStates.gearSystemStates?.let { gearSystemStates ->
gearSystemStates.gearPosition?.let {
//挂档位数据
//挂档位数据
CallerChassisGearStateListenerManager.invokeAutopilotGearData(it)
}
}

View File

@@ -16,19 +16,16 @@ import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningSpatListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obu.CallerObuMapMathListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsiListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsmListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuWarningSpatListenerManager
import com.mogo.eagle.core.function.call.obu.*
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.datacenter.obu.utils.TrafficDataConvertUtilsNew
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
import com.mogo.support.obu.ObuScene
import com.mogo.support.obu.constants.MogoObuConstants
import kotlin.math.roundToInt
/**
*
* @author lixiaopeng
@@ -78,7 +75,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
onMogoObuMapMath(mapMatchData)
}
/**
* RSI预警信息 CvxRtiThreatIndInfo交通标志预警前方限速、前方学校等等交通事件预警前方拥堵、前方积水等等
*/
@@ -140,9 +136,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
//车内标牌
MogoObuConstants.RSI_SCENE_TYPE.IVS.toString() -> {
when (rsiWarningData.warningMsgList[0].signSerialNum) {
// MogoObuConstants.RTS.RTI_TYPE_INTERSECTION -> { //十字路口
// appId = V2iEventTypeEnum.TYPE_ID_NTERSECTION.poiType
// }
MogoObuConstants.RTS.RTI_TYPE_SHAPR_TURNS -> { //急转弯
appId = EventTypeEnumNew.TYPE_ID_SHAPR_TURNS.poiType
}
@@ -191,10 +184,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
MogoObuConstants.RTS.RTI_TYPE_SPEED_LIMIT -> { //限速
appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType
}
// MogoObuConstants.RTS.RTI_TYPE_GO_STRAIGHT_TURN_RIGHT -> { //直行或右转
// appId =
// EventTypeEnumNew.TYPE_USECASE_ID_GO_STRAIGHT_TURN_RIGHT.poiType
// }
MogoObuConstants.RTS.RTI_TYPE_BUS_WARNING -> { //公交提醒
appId = EventTypeEnumNew.TYPE_USECASE_ID_BUS_WARNING.poiType
}
@@ -258,11 +247,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
MogoObuConstants.STATUS.ADD -> {
saveObuToDcData(appId, alertContent, ttsContent)
showWarning(appId, alertContent, ttsContent, direction)
// 更新数据,是否需要
// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData)?.let {
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficThreatLevelInfo(it)
// }
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
@@ -272,14 +256,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
MogoObuConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 更新数据,删除标牌?
// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData)
// ?.let {
// // 事件结束,还原车辆颜色
// it.threatLevel = 0x01
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficInfo(it)
// }
}
}
}
@@ -296,25 +272,55 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
)
// 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu
if (rsmWarningData != null && rsmWarningData.participant != null) {
var v2xType = ""
if (rsmWarningData.participant.ptcType == 1) { //机动车
v2xType =
var v2xType = when (rsmWarningData.participant.ptcType) {
1 -> { //机动车
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType
} else if (rsmWarningData.participant.ptcType == 2) { //非机动车
v2xType =
}
2 -> { //非机动车
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType
} else if (rsmWarningData.participant.ptcType == 3) { //行人
v2xType =
}
3 -> { //行人
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType
} else { //未知
v2xType = EventTypeEnumNew.TYPE_ERROR.poiType
}
else -> { //未知
EventTypeEnumNew.TYPE_ERROR.poiType
}
}
val ttsContent = EventTypeEnumNew.getWarningTts(v2xType)
val alertContent =
EventTypeEnumNew.getWarningContent(v2xType)
var level = -1
val direction =
getMessageDirection(rsmWarningData.participant.targetPosition) //TODO 只有一个
val direction = getMessageDirection(rsmWarningData.participant.targetPosition)
//模型的显示
when (rsmWarningData.status) {
MogoObuConstants.STATUS.ADD -> { // 添加
// 更新数据模型变色的时候是不是update,如果不是更新可能导致模型不变色add的时候是否有level高的 TODO
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)
?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
// 更新数据 TODO 删除原来的改变颜色删除marker。不影响别的模型添加
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)
?.let {
// 事件结束,还原交通参与者颜色
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()
?.removeCvxRvInfoIndInfo(rsmWarningData.participant.ptcId.toString())
}
}
if (rsmWarningData.warningMsg != null && rsmWarningData.warningMsg.warningDataList != null && rsmWarningData.warningMsg.warningDataList.size > 0) {
level = rsmWarningData.warningMsg.warningDataList[0].warningLevel
CallerLogger.d(
@@ -323,45 +329,36 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
rsmWarningData.warningMsg.warningDataList[0].status
} --v2xType--- $v2xType ---alertContent = $alertContent ---ttsContent= $ttsContent"
)
when (rsmWarningData.warningMsg.warningDataList[0].status) {
MogoObuConstants.STATUS.ADD -> { // 添加
//更新模型的颜色
TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)
?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
if (alertContent.isEmpty() || ttsContent.isEmpty()) {
return
}
saveObuToDcData(v2xType, alertContent, ttsContent)
showWarning(v2xType, alertContent, ttsContent, direction)
// 更新数据 TODO
// TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let {
//// TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficThreatLevelInfo(it)
// }
}
MogoObuConstants.STATUS.UPDATE -> {// 更新
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
MogoObuConstants.STATUS.DELETE -> { // 删除
// 关闭警告红边
CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL)
// 更新数据 TODO 由于obu通过域控需要转换单位这里临时转换后面3.0不需要转换
// TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let {
// // 事件结束,还原交通参与者颜色
// it.threatLevel = 0x01
//// TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
// CallerMapUIServiceManager.getMarkerService()
// ?.updateITrafficThreatLevelInfo(it)
// }
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()
?.removeCvxRvInfoIndInfo(rsmWarningData.participant.ptcId.toString())
// TrafficMarkerDrawer.removeCvxRvInfoIndInfo(rsmWarningData.participantOfOne.ptcID.toString())
}
}
}
}
}
}
/**
@@ -383,10 +380,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
* 地图匹配 是OBU算法输出地图匹配结果主车匹配道路哪条路或者哪条车道
*/
fun onMogoObuMapMath(data: ObuScene.MapMatchData?) {
CallerLogger.d(
"${M_OBU}${TAG}",
"MogoObuDcCombineManager onMogoObuMapMath HmiBuildConfig.isShowObuLimitSpeedView = " + HmiBuildConfig.isShowObuLimitSpeedView
)
if (HmiBuildConfig.isShowObuLimitSpeedView) {
if (data != null) {
CallerLogger.d(
@@ -398,7 +391,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
} --- data.speedMaxLimit = ${data.speedMaxLimit}"
)
when (data.status) {
MogoObuConstants.STATUS.ADD -> { // 添加 TODO
MogoObuConstants.STATUS.ADD -> { // 添加
CallerLimitingVelocityListenerManager.invokeUnion(
(data.speedMaxLimit * 0.02 * 3.6).roundToInt().toInt(),
DataSourceType.OBU
@@ -469,6 +462,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
MogoObuConstants.STATUS.DELETE -> {
// 移除顶部弹窗,当收不到信号的时候触发一次
CallerTrafficLightListenerManager.disableTrafficLight()
CallerTrafficLightListenerManager.invokeTrafficLightDisapper()
isShowGreenWave = false
isShowRunRedLight = false
}
@@ -598,18 +592,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener
* 保存obu通过工控机传输的数据到消息盒子
*/
private fun saveObuToDcData(type: String, content: String, tts: String) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
type,
content,
tts
)
).apply {
sourceType = DataSourceType.TELEMATIC
}
)
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(type, content, tts, DataSourceType.TELEMATIC)
}
/**

View File

@@ -107,7 +107,7 @@ class MogoPrivateObuNewManager private constructor() {
fun setObuLog(isChecked: Boolean) {
ObuManager.getInstance().setEnableLog(isChecked)
val builder: com.mogo.support.obu.option.MogoObuLog.Builder =
val builder: MogoObuLog.Builder =
MogoObuLog.newBuilder().setEnableStdio(isChecked)
if (isChecked) {
builder.setStdioLevel(MogoObuLogLevel.DBG)
@@ -437,27 +437,24 @@ class MogoPrivateObuNewManager private constructor() {
if (HmiBuildConfig.isShowObuWeaknessTrafficView) {
// 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu
if (data != null && data.participant != null) {
var v2xType = ""
if (data.participant.ptcType == 1) { //机动车
v2xType =
var v2xType = when (data.participant.ptcType) {
1 -> { //机动车
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType
} else if (data.participant.ptcType == 2) { //非机动车
v2xType =
}
2 -> { //非机动车
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType
} else if (data.participant.ptcType == 3) { //行人
v2xType =
}
3 -> { //行人
EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType
} else { //未知
v2xType = EventTypeEnumNew.TYPE_ERROR.poiType
}
else -> { //未知
EventTypeEnumNew.TYPE_ERROR.poiType
}
}
val ttsContent = EventTypeEnumNew.getWarningTts(v2xType)
val alertContent =
EventTypeEnumNew.getWarningContent(v2xType)
val alertContent = EventTypeEnumNew.getWarningContent(v2xType)
var level = -1
val direction = getMessageDirection(data.participant.targetPosition)
//物体数据绘制
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"onMogoObuRsmWarning ---- data.status = ${data.status} ---data.participant.ptcId = ${data.participant.ptcId} ---data.participant.ptcType = ${data.participant.ptcType} ---data.warningMsg = ${data.warningMsg} -----data = ${data.toString()}"
@@ -745,11 +742,6 @@ class MogoPrivateObuNewManager private constructor() {
v2xType = EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType
}
// 这里处理固定的提示信息,包括了<紧急车辆提醒>
else -> {
// ttsContent = EventTypeEnumNew.getWarningTts(appId.toString())
// alertContent = EventTypeEnumNew.getWarningContent(appId.toString())
}
}
when (status) {
@@ -830,9 +822,9 @@ class MogoPrivateObuNewManager private constructor() {
MogoObuConstants.STATUS.DELETE -> {
// 移除顶部弹窗
CallerTrafficLightListenerManager.disableTrafficLight()
CallerTrafficLightListenerManager.invokeTrafficLightDisapper()
isShowGreenWave = false
isShowRunRedLight = false
CallerTrafficLightListenerManager.invokeTrafficLightDisapper()
}
}
}
@@ -969,7 +961,7 @@ class MogoPrivateObuNewManager private constructor() {
* 保存obu直连数据到消息盒子
*/
private fun saveObuData(type: String, content: String, tts: String) {
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(type, content, tts)
CallerObuSaveMessageListenerManager.invokeObuSaveMessage(type, content, tts, DataSourceType.OBU)
}
/**

View File

@@ -1931,12 +1931,12 @@ internal class DebugSettingView @JvmOverloads constructor(
}
/**
* 车辆挂档位
* 车辆挂档位
* @param gear 档位
*/
override fun onAutopilotGearData(gear: Chassis.GearPosition) {
ThreadUtils.runOnUiThread {
tvGearInfo.text = "档位:${gear}"
tvGearInfo.text = "档位:${gear}"
}
}

View File

@@ -60,7 +60,7 @@ class VersionNameView @JvmOverloads constructor(
@SuppressLint("SetTextI18n")
private fun showCurrentPadVersion() {
tvAppVersionName?.let {
// it.text = "APP:${AppUtils.getAppVersionName()}"
it.text = "APP:${AppUtils.getAppVersionName()}"
}
}

View File

@@ -1009,7 +1009,7 @@
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="挂档位:" />
android:text="挂档位:" />
<View
android:layout_width="match_parent"

View File

@@ -11,15 +11,16 @@ import com.mogo.cloud.passport.IMoGoTokenCallback
import com.mogo.cloud.passport.MoGoAiCloudClient
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.utils.MogoAnalyticUtils
import com.mogo.commons.constants.SharedPrefsConstants
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.network.NetConfigUtils
import com.mogo.commons.utils.MogoAnalyticUtils
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_CONNECT_FAIL
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_CONNECT_LOST
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_CONNECT_SUCCESS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_RECONNECT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_CLOUD
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CONNECT_STATUS
import com.mogo.eagle.core.data.map.MogoLocation
@@ -29,29 +30,35 @@ import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAIN
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.*
import com.rousetime.android_startup.AndroidStartup
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
import kotlin.properties.Delegates
class HttpDnsStartUp : AndroidStartup<Boolean>() {
private val TAG = "MogoApplication"
companion object {
private const val TAG = "HttpDnsStartUp"
}
// 配置云服务API
private val clientConfig by lazy {
MoGoAiCloudClientConfig.getInstance()
}
// 缓存IP地址
private var cacheIp: String? = null
private var context: Context? = null
private var gotToken = false
private var httpDnsSimpleLocation by Delegates.observable(getDefaultSimpleLocation()) { _, oldValue, newValue ->
if (oldValue.cityCode != newValue.cityCode) {
reConnectSocket(oldValue.cityCode, newValue.cityCode)
}
}
override fun callCreateOnMainThread() = true
override fun waitOnMainThread() = false
@@ -90,9 +97,9 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
clientConfig.isUseOriginSocket = true
// 设置是否输出网络日志
clientConfig.isShowNetDebugLog = false
clientConfig.passportUrl = FunctionBuildConfig.urlJson.passportUrl
clientConfig.socketBaseUrl = FunctionBuildConfig.urlJson.socketBaseUrl
clientConfig.socketTechUrl = FunctionBuildConfig.urlJson.socketTechUrl
// clientConfig.passportUrl //todo 亚坤
// clientConfig.socketBaseUrl
// clientConfig.socketTechUrl
// 设置是否是直播推流的主播
clientConfig.isAnchor = true
when (DebugConfig.getCarMachineType()) {
@@ -121,7 +128,10 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
override fun getCurrentLocation(): HttpDnsSimpleLocation {
val envConfig = CallerDevaToolsManager.getEnvConfig()
if (envConfig != null) {
return HttpDnsSimpleLocation(envConfig.cityCode, envConfig.lat, envConfig.lon)
// 更新
httpDnsSimpleLocation =
HttpDnsSimpleLocation(envConfig.cityCode, envConfig.lat, envConfig.lon)
return httpDnsSimpleLocation
}
var mogoLocation: MogoLocation? = null
val locationClient =
@@ -129,49 +139,25 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
if (locationClient != null) {
mogoLocation = locationClient
}
val httpDnsSimpleLocation =
if (mogoLocation != null && mogoLocation.latitude != 0.0 && mogoLocation.longitude != 0.0) {
if (mogoLocation.cityCode.isNullOrEmpty()
&& !CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode.isNullOrEmpty()
) {
HttpDnsSimpleLocation(
CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode
?: "010",
mogoLocation.latitude,
mogoLocation.longitude
)
} else {
HttpDnsSimpleLocation(
mogoLocation.cityCode,
mogoLocation.latitude,
mogoLocation.longitude
)
}
if (mogoLocation != null && mogoLocation.latitude != 0.0 && mogoLocation.longitude != 0.0) {
// 更新
httpDnsSimpleLocation = if (mogoLocation.cityCode.isNullOrEmpty()
&& !CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode.isNullOrEmpty()
) {
HttpDnsSimpleLocation(
CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode
?: "010",
mogoLocation.latitude,
mogoLocation.longitude
)
} else {
val ciyCode =
SharedPrefsMgr.getInstance(
AbsMogoApplication.getApp()
)
.getString(SharedPrefsConstants.LOCATION_CITY_CODE)
val latitude =
SharedPrefsMgr.getInstance(
AbsMogoApplication.getApp()
)
.getString(SharedPrefsConstants.LOCATION_LATITUDE)
val longitude =
SharedPrefsMgr.getInstance(
AbsMogoApplication.getApp()
)
.getString(SharedPrefsConstants.LOCATION_LONGITUDE)
try {
HttpDnsSimpleLocation(
ciyCode, latitude.toDouble(), longitude.toDouble()
)
} catch (e: NumberFormatException) {
// e.printStackTrace();
HttpDnsSimpleLocation("010", 1.0, 1.0)
}
HttpDnsSimpleLocation(
mogoLocation.cityCode,
mogoLocation.latitude,
mogoLocation.longitude
)
}
}
return httpDnsSimpleLocation
}
}
@@ -186,10 +172,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
clientConfig.token = token
// 由于存在token过期问题在更新后会回调至此处增加二次判定
if (!gotToken) {
CallerLogger.d(
SceneConstant.M_MAIN + TAG,
"onTokenGot token : $token , sn :$sn"
)
CallerLogger.d("$M_MAIN$TAG", "onTokenGot token : $token , sn :$sn")
CallerCloudListenerManager.invokeCloudTokenGot(token, sn)
// 异步初始化NetConfig
asyncInit()
@@ -202,7 +185,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
override fun onError(code: Int, msg: String) {
CallerLogger.d(
SceneConstant.M_MAIN + TAG,
"$M_MAIN$TAG",
"初始化MogoAiCloudSdk failed ,reason : $msg , 未能开启长链服务和初始化Modules服务"
)
}
@@ -250,13 +233,10 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
}
private fun startSocketService() {
CallerLogger.d(SceneConstant.M_MAIN + TAG, "startSocketService")
CallerLogger.d("$M_MAIN$TAG","startSocketService")
val location = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
// 关闭长链服务
MogoAiCloudSocketManager.getInstance(context).destroy()
MogoAiCloudSocketManager.getInstance(context)
.registerLifecycleListener(10020, object : IMogoLifecycleListener {
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS,
linkCode = CHAIN_LINK_CLOUD,
@@ -266,7 +246,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
clientPkFileName = "sn"
)
override fun onConnectFailure() {
CallerLogger.d(SceneConstant.M_MAIN + TAG, "socket-onConnectFailure")
CallerLogger.d("$M_MAIN$TAG", "socket-onConnectFailure")
MogoStatusManager.getInstance().setCloudSocketMode(TAG, false)
}
@@ -279,7 +259,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
clientPkFileName = "sn"
)
override fun onConnectSuccess() {
CallerLogger.d(SceneConstant.M_MAIN + TAG, "socket-onConnectSuccess")
CallerLogger.d("$M_MAIN$TAG", "socket-onConnectSuccess")
MogoStatusManager.getInstance().setCloudSocketMode(TAG, true)
}
@@ -292,7 +272,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
clientPkFileName = "sn"
)
override fun onConnectLost() {
CallerLogger.d(SceneConstant.M_MAIN + TAG, "socket-onConnectLost")
CallerLogger.d("$M_MAIN$TAG", "socket-onConnectLost")
MogoStatusManager.getInstance().setCloudSocketMode(TAG, false)
}
@@ -305,10 +285,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
clientPkFileName = "sn"
)
override fun onError(code: String, msg: String?) {
CallerLogger.d(
SceneConstant.M_MAIN + TAG,
"socket-onError code : $code , msg : $msg"
)
CallerLogger.d("$M_MAIN$TAG", "socket-onError code : $code , msg : $msg")
}
})
// 开启Socket长链服务
@@ -319,4 +296,42 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
MogoAiCloudSocketManager.getInstance(context)
.init(context, DebugConfig.getSocketAppId(), lat, lon)
}
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS,
linkCode = CHAIN_LINK_CLOUD,
endpoint = PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_CLOUD_RECONNECT,
paramIndexes = [0, 1],
clientPkFileName = "sn"
)
private fun reConnectSocket(oldCityCode: String, newCityCode: String) {
CallerLogger.d("$M_MAIN$TAG", "reConnectSocket oldCityCode : $oldCityCode , newCityCode : $newCityCode")
MogoAiCloudSocketManager.getInstance(context).reConnect()
}
private fun getDefaultSimpleLocation(): HttpDnsSimpleLocation {
val ciyCode =
SharedPrefsMgr.getInstance(
AbsMogoApplication.getApp()
)
.getString(SharedPrefsConstants.LOCATION_CITY_CODE)
val latitude =
SharedPrefsMgr.getInstance(
AbsMogoApplication.getApp()
)
.getString(SharedPrefsConstants.LOCATION_LATITUDE)
val longitude =
SharedPrefsMgr.getInstance(
AbsMogoApplication.getApp()
)
.getString(SharedPrefsConstants.LOCATION_LONGITUDE)
return try {
HttpDnsSimpleLocation(
ciyCode, latitude.toDouble(), longitude.toDouble()
)
} catch (e: NumberFormatException) {
HttpDnsSimpleLocation("010", 1.0, 1.0)
}
}
}