Merge branch 'dev_arch_opt_3.0' into dev_robosweeper-d_app-module_221230_1.1.0

# Conflicts:
#	OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperLimitingVelocityView.kt
#	OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperTrafficDataView.java
#	OCH/mogo-och-sweeper/src/main/res/layout/sweeper_base_fragment.xml
This commit is contained in:
donghongyu
2023-01-31 17:25:18 +08:00
185 changed files with 2897 additions and 5656 deletions

View File

@@ -10,7 +10,6 @@ import com.mogo.eagle.function.biz.dispatch.DispatchAutoPilotManager.Companion.d
import com.mogo.eagle.function.biz.monitoring.CronTaskManager.Companion.cronTaskManager
import com.mogo.eagle.function.biz.notice.NoticeSocketManager.Companion.noticeSocketManager
import com.mogo.eagle.function.biz.notice.network.NoticeNetWorkManager
import com.mogo.eagle.function.biz.v2x.speedlimit.SpeedLimitDataManager
import com.mogo.eagle.function.biz.v2x.speedlimit.SpeedLimitDispatcher
import com.mogo.eagle.function.biz.v2x.trafficlight.core.MogoTrafficLightManager
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightDispatcher
@@ -28,10 +27,9 @@ class FuncBizProvider : IMoGoFuncBizProvider {
cronTaskManager.startCronTask()
MogoTrafficLightManager.INSTANCE.initServer(context)
TrafficLightDispatcher.INSTANCE.initServer(context) //todo 红绿灯中心模块放入dataCenter
VipCarManager.INSTANCE.initServer(context)
SpeedLimitDataManager.getInstance().start()
SpeedLimitDispatcher.INSTANCE.initLimit(context)
TrafficLightDispatcher.INSTANCE.initServer(context) //todo 宏宇 放入dataCenter
SpeedLimitDispatcher.INSTANCE.initLimit(context) //todo 宏宇放入dataCenter
// RedLightWarningManager.INSTANCE.listenTrafficLight()
}

View File

@@ -4,7 +4,7 @@ import android.util.Log
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_IVP
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_IVP_GREEN
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2I
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
@@ -209,17 +209,17 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
EventTypeEnum.TYPE_USECASE_ID_IVP.poiType,
EventTypeEnum.TYPE_USECASE_ID_IVP.content,
EventTypeEnum.TYPE_USECASE_ID_IVP.tts
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.content,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.tts
)
)
)
CallerHmiManager.warningV2X(
EventTypeEnum.TYPE_USECASE_ID_IVP.poiType,
EventTypeEnum.TYPE_USECASE_ID_IVP.content,
EventTypeEnum.TYPE_USECASE_ID_IVP.tts,
EventTypeEnum.TYPE_USECASE_ID_IVP.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.content,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.tts,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
null,
true,
5000L
@@ -235,11 +235,11 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
CallerLogger.d("$M_V2X$TAG", "=====绿灯通行预警=====")
ThreadUtils.runOnUiThread {
val content = String.format(
EventTypeEnum.getWarningContent(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType),
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
speed
)
val tts = String.format(
EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType),
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
speed
)
if (content.isNullOrEmpty() || tts.isNullOrEmpty()) {
@@ -249,17 +249,17 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
content,
tts
)
)
)
CallerHmiManager.warningV2X(
EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
content,
tts,
EventTypeEnum.TYPE_USECASE_ID_IVP_GREEN.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
null,
true,
5000L

View File

@@ -1,20 +1,19 @@
package com.mogo.eagle.function.biz.v2x.speedlimit
import android.content.Context
import com.mogo.eagle.core.function.api.v2x.LimitingVelocityListener
import com.mogo.eagle.core.function.api.v2x.ObuLimitingSpeedListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.v2x.CallLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallObuLimitingSpeedListenerManager
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.function.api.v2x.ILimitingVelocityListener
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerViewLimitingVelocityListenerManager
import com.zhjt.service_biz.BizConfig
/**
* @author lixiaopeng
* @description 对多个限速进行调度maprsu ...
* @since: 2023/1/12
*/
class SpeedLimitDispatcher : LimitingVelocityListener, ObuLimitingSpeedListener {
class SpeedLimitDispatcher : ILimitingVelocityListener {
companion object {
const val TAG = "SpeedLimitDispatcher"
val INSTANCE: SpeedLimitDispatcher by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
@@ -24,47 +23,42 @@ class SpeedLimitDispatcher : LimitingVelocityListener, ObuLimitingSpeedListener
private var mContext: Context? = null
//是否有AI获取红绿灯灯
//obu限速状
private var hasObuStatus: Boolean = false
fun initLimit(context: Context) {
mContext = context
//注册监听MAP的限速
CallLimitingVelocityListenerManager.addListener(TAG, this)
//注册监听OBU的限速
CallObuLimitingSpeedListenerManager.addListener(TAG, this)
CallerLimitingVelocityListenerManager.addListener(TAG, this)
}
/**
* 地图限速数据
*/
override fun onLimitingVelocityChange(limitingVelocity: Int) {
// CallerHmiManager.disableLimitingVelocity()
if (!hasObuStatus) {
CallerHmiManager.showLimitingVelocity(limitingVelocity, 1)
}
}
/**
* obu限速
*/
override fun onObuLimitingSpeedChange(limitingSpeed: Int) {
// CallerHmiManager.disableLimitingVelocity()
if (limitingSpeed > 0) {
hasObuStatus = true
CallerHmiManager.showLimitingVelocity(limitingSpeed, 2)
} else {
hasObuStatus = false
CallerHmiManager.disableLimitingVelocity()
// @BizConfig(FuncBizConfig.V2I, "", FuncBizConfig.BIZ_SLW) //todo arrow 重新考虑放的位置
override fun onLimitingVelocityChange(limitingVelocity: Int, sourceType: DataSourceType) {
when (sourceType) { // obu 优先级高于 map体现链路能力
DataSourceType.OBU -> {
hasObuStatus = limitingVelocity > 0
CallerViewLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
limitingVelocity,
sourceType
)
return
}
DataSourceType.MAP -> {
if (!hasObuStatus) {
CallerViewLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
limitingVelocity,
sourceType
)
}
}
else -> {}
}
}
fun destroy() {
//取消注册监听AI云获取红绿灯状态
CallerTrafficLightListenerManager.removeListener(TAG)
//取消注册监听工控机感知红绿灯
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
CallerLimitingVelocityListenerManager.removeListener(TAG)
}
}

View File

@@ -10,7 +10,7 @@ import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_VIP
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2N
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
@@ -209,17 +209,17 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
val light = this.result?.currentRoadTrafficLight()
if (light != null && light.isGreen()) {
showWarning(
EventTypeEnum.TYPE_VIP_IDENTIFICATION_EXTEND.poiType,
EventTypeEnum.TYPE_VIP_IDENTIFICATION_EXTEND.content,
EventTypeEnum.TYPE_VIP_IDENTIFICATION_EXTEND.tts,
EventTypeEnum.TYPE_VIP_IDENTIFICATION_EXTEND.poiType
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.poiType,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.content,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.tts,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_EXTEND.poiType
)
} else {
showWarning(
EventTypeEnum.TYPE_VIP_IDENTIFICATION_PASS.poiType,
EventTypeEnum.TYPE_VIP_IDENTIFICATION_PASS.content,
EventTypeEnum.TYPE_VIP_IDENTIFICATION_PASS.tts,
EventTypeEnum.TYPE_VIP_IDENTIFICATION_PASS.poiType
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.poiType,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.content,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.tts,
EventTypeEnumNew.TYPE_VIP_IDENTIFICATION_PASS.poiType
)
}
return@turnLightToGreen
@@ -228,10 +228,10 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
// 请求变灯失败,根据灯态来提示。 此处灯态未获取到
if (this.result == null || this.result?.currentRoadTrafficLight() == null) {
showWarning(
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType,
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.content + ", 稍后重试",
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.tts,
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.poiType,
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.content + ", 稍后重试",
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.tts,
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.poiType
)
return@turnLightToGreen
}
@@ -249,10 +249,10 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
"${temp}秒后重试"
}
showWarning(
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType,
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.content + time,
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.tts,
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.poiType,
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.content + time,
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.tts,
EventTypeEnumNew.TYPE_VIP_ERROR_IDENTIFICATION.poiType
)
} else {
CallerLogger.d(

View File

@@ -54,16 +54,17 @@ dependencies {
kapt rootProject.ext.dependencies.androidxroomcompiler
implementation rootProject.ext.dependencies.androidxroomktx
implementation rootProject.ext.dependencies.mogoami
implementation rootProject.ext.dependencies.mogoaicloudtelematic
implementation rootProject.ext.dependencies.mogoobu
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation project(':libraries:mogo-adas')
implementation rootProject.ext.dependencies.mogocommons
} else {
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')
@@ -71,8 +72,6 @@ dependencies {
implementation project(':libraries:mogo-adas')
implementation project(':foudations:mogo-commons')
}
}

View File

@@ -1,6 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.eagle.core.function.datacenter">
<application>
<receiver android:name=".obu.receiver.ObuTestTriggerReceiver">
<intent-filter>
<action android:name="com.obu.test_trigger" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".obu.receiver.ObuTestTriggerRecognizedReceiver">
<intent-filter>
<action android:name="com.obu.test_trigger_recognized" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".obu.receiver.ObuRsuTestTriggerReceiver">
<intent-filter>
<action android:name="com.obu.test_light_recognized" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".obu.receiver.ObuTestNewObuReceiver">
<intent-filter>
<action android:name="com.obu.test_newobu" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".obu.receiver.ObuTestNewObuRsiReceiver">
<intent-filter>
<action android:name="com.obu.test_newobu_rsi" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

@@ -0,0 +1,21 @@
package com.mogo.eagle.core.function
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.datacenter.IDataCenterProvider
@Route(path = MogoServicePaths.PATH_DATA_CENTER_MODULE)
class DataCenterProvider: IDataCenterProvider {
override val functionName: String
get() = "DataCenterProvider"
override fun init(context: Context?) {
}
override fun onDestroy() {
}
}

View File

@@ -62,9 +62,9 @@ import java.util.concurrent.TimeUnit
/**
* 域控制器
* @author xiaoyuzhou
* @date 2021/9/22 8:43 下午
* 域控制器
*/
@Route(path = MogoServicePaths.PATH_AUTO_PILOT)
class MoGoAutopilotProvider :

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.obu.mogo
package com.mogo.eagle.core.function.datacenter.obu
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
@@ -11,6 +11,7 @@ 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.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.CommonUtils
import com.mogo.support.obu.MogoObuManager
/**
* @author xiaoyuzhou
@@ -54,9 +55,6 @@ class MoGoObuProvider : IMoGoObuProvider {
ipAddress,
CommonUtils.getIpAddressString()
)
//old obu
MogoPrivateObuManager.INSTANCE.init(context, ipAddress)
} else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) { //taxi 司机端和乘客端
val ipAddress =
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.OBU_IP, taxiObuIp)
@@ -66,9 +64,6 @@ class MoGoObuProvider : IMoGoObuProvider {
ipAddress,
CommonUtils.getIpAddressString()
)
//old obu
MogoPrivateObuManager.INSTANCE.init(context, ipAddress)
}
}
}
@@ -95,18 +90,16 @@ class MoGoObuProvider : IMoGoObuProvider {
CommonUtils.getIpAddressString()
)
//连接old obu
MogoPrivateObuManager.INSTANCE.connectObu(it, ipAddress)
}
}
}
override fun disConnect() {
MogoPrivateObuManager.INSTANCE.disConnectObu()
MogoPrivateObuNewManager.INSTANCE.disconnect()
}
override fun isConnected(): Boolean {
return MogoPrivateObuManager.INSTANCE.isConnected()
return MogoObuManager.getInstance().connectStatus == 1
}
}

View File

@@ -1,10 +1,10 @@
package com.mogo.eagle.core.function.obu.mogo
package com.mogo.eagle.core.function.datacenter.obu
import android.content.Context
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.msgbox.DataSourceType
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
@@ -14,11 +14,13 @@ 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.obucombine.CallerObuDcCombineListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
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.constants.MogoObuConstants
import mogo.v2x.ObuWarningEvent
import mogo.v2x.ObuWarningEvent.*
import kotlin.math.roundToInt
/**
@@ -441,14 +443,15 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuDcCombineListener
"MogoObuDcCombineManager onMogoObuMapMath = ${data.status} --speedMaxLimit = ${Math.round((data.speedMaxLimit*0.02*3.6))} --- data.speedMaxLimit = ${data.speedMaxLimit}")
when (data.status) {
MogoObuConstants.STATUS.ADD -> { // 添加 TODO
CallerHmiManager.showLimitingVelocity(Math.round((data.speedMaxLimit*0.02*3.6)).toInt(), 2)
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
(data.speedMaxLimit * 0.02 * 3.6).roundToInt().toInt(),DataSourceType.OBU)
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
CallerHmiManager.disableLimitingVelocity()
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(-1 ,DataSourceType.OBU)
}
}
}

View File

@@ -1,10 +1,9 @@
package com.mogo.eagle.core.function.obu.mogo
package com.mogo.eagle.core.function.datacenter.obu
import android.content.Context
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.enums.*
import com.mogo.eagle.core.data.msgbox.DataSourceType
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
@@ -18,8 +17,8 @@ import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.TooC
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
import com.mogo.eagle.core.function.call.obu.CallerObuTrafficLightListenerManager
import com.mogo.eagle.core.function.call.v2x.CallObuLimitingSpeedListenerManager
import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertUtilsNew
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager
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.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
@@ -34,6 +33,7 @@ import com.mogo.support.obu.model.advance.SpatLight
import com.mogo.support.obu.option.MogoObuCom
import com.mogo.support.obu.option.MogoObuOptions
import org.json.JSONObject
import kotlin.math.roundToInt
/**
*
@@ -88,6 +88,11 @@ class MogoPrivateObuNewManager private constructor() {
return mogoObuListener
}
fun disconnect() {
MogoObuManager.getInstance().disconnect()
}
private val mogoObuListener: OnMogoObuListener = object : OnMogoObuListener() {
/**
* 连接状态的改变
@@ -105,13 +110,6 @@ class MogoPrivateObuNewManager private constructor() {
mObuStatusInfo.obuStatus = true
CallerObuListenerManager.invokeListener(mObuStatusInfo)
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU", true) }
//断开老obu
try {
com.zhidao.support.obu.MogoObuManager.getInstance().disConnect()
} catch (e: Exception) {
e.printStackTrace()
}
}
}
@@ -512,7 +510,9 @@ class MogoPrivateObuNewManager private constructor() {
//物体数据绘制
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()}")
"$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()}"
)
when (data.status) {
MogoObuConstants.STATUS.ADD -> { // 添加
// 更新数据模型变色的时候是不是update,如果不是更新可能导致模型不变色add的时候是否有level高的 TODO
@@ -552,7 +552,7 @@ class MogoPrivateObuNewManager private constructor() {
//删除弱势交通元素
CallerMapUIServiceManager.getMarkerService()
?.removeCvxRvInfoIndInfo(data.participant.ptcId.toString())
}
}
}
//预警status
@@ -629,347 +629,421 @@ class MogoPrivateObuNewManager private constructor() {
*/
override fun onMogoObuMapMath(data: MogoObuMapMathData?) {
super.onMogoObuMapMath(data)
// if (isShowObuLimitSpeedView) {
if (data != null) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"onMogoObuMapMath = ${data.status} --speedMaxLimit = ${Math.round((data.speedMaxLimit * 3.6))}"
)
when (data.status) {
MogoObuConstants.STATUS.ADD -> { // 添加
UiThreadHandler.post {
if (data.speedMaxLimit > 0) {
// CallerHmiManager.showLimitingVelocity(
// Math.round((data.speedMaxLimit * 3.6)).toInt(), 2)
CallObuLimitingSpeedListenerManager.invokeOnObuLimitingSpeedChange(Math.round((data.speedMaxLimit * 3.6)).toInt())
}
}
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
UiThreadHandler.post {
// CallerHmiManager.disableLimitingVelocity()
CallObuLimitingSpeedListenerManager.invokeOnObuLimitingSpeedChange(-1)
if (data != null) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"onMogoObuMapMath = ${data.status} --speedMaxLimit = ${(data.speedMaxLimit * 3.6).roundToInt()}"
)
when (data.status) {
MogoObuConstants.STATUS.ADD -> { // 添加
UiThreadHandler.post {
if (data.speedMaxLimit > 0) {
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(
(data.speedMaxLimit * 3.6).roundToInt(), DataSourceType.OBU
)
}
}
}
MogoObuConstants.STATUS.UPDATE -> { // 更新
}
MogoObuConstants.STATUS.DELETE -> { // 删除
UiThreadHandler.post {
CallerLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(-1,DataSourceType.OBU)
}
}
}
// }
}
}
}
}
/**
* 获取消息的方位 车辆相关
*/
private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum {
/**
* 获取消息的方位 车辆相关
*/
private fun getMessageDirection(targetClassification: Int): WarningDirectionEnum {
// CallerLogger.d("$M_OBU${TAG_MOGO_NEW_OBU}", "预警红边:预警方向->$targetClassification")
return when (targetClassification) {
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE,
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方
return when (targetClassification) {
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_IN_LANE,
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_TOP //正前方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_IN_LANE -> WarningDirectionEnum.ALERT_WARNING_BOTTOM //正后方
MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_RIGHT -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方
MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_RIGHT -> WarningDirectionEnum.ALERT_WARNING_RIGHT //正右方
MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_LEFT //正左方
MogoObuConstants.VEH_TARGET_POSITION.INTERSECTION_LEFT -> WarningDirectionEnum.ALERT_WARNING_LEFT //正左方
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_LEFT,
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_LEFT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAR_LEFT
-> WarningDirectionEnum.ALERT_WARNING_TOP_LEFT //左前方
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_LEFT,
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_LEFT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAR_LEFT
-> WarningDirectionEnum.ALERT_WARNING_TOP_LEFT //左前方
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_RIGHT,
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAT_RIGHT
-> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方
MogoObuConstants.VEH_TARGET_POSITION.AHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.AHEAD_FAR_RIGHT,
MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.ONCOMING_FAT_RIGHT
-> WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT //右前方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_LEFT,
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_LEFT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_LEFT,
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT //左后方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_RIGHT,
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方
MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_RIGHT, MogoObuConstants.VEH_TARGET_POSITION.BEHEAD_FAR_RIGHT,
-> WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT //右后方
MogoObuConstants.VEH_TARGET_POSITION.UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知
else -> WarningDirectionEnum.ALERT_WARNING_ALL
}
MogoObuConstants.VEH_TARGET_POSITION.UNCLASSIFIED -> WarningDirectionEnum.ALERT_WARNING_NON //未知
else -> WarningDirectionEnum.ALERT_WARNING_ALL
}
}
/**
* 构造对应展示数据和场景 根据obu的场景add change delete确定是否展示
*
* @param appId 使用WarningTypeEnum获取icon提示内容tts内容 TODO 添加事件频繁播报拦截
*
* @see com.mogo.module.common.enums.EventTypeEnum
*/
private fun handleSdkObu(
appId: String,
direction: WarningDirectionEnum,
status: Int,
level: Int,
info: MogoObuRvWarningData
) {
// 这里排除需要特殊定制的语音及文案外,其余的都可以使用 EventTypeEnumNew 提供的
var alertContent: String = ""
var ttsContent: String = ""
var changeVisualAngle = false
when (appId) {
//交叉路口碰撞预警
MogoObuConstants.V2X_WARNING_TYPE.FCW.toString() -> {
alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType)
ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType)
}
/**
* 构造对应展示数据和场景 根据obu的场景add change delete确定是否展示
*
* @param appId 使用WarningTypeEnum获取icon提示内容tts内容 TODO 添加事件频繁播报拦截
*
* @see com.mogo.module.common.enums.EventTypeEnum
*/
private fun handleSdkObu(
appId: String,
direction: WarningDirectionEnum,
status: Int,
level: Int,
info: MogoObuRvWarningData
) {
// 这里排除需要特殊定制的语音及文案外,其余的都可以使用 EventTypeEnumNew 提供的
var alertContent: String = ""
var ttsContent: String = ""
var changeVisualAngle = false
when (appId) {
//交叉路口碰撞预警
MogoObuConstants.V2X_WARNING_TYPE.FCW.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType)
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_FCW.poiType)
}
//交叉路口碰撞预警
MogoObuConstants.V2X_WARNING_TYPE.ICW.toString() -> {
alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType)
ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType)
}
//交叉路口碰撞预警
MogoObuConstants.V2X_WARNING_TYPE.ICW.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType)
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType)
}
//左转辅助预警
MogoObuConstants.V2X_WARNING_TYPE.LTA.toString() -> {
alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_LTA.poiType)
ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_LTA.poiType)
}
//左转辅助预警
MogoObuConstants.V2X_WARNING_TYPE.LTA.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_LTA.poiType)
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_LTA.poiType)
}
//盲区预警
MogoObuConstants.V2X_WARNING_TYPE.BSW.toString() -> {
ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType)
alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType)
if (
direction == WarningDirectionEnum.ALERT_WARNING_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT
) { //左后
changeVisualAngle = true
ttsContent = String.format(ttsContent, "")
alertContent = String.format(alertContent, "")
} else if (
direction == WarningDirectionEnum.ALERT_WARNING_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
) { //右后
changeVisualAngle = true
ttsContent = String.format(ttsContent, "")
alertContent = String.format(alertContent, "")
}
//盲区预警
MogoObuConstants.V2X_WARNING_TYPE.BSW.toString() -> {
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType)
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_BSW.poiType)
if (
direction == WarningDirectionEnum.ALERT_WARNING_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT
) { //左后
changeVisualAngle = true
ttsContent = String.format(ttsContent, "")
alertContent = String.format(alertContent, "")
} else if (
direction == WarningDirectionEnum.ALERT_WARNING_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
) { //右后
changeVisualAngle = true
ttsContent = String.format(ttsContent, "")
alertContent = String.format(alertContent, "")
}
}
// 变道预警,注意左后车辆/注意右后车辆
MogoObuConstants.V2X_WARNING_TYPE.LCW.toString() -> {
alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType)
ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType)
if (
direction == WarningDirectionEnum.ALERT_WARNING_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT
) {
ttsContent = String.format(ttsContent, "")
alertContent = String.format(alertContent, "")
} else if (
direction == WarningDirectionEnum.ALERT_WARNING_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
) {
ttsContent = String.format(ttsContent, "")
alertContent = String.format(alertContent, "")
}
// 变道预警,注意左后车辆/注意右后车辆
MogoObuConstants.V2X_WARNING_TYPE.LCW.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType)
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_LCW.poiType)
if (
direction == WarningDirectionEnum.ALERT_WARNING_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_LEFT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT
) {
ttsContent = String.format(ttsContent, "")
alertContent = String.format(alertContent, "")
} else if (
direction == WarningDirectionEnum.ALERT_WARNING_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT ||
direction == WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT
) {
ttsContent = String.format(ttsContent, "")
alertContent = String.format(alertContent, "")
}
}
//逆向超车预警
MogoObuConstants.V2X_WARNING_TYPE.DNPW.toString() -> {
alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_DNPW.poiType)
ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_DNPW.poiType)
}
//逆向超车预警
MogoObuConstants.V2X_WARNING_TYPE.DNPW.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_DNPW.poiType)
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_DNPW.poiType)
}
//紧急制动预警
MogoObuConstants.V2X_WARNING_TYPE.EBW.toString() -> {
alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_EBW.poiType)
ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_EBW.poiType)
}
//紧急制动预警
MogoObuConstants.V2X_WARNING_TYPE.EBW.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_EBW.poiType)
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_EBW.poiType)
}
//异常车辆提醒
MogoObuConstants.V2X_WARNING_TYPE.AVW.toString() -> {
alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType)
ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType)
alertContent = String.format(alertContent, direction.desc)
ttsContent = String.format(ttsContent, direction.desc)
}
//异常车辆提醒
MogoObuConstants.V2X_WARNING_TYPE.AVW.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType)
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_AVW.poiType)
alertContent = String.format(alertContent, direction.desc)
ttsContent = String.format(ttsContent, direction.desc)
}
//车辆失控预警
MogoObuConstants.V2X_WARNING_TYPE.CLW.toString() -> {
alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType)
ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType)
alertContent = String.format(alertContent, direction.desc)
ttsContent = String.format(ttsContent, direction.desc)
}
//车辆失控预警
MogoObuConstants.V2X_WARNING_TYPE.EVW.toString() -> {
alertContent = EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType)
ttsContent = EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType)
}
//车辆失控预警
MogoObuConstants.V2X_WARNING_TYPE.CLW.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType)
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_CLW.poiType)
alertContent = String.format(alertContent, direction.desc)
ttsContent = String.format(ttsContent, direction.desc)
}
//车辆失控预警
MogoObuConstants.V2X_WARNING_TYPE.EVW.toString() -> {
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType)
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType)
}
// 这里处理固定的提示信息,包括了<紧急车辆提醒>
else -> { //TODO
// 这里处理固定的提示信息,包括了<紧急车辆提醒>
else -> { //TODO
// ttsContent = EventTypeEnumNew.getWarningTts(appId.toString())
// alertContent = EventTypeEnumNew.getWarningContent(appId.toString())
}
}
when (status) {
// 添加,更新 add的时候可能级别是2
MogoObuConstants.STATUS.ADD,
MogoObuConstants.STATUS.UPDATE -> {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"new handleSdkObu appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
)
if (level == 2 || level == 3) {
//不显示弹框,其它保留
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
appId,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.OBU
}
)
CallerHmiManager.warningV2X(
appId,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(appId + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onShow() {
super.onShow()
if (changeVisualAngle) {
CallerVisualAngleManager.changeVisualAngle(TooClose)
}
}
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
if (changeVisualAngle) {
CallerVisualAngleManager.changeVisualAngle(Default())
}
}
},
true,
5000L
)
//显示警告红边
CallerHmiManager.showWarning(direction)
}
//更新周边车辆进行预警颜色变换,车辆实时移动和变色 UUID不需要匹配了
TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 移除顶部弹窗
// CallerHmiManager.disableWarningV2X((appId + direction.direction))
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let {
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
}
}
}
/**
* 处理红绿灯
*/
private fun handlerTrafficLight(appId: Int, status: Int, lights: List<SpatLight>) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"handlerTrafficLight --- status = $status ---lights.size = ${lights.size} ---lights = $lights ---appId = $appId"
)
when (status) {
// 添加
MogoObuConstants.STATUS.ADD,
MogoObuConstants.STATUS.UPDATE
-> {
if (lights != null && lights.isNotEmpty()) {
changeTrafficLightStatus(appId, lights)
}
when (status) {
// 添加,更新 add的时候可能级别是2
MogoObuConstants.STATUS.ADD,
MogoObuConstants.STATUS.UPDATE -> {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"new handleSdkObu appId2 = $appId --- level = $level ---ttsContent = $ttsContent --- alertContent = $alertContent --- direction = $direction"
)
if (level == 2 || level == 3) {
//不显示弹框,其它保留
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
appId,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.OBU
}
)
CallerHmiManager.warningV2X(
appId,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
(appId + direction.direction),//使用当前事件类型+方向记录tag当发生变化的时候关闭当前弹出新的
object : IMoGoWarningStatusListener {
override fun onShow() {
super.onShow()
if (changeVisualAngle) {
CallerVisualAngleManager.changeVisualAngle(TooClose)
}
}
override fun onDismiss() {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
if (changeVisualAngle) {
CallerVisualAngleManager.changeVisualAngle(Default())
}
}
},
true,
5000L
)
//显示警告红边
CallerHmiManager.showWarning(direction)
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 移除顶部弹窗
CallerHmiManager.disableWarningTrafficLight()
CallerHmiManager.disableWarningV2X(appId.toString())
isShowGreenWave = false
isShowRunRedLight = false
isYellowLight = false
//更新周边车辆进行预警颜色变换,车辆实时移动和变色 UUID不需要匹配了
TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let {
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 关闭警告红边
CallerHmiManager.showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
// 移除顶部弹窗
// CallerHmiManager.disableWarningV2X((appId + direction.direction))
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
TrafficDataConvertUtilsNew.cvxV2vThreatIndInfo2TrafficData(info)?.let {
it.threatLevel = 0x01
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
}
}
}
/**
* 处理红绿灯
*/
private fun handlerTrafficLight(appId: Int, status: Int, lights: List<SpatLight>) {
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"handlerTrafficLight --- status = $status ---lights.size = ${lights.size} ---lights = $lights ---appId = $appId"
)
when (status) {
// 添加
MogoObuConstants.STATUS.ADD,
MogoObuConstants.STATUS.UPDATE
-> {
if (lights != null && lights.isNotEmpty()) {
changeTrafficLightStatus(appId, lights)
}
}
// 删除
MogoObuConstants.STATUS.DELETE -> {
// 移除顶部弹窗
CallerHmiManager.disableWarningTrafficLight()
CallerHmiManager.disableWarningV2X(appId.toString())
isShowGreenWave = false
isShowRunRedLight = false
isYellowLight = false
// lightCountDownRed = 1
// lightCountDownGreen = 1
// lightCountDownYellow = 1
}
}
}
}
private var isRedLight = false
private var isGreenLight = false
private var isYellowLight = false
private var isShowGreenWave = false
private var isShowRunRedLight = false
private var isRedLight = false
private var isGreenLight = false
private var isYellowLight = false
private var isShowGreenWave = false
private var isShowRunRedLight = false
// private var lightCountDownRed : Int = 1
// private var lightCountDownGreen : Int = 1
// private var lightCountDownYellow : Int = 1
/**
* 修改红绿灯
*/
@Synchronized
private fun changeTrafficLightStatus(
appId: Int,
lights: List<SpatLight>
) {
var ttsContent = ""
var alertContent = ""
//这里需要根据真实数据确定 index 取值方式
val currentLight = lights[0]
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"changeTrafficLightStatus currentLight = $currentLight ----currentLight.light = ${currentLight.light} ---currentLight.phase = ${currentLight.phaseId} ---appId = $appId --countDown = ${currentLight.countDown.toInt()}"
)
// 闯红灯预警,绿波通行和闯红灯是互斥的
when (appId) {
0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE 无效
/**
* 修改红绿灯
*/
@Synchronized
private fun changeTrafficLightStatus(
appId: Int,
lights: List<SpatLight>
) {
var ttsContent = ""
var alertContent = ""
//这里需要根据真实数据确定 index 取值方式
val currentLight = lights[0]
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"changeTrafficLightStatus currentLight = $currentLight ----currentLight.light = ${currentLight.light} ---currentLight.phase = ${currentLight.phaseId} ---appId = $appId --countDown = ${currentLight.countDown.toInt()}"
)
// 闯红灯预警,绿波通行和闯红灯是互斥的
when (appId) {
0 -> {//不可用 V2I_RLVW_VIOLATION_TYPE_UNAVAILABLE 无效
}
1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次
if (!isShowRunRedLight) {
isShowRunRedLight = true
CallerHmiManager.disableWarningV2X(1667.toString())
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"changeTrafficLightStatus 闯红灯 --------> "
)
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.OBU
}
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
null,
true,
5000L
)
}
1 -> {//闯红灯 V2I_RLVW_VIOLATION_TYPE_RUNNING_RED_LIGHT 一个红灯周期只显示一次
if (!isShowRunRedLight) {
isShowRunRedLight = true
CallerHmiManager.disableWarningV2X(1667.toString())
CallerLogger.d(
"$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}",
"changeTrafficLightStatus 闯红灯 --------> "
}
2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次 100m的时候
if (!isShowGreenWave) {
isShowGreenWave = true
CallerHmiManager.disableWarningV2X(1666.toString())
var minSpeedTemp = Math.round(currentLight.suggestMinSpeed * 3.6)
var maxSpeedTemp = Math.round(currentLight.suggestMaxSpeed * 3.6)
if (minSpeedTemp == maxSpeedTemp) {
minSpeedTemp -= 5
}
val adviceSpeed = "$minSpeedTemp - $maxSpeedTemp"
val adviceSpeedTts = "$minSpeedTemp$maxSpeedTemp"
// val adviceSpeed =
// "${Math.round(currentLight.suggestMinSpeed*3.6)} - ${Math.round(currentLight.suggestMaxSpeed*3.6)}"
// val adviceSpeedTts =
// "${Math.round(currentLight.suggestMinSpeed*3.6)} 到 ${Math.round(currentLight.suggestMaxSpeed*3.6)}"
ttsContent =
String.format(
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeedTts
)
ttsContent =
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
alertContent =
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType)
alertContent =
String.format(
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeed
)
val maxSpeed = currentLight.suggestMaxSpeed
if (maxSpeed > 0) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent
)
@@ -979,118 +1053,61 @@ class MogoPrivateObuNewManager private constructor() {
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType,
appId.toString(),
null,
true,
5000L
)
}
}
2 -> { //绿波通行引导 V2I_RLVW_VIOLATION_TYPE_NO_VIOLATION 一个绿灯周期只显示一次 100m的时候
if (!isShowGreenWave) {
isShowGreenWave = true
CallerHmiManager.disableWarningV2X(1666.toString())
var minSpeedTemp = Math.round(currentLight.suggestMinSpeed*3.6)
var maxSpeedTemp = Math.round(currentLight.suggestMaxSpeed*3.6)
if (minSpeedTemp == maxSpeedTemp) {
minSpeedTemp -= 5
}
val adviceSpeed = "$minSpeedTemp - $maxSpeedTemp"
val adviceSpeedTts = "$minSpeedTemp$maxSpeedTemp"
// val adviceSpeed =
// "${Math.round(currentLight.suggestMinSpeed*3.6)} - ${Math.round(currentLight.suggestMaxSpeed*3.6)}"
// val adviceSpeedTts =
// "${Math.round(currentLight.suggestMinSpeed*3.6)} 到 ${Math.round(currentLight.suggestMaxSpeed*3.6)}"
ttsContent =
String.format(
EventTypeEnumNew.getWarningTts(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeedTts
)
alertContent =
String.format(
EventTypeEnumNew.getWarningContent(EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType),
adviceSpeed
)
val maxSpeed = currentLight.suggestMaxSpeed
if (maxSpeed > 0) {
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
MsgBoxType.V2X,
V2XMsg(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent
)
).apply {
sourceType = DataSourceType.OBU
}
)
CallerHmiManager.warningV2X(
EventTypeEnumNew.TYPE_USECASE_ID_IVP_GREEN.poiType,
alertContent,
ttsContent,// 只有第一次才tts防止更新的时候不断的提醒
appId.toString(),
null,
true,
5000L
)
}
}
}
}
when (currentLight.light) {
// 灯光不可用
0 -> {
CallerObuTrafficLightListenerManager.invokeObuTrafficLight(0)
}
// 红灯
2, 3 -> {
if (!isRedLight) {
CallerHmiManager.disableWarningV2X(appId.toString())
isRedLight = true
}
isGreenLight = false
isYellowLight = false
CallerObuTrafficLightListenerManager.invokeObuTrafficLight(1)
val red = currentLight.countDown.toInt()
CallerHmiManager.changeCountdownRed(red)
}
// 绿灯
4, 5, 6 -> {
if (!isGreenLight) {
CallerHmiManager.disableWarningV2X(appId.toString())
isGreenLight = true
}
isRedLight = false
isYellowLight = false
CallerObuTrafficLightListenerManager.invokeObuTrafficLight(3)
val green = currentLight.countDown.toInt()
CallerHmiManager.changeCountdownGreen(green)
}
// 黄灯
7, 8 -> {
if (!isYellowLight) {
isYellowLight = true
}
isRedLight = false
isGreenLight = false
CallerHmiManager.disableWarningV2X(appId.toString())
CallerObuTrafficLightListenerManager.invokeObuTrafficLight(2)
val yellow = currentLight.countDown.toInt()
CallerHmiManager.changeCountdownYellow(yellow)
}
}
}
when (currentLight.light) {
// 灯光不可用
0 -> {
CallerObuTrafficLightListenerManager.invokeObuTrafficLight(0)
}
// 红灯
2, 3 -> {
if (!isRedLight) {
CallerHmiManager.disableWarningV2X(appId.toString())
isRedLight = true
}
isGreenLight = false
isYellowLight = false
CallerObuTrafficLightListenerManager.invokeObuTrafficLight(1)
val red = currentLight.countDown.toInt()
CallerHmiManager.changeCountdownRed(red)
}
// 绿灯
4, 5, 6 -> {
if (!isGreenLight) {
CallerHmiManager.disableWarningV2X(appId.toString())
isGreenLight = true
}
isRedLight = false
isYellowLight = false
CallerObuTrafficLightListenerManager.invokeObuTrafficLight(3)
val green = currentLight.countDown.toInt()
CallerHmiManager.changeCountdownGreen(green)
}
// 黄灯
7, 8 -> {
if (!isYellowLight) {
isYellowLight = true
}
isRedLight = false
isGreenLight = false
CallerHmiManager.disableWarningV2X(appId.toString())
CallerObuTrafficLightListenerManager.invokeObuTrafficLight(2)
val yellow = currentLight.countDown.toInt()
CallerHmiManager.changeCountdownYellow(yellow)
}
}
}

View File

@@ -1,10 +1,10 @@
package com.mogo.eagle.core.function.obu.mogo.receiver
package com.mogo.eagle.core.function.datacenter.obu.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
//import com.mogo.eagle.core.function.obu.mogo.MogoObuConst
//import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuManager
//import com.mogo.eagle.core.function.datacenter.obu.MogoPrivateObuManager
//import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
//import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
//import com.zhidao.support.obu.constants.ObuConstants

View File

@@ -1,10 +1,9 @@
package com.mogo.eagle.core.function.obu.mogo.receiver
package com.mogo.eagle.core.function.datacenter.obu.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuNewManager
import com.mogo.eagle.core.function.datacenter.obu.MogoPrivateObuNewManager
import com.mogo.support.obu.model.MogoObuRvWarningData
import com.mogo.support.obu.model.advance.V2xWarning
import com.mogo.support.obu.model.advance.VehBasics

View File

@@ -1,16 +1,11 @@
package com.mogo.eagle.core.function.obu.mogo.receiver
package com.mogo.eagle.core.function.datacenter.obu.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuNewManager
import com.mogo.eagle.core.function.datacenter.obu.MogoPrivateObuNewManager
import com.mogo.support.obu.model.MogoObuRsiWarningData
import com.mogo.support.obu.model.MogoObuRvWarningData
import com.mogo.support.obu.model.advance.RsiWarning
import com.mogo.support.obu.model.advance.V2xWarning
import com.mogo.support.obu.model.advance.VehBasics
import com.mogo.support.obu.model.advance.WarningData
/**
* @author lixiaopeng

View File

@@ -1,10 +1,10 @@
package com.mogo.eagle.core.function.obu.mogo.receiver
package com.mogo.eagle.core.function.datacenter.obu.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
//import com.mogo.eagle.core.function.obu.mogo.MogoObuConst
//import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuManager
//import com.mogo.eagle.core.function.datacenter.obu.MogoPrivateObuManager
//import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
//import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
//import com.zhidao.support.obu.constants.ObuConstants

View File

@@ -1,10 +1,10 @@
package com.mogo.eagle.core.function.obu.mogo.receiver
package com.mogo.eagle.core.function.datacenter.obu.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
//import com.mogo.eagle.core.function.obu.mogo.MogoObuConst
//import com.mogo.eagle.core.function.obu.mogo.MogoPrivateObuManager
//import com.mogo.eagle.core.function.datacenter.obu.MogoPrivateObuManager
//import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
//import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
//import com.zhidao.support.obu.model.CvxHvInfoIndInfo

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.core.function.obu.mogo.utils
package com.mogo.eagle.core.function.datacenter.obu.utils
import android.util.Log
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger

View File

@@ -5,6 +5,7 @@ import android.content.Context
import android.view.View
import android.view.ViewGroup
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.EnvConfig
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.deva.chain.ChainLogParam
@@ -13,6 +14,7 @@ import com.mogo.eagle.core.data.deva.scene.SceneTAG
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.function.api.devatools.IDevaToolsProvider
import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager
import com.zhjt.mogo_core_function_devatools.env.EnvChangeManager
import com.zhjt.mogo_core_function_devatools.binding.BindingCarManager.Companion.bindingCarManager
import com.zhjt.mogo_core_function_devatools.funcconfig.FuncConfigCenter.Companion.bizConfigCenter
import com.zhjt.mogo_core_function_devatools.funcconfig.FuncConfigImpl
@@ -142,6 +144,10 @@ class DevaToolsProvider : IDevaToolsProvider {
traceManager.syncConfig()
}
override fun getEnvConfig(): EnvConfig? {
return EnvChangeManager.getEnvConfig()
}
override fun modifyCarInfo(callBack: (ModifyBindingcarInfo) -> Unit) {
bindingCarManager.modifyCarInfo(callBack)
}

View File

@@ -4,6 +4,7 @@ import android.content.Context.MODE_PRIVATE
import android.os.Process
import com.mogo.commons.constants.*
import com.mogo.commons.debug.*
import com.mogo.eagle.core.data.EnvConfig
import com.mogo.eagle.core.function.call.map.*
import com.mogo.eagle.core.utilcode.mogo.storage.*
import com.mogo.eagle.core.utilcode.util.*
@@ -47,6 +48,11 @@ object EnvChangeManager {
}
}
fun getConfigNetMode(): Int {
val cache = getConfig()
return cache?.second ?: -1
}
fun getNetMode(): String {
val cache = getConfig()
return if (cache == null) {
@@ -88,6 +94,4 @@ object EnvChangeManager {
if (it.first == "010") 116.397446 else 112.582654,
if (it.first == "010") 39.909004 else 26.816478)
}
data class EnvConfig(val cityCode: String, val netMode: Int, val lat: Double, val lon: Double)
}

View File

@@ -69,11 +69,10 @@ dependencies {
// debugImplementation rootProject.ext.dependencies.debugleakcanary
// releaseImplementation rootProject.ext.dependencies.releaseleakcanary
implementation rootProject.ext.dependencies.mogoobu
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.mogoami
implementation rootProject.ext.dependencies.android_start_up
implementation rootProject.ext.dependencies.cicle_indicator
implementation rootProject.ext.dependencies.koomnative
@@ -88,7 +87,6 @@ dependencies {
api rootProject.ext.dependencies.mogo_core_data
api rootProject.ext.dependencies.mogo_core_utils
api rootProject.ext.dependencies.mogo_core_network
api rootProject.ext.dependencies.mogo_core_function_obu_mogo
api rootProject.ext.dependencies.mogo_core_function_map
api rootProject.ext.dependencies.mogo_core_function_v2x
api rootProject.ext.dependencies.mogo_core_function_devatools
@@ -104,14 +102,12 @@ dependencies {
api project(':core:mogo-core-res')
api project(':core:mogo-core-data')
api project(':core:mogo-core-utils')
api project(':core:function-impl:mogo-core-function-obu-mogo')
api project(':core:function-impl:mogo-core-function-map')
api project(':core:function-impl:mogo-core-function-v2x')
api project(':core:function-impl:mogo-core-function-devatools')
api project(':core:function-impl:mogo-core-function-chat')
api project(':core:function-impl:mogo-core-function-datacenter')
api project(':core:function-impl:mogo-core-function-biz')
api project(':core:mogo-core-function-call')
api project(':libraries:mogo-adas')
api project(':libraries:map-usbcamera')

View File

@@ -3,7 +3,11 @@ package com.mogo.eagle.core.function.hmi.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import android.view.View
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.LimitingVelocityView_TAG
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerViewLimitingVelocityListenerManager
import com.mogo.eagle.core.function.hmi.WaringConst
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
@@ -57,13 +61,13 @@ class V2XLimitingVelocityBroadcastReceiver : BroadcastReceiver() {
* @param limitingVelocitySpeed 限速速度
*/
private fun dispatchShowWaring(limitingVelocitySpeed: Int) {
CallerHmiManager.showLimitingVelocity(limitingVelocitySpeed, 1)
CallerViewLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(limitingVelocitySpeed,DataSourceType.MAP)
}
/**
* 关闭限速标志
*/
private fun dispatchCloseWaring() {
CallerHmiManager.disableLimitingVelocity()
CallerHmiViewControlListenerManager.invokeVisible(LimitingVelocityView_TAG, View.GONE)
}
}

View File

@@ -4,15 +4,17 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.hmi.WaringConst
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.v2x.CallerViewLimitingVelocityListenerManager
/**
* V2X 预警广播接收。用于跨应用,跨进程,内部也可以通过这种方式弹出预警提示框
@@ -75,8 +77,8 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() {
ttsContent: String?,
tag: String?
) {
if (EventTypeEnum.TYPE_USECASE_ID_IVP.poiType == v2xType.toString()) {
CallerHmiManager.showLimitingVelocity(1, 1)
if (EventTypeEnumNew.TYPE_USECASE_ID_IVP_RED.poiType == v2xType.toString()) {
CallerViewLimitingVelocityListenerManager.invokeOnLimitingVelocityChange(1,DataSourceType.MAP)
}
if (alertContent.isNullOrEmpty() || ttsContent.isNullOrEmpty()) {
Log.d("MsgBox-V2XWarningBR", "alertContent或ttsContent为空!")

View File

@@ -1,9 +1,8 @@
package com.mogo.eagle.core.function.hmi.ui
import android.content.Context
import android.os.Bundle
import android.text.TextUtils
import android.util.*
import android.util.Log
import android.view.View
import android.view.ViewGroup
import android.view.animation.AlphaAnimation
@@ -24,38 +23,23 @@ import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_RTS
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2I
import com.mogo.eagle.core.data.dispatch.DispatchAdasAutoPilotLocReceiverBean
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.map.Infrastructure
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.RecordBagMsg
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
import com.mogo.eagle.core.data.report.ReportEntity
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.api.hmi.IMoGoHmiViewProxy
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.AutoPilotStatusView_TAG
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.CameraView_TAG
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.PerspectiveSwitchView_TAG
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.SpeedPanelView_TAG
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.ToolsView_TAG
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.TrafficLightView_TAG
import com.mogo.eagle.core.function.api.hmi.view.IViewLimitingVelocity
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoHmiProvider
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.function.call.biz.CallerFuncBizManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Turning
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.notification.WarningFloat
import com.mogo.eagle.core.function.hmi.ui.bindingcar.ModifyBindingCarDialog
@@ -67,10 +51,10 @@ import com.mogo.eagle.core.function.hmi.ui.notice.NoticeCheckDialog
import com.mogo.eagle.core.function.hmi.ui.notice.traffic.NoticeTrafficDialog
import com.mogo.eagle.core.function.hmi.ui.setting.CameraLiveView.Companion.cameraLiveView
import com.mogo.eagle.core.function.hmi.ui.setting.IPCReportWindow
import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView.Companion.toggleDebugView
import com.mogo.eagle.core.function.hmi.ui.setting.ToolsView.Companion.toolsView
import com.mogo.eagle.core.function.hmi.ui.tools.AdUpgradeDialog
import com.mogo.eagle.core.function.hmi.ui.widget.*
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView
import com.mogo.eagle.core.function.main.DisplayEffectsHelper
import com.mogo.eagle.core.utilcode.kotlin.safeCancel
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
@@ -78,17 +62,12 @@ 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_HMI
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.eagle.core.utilcode.reminder.api.IReminder
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils.millis2String
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import com.zhjt.service_biz.BizConfig
import kotlinx.android.synthetic.main.fragment_hmi.*
import kotlinx.coroutines.*
import record_cache.RecordPanelOuterClass
import java.util.concurrent.atomic.AtomicReference
/**
@@ -100,7 +79,7 @@ import java.util.concurrent.atomic.AtomicReference
class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
IMoGoHmiProvider,
IMoGoHmiViewProxy,
MoGoHmiContract.View{
MoGoHmiContract.View {
companion object {
private const val TAG = "MoGoHmiFragment"
@@ -110,9 +89,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
// todo 需要统一数据源 红绿灯 View代理
private var mViewTrafficLight: IViewTrafficLight? = null
// todo 需要统一数据源 限速 View代理
private var mViewLimitingVelocity: IViewLimitingVelocity? = null
private val lastSpeakJob by lazy { AtomicReference<Job>() }
private var lastShowV2XJob: Job? = null
@@ -120,73 +96,16 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
override fun initViews() {
//设置StatusBar初始状态
CallerHmiViewControlListenerManager.updateStatusBarRightView(StatusBarView.TAG,FunctionBuildConfig.isDemoMode, "demoMode", DemoModeView(requireContext()))
//todo 新超,封装至消息盒子
cbMsgBoxDriver.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
viewDriverMsgBoxList.visibility = View.VISIBLE
viewDriverMsgBoxList.notifyData()
viewDriverMsgBoxBubble.visibility = View.GONE
viewDriverMsgBoxBubble.isShowData(false)
CallerHmiManager.updateDriverMsgBoxTipView(false)
} else {
viewDriverMsgBoxList.visibility = View.GONE
viewDriverMsgBoxBubble.visibility = View.VISIBLE
viewDriverMsgBoxBubble.isShowData(true)
}
}
//todo 新超,封装至消息盒子
cbMsgBoxPassenger.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
viewPassengerMsgBoxList.visibility = View.VISIBLE
viewPassengerMsgBoxBubble.visibility = View.GONE
viewPassengerMsgBoxBubble.isShowData(false)
CallerHmiManager.updatePassengerMsgBoxTipView(false)
} else {
viewPassengerMsgBoxList.visibility = View.GONE
viewPassengerMsgBoxBubble.visibility = View.VISIBLE
viewPassengerMsgBoxBubble.isShowData(true)
}
}
//todo 加载端自己控制 --- 新超 本期我们设置到bustaxisweep Fragment
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
cbMsgBoxDriver.visibility = View.VISIBLE
viewDriverMsgBoxBubble.visibility = View.VISIBLE
}
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) &&
AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)
) {
cbMsgBoxPassenger.visibility = View.VISIBLE
viewPassengerMsgBoxBubble.visibility = View.VISIBLE
}
}
// todo 新超
override fun updateDriverMsgBoxTipView(show: Boolean) {
if (show) {
MsgBoxTipView.visibility = View.VISIBLE
} else {
MsgBoxTipView.visibility = View.GONE
}
}
// todo 新超
override fun updatePassengerMsgBoxTipView(show: Boolean) {
if (show) {
MsgBoxPTipView.visibility = View.VISIBLE
} else {
MsgBoxPTipView.visibility = View.GONE
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
//todo 确认使用方 taxi bus 乘客/司机
setProxyLimitingSpeedView(viewLimitingVelocity)
}
/** todo ----------------------------------------------**/
@@ -197,13 +116,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
mViewTrafficLight = view
}
/**
* 设置 限速 代理View
*/
override fun setProxyLimitingSpeedView(view: IViewLimitingVelocity) {
mViewLimitingVelocity = view
}
/**
* ok
* 工控机重启返回结果
@@ -249,23 +161,38 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
}
override fun setStatusBarDarkOrLight(light: Boolean) {
CallerHmiViewControlListenerManager.setStatusBarDarkOrLight(StatusBarView.TAG,light)
CallerHmiViewControlListenerManager.setStatusBarDarkOrLight(StatusBarView.TAG, light)
}
override fun updateStatusBarRightView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
CallerHmiViewControlListenerManager.updateStatusBarRightView(StatusBarView.TAG,insert, tag, viewGroup)
CallerHmiViewControlListenerManager.updateStatusBarRightView(
StatusBarView.TAG,
insert,
tag,
viewGroup
)
}
override fun updateStatusBarLeftView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
CallerHmiViewControlListenerManager.updateStatusBarLeftView(StatusBarView.TAG,insert, tag, viewGroup)
CallerHmiViewControlListenerManager.updateStatusBarLeftView(
StatusBarView.TAG,
insert,
tag,
viewGroup
)
}
override fun updateStatusBarDownloadView(insert: Boolean, tag: String, progress: Int) {
CallerHmiViewControlListenerManager.updateStatusBarDownloadView(StatusBarView.TAG,insert, tag, progress)
CallerHmiViewControlListenerManager.updateStatusBarDownloadView(
StatusBarView.TAG,
insert,
tag,
progress
)
}
override fun updateMfStatus(tag: String, status: Boolean) {
CallerHmiViewControlListenerManager.updateMfStatus(StatusBarView.TAG,tag, status)
CallerHmiViewControlListenerManager.updateMfStatus(StatusBarView.TAG, tag, status)
}
override fun getLayoutId(): Int {
@@ -284,30 +211,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
DisplayEffectsHelper.getInstance().display()
}
override fun setTrafficLightVrVisibility(visibility: Int) {
CallerHmiViewControlListenerManager.invokeVisible(TrafficLightView_TAG,visibility)
}
override fun setToolsViewVisibility(visibility: Int) {
CallerHmiViewControlListenerManager.invokeVisible(ToolsView_TAG,visibility)
}
override fun setSpeedChartViewVisibility(visibility: Int) {
CallerHmiViewControlListenerManager.invokeVisible(SpeedPanelView_TAG,visibility)
}
override fun setAutopilotStatusViewVisibility(visibility: Int) {
CallerHmiViewControlListenerManager.invokeVisible(AutoPilotStatusView_TAG,visibility)
}
override fun setPerspectiveSwitchViewVisibility(visibility: Int) {
CallerHmiViewControlListenerManager.invokeVisible(PerspectiveSwitchView_TAG,visibility)
}
override fun setCameraViewVisibility(visibility: Int) {
CallerHmiViewControlListenerManager.invokeVisible(CameraView_TAG, visibility)
}
/** todo----------------------------------------------- **/
/**
* 不展示顶部弹窗,其它保留
@@ -326,7 +229,7 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
playTts && !AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
activity?.let {
val warningContent = alertContent
?: EventTypeEnum.getWarningContent(v2xType)
?: EventTypeEnumNew.getWarningContent(v2xType)
//占道施工预警
if (v2xType == "10006" || v2xType == "100061") {
@@ -364,7 +267,7 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
if (ttsContent != null && !TextUtils.isEmpty(ttsContent) && playTTS) {
val last = lastSpeakJob.get()
Log.d("CODE", "---- 0 ------: last: $last")
if (last != null && !last.isCompleted) {
if (last != null && !last.isCompleted) {
Log.d("CODE", "---- 1 ------")
return
}
@@ -465,40 +368,6 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
mViewTrafficLight?.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
}
/**
* 控制展示限速标志及内容
*/
override fun showLimitingVelocity(limitingSpeed: Int, limitSpeedSource: Int) {
// 控制 限速UI 展示
if (HmiBuildConfig.isShowLimitingVelocityView) {
if (limitingSpeed > 0) {
mViewLimitingVelocity?.visibility = View.VISIBLE
mViewLimitingVelocity?.updateLimitingSpeed(limitingSpeed, limitSpeedSource)
tvLimitingSource?.visibility = View.VISIBLE
if (limitSpeedSource == 1) {
tvLimitingSource.text = "MAP"
} else if (limitSpeedSource == 2) {
tvLimitingSource.text = "RSU"
}
} else {
mViewLimitingVelocity?.visibility = View.INVISIBLE
mViewLimitingVelocity?.updateLimitingSpeed(0, limitSpeedSource)
tvLimitingSource?.visibility = View.INVISIBLE
}
} else {
disableLimitingVelocity()
tvLimitingSource?.visibility = View.GONE
}
}
/**
* 控制关闭限速标志及内容
*/
override fun disableLimitingVelocity() {
mViewLimitingVelocity?.visibility = View.GONE
mViewLimitingVelocity?.updateLimitingSpeed(0, 1)
}
/**
* 展示指定方位上的红框预警
* @param direction

View File

@@ -0,0 +1,33 @@
package com.mogo.eagle.core.function.hmi.ui.msgbox
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.hmi.R
/**
* @author XuXinChao
* @description 消息盒子司机端视图切换按钮
* @since: 2023/1/31
*/
class DriverMsgBoxButtonView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
):ConstraintLayout(context, attrs, defStyleAttr) {
companion object {
const val TAG = "DriverMsgBoxButtonView"
}
init{
LayoutInflater.from(context).inflate(R.layout.view_driver_msg_box_button, this, true)
initView()
}
private fun initView(){
}
}

View File

@@ -171,13 +171,21 @@ class DriverMsgBoxListView @JvmOverloads constructor(
when (category) {
MsgCategory.NOTICE -> {
noticeList?.add(0,msgBoxList)
if(MsgBoxConfig.getUserRecord() == 0){
noticeList?.let { driverMsgBoxListAdapter?.setData(it) }
}
}
MsgCategory.SYS_INFO -> {
ipcReportList?.add(0,msgBoxList)
if(MsgBoxConfig.getUserRecord() == 1){
ipcReportList?.let { driverMsgBoxListAdapter?.setData(it) }
}
}
MsgCategory.RECORD_BAG -> {
badCaseList?.add(0,msgBoxList)
badCaseList?.let { driverMsgBoxListAdapter?.setData(it) }
if(MsgBoxConfig.getUserRecord() == 2){
badCaseList?.let { driverMsgBoxListAdapter?.setData(it) }
}
}
}
}

View File

@@ -0,0 +1,33 @@
package com.mogo.eagle.core.function.hmi.ui.msgbox
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.hmi.R
/**
* @author XuXinChao
* @description 消息盒子乘客端视图切换按钮
* @since: 2023/1/31
*/
class PassengerMsgBoxButtonView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
): ConstraintLayout(context, attrs, defStyleAttr) {
companion object {
const val TAG = "PassengerMsgBoxButtonView"
}
init{
LayoutInflater.from(context).inflate(R.layout.view_passenger_msg_box_button, this, true)
initView()
}
private fun initView(){
}
}

View File

@@ -8,7 +8,7 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.data.report.ReportEntity
@@ -34,6 +34,7 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
private val notice: Int = 2
private val v2x: Int = 3
private val report: Int = 4
private val summary: Int = 5
var countDownTimer: CountDownTimer?=null
private var changeViewListener: ChangeViewListener?=null
@@ -47,89 +48,105 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
if(viewType == operation){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_operation,parent,false)
return BubbleOperationHolder(view)
}else if(viewType == report){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_report,parent,false)
return BubbleReportHolder(view)
}else if(viewType == notice){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_notice,parent,false)
return BubbleNoticeHolder(view)
}else{
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_v2x,parent,false)
return BubbleV2XHolder(view)
when (viewType) {
operation -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_operation,parent,false)
return BubbleOperationHolder(view)
}
report -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_report,parent,false)
return BubbleReportHolder(view)
}
notice -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_notice,parent,false)
return BubbleNoticeHolder(view)
}
summary -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_summary,parent,false)
return BubbleSummaryHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_bubble_v2x,parent,false)
return BubbleV2XHolder(view)
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if(holder is BubbleOperationHolder){
data?.let {
val operationMsg = it[position].bean as OperationMsg
holder.tvBubbleOperationTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvBubbleOperationContent.text = operationMsg.content
}
}else if(holder is BubbleReportHolder){
data?.let {
val reportEntity = it[position].bean as ReportEntity
holder.tvBubbleReportTime.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvBubbleReceiveTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
var resultStr = "类型:"
for (result in reportEntity.resultList){
resultStr = "${resultStr}${CallerAutoPilotManager.getReportResultDesc(result)}"
when (holder) {
is BubbleOperationHolder -> {
data?.let {
val operationMsg = it[position].bean as OperationMsg
holder.tvBubbleOperationTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvBubbleOperationContent.text = operationMsg.content
}
holder.tvBubbleReportType.text = resultStr
}
}else if(holder is BubbleNoticeHolder){
data?.let {
val msgBoxBean = it[position].bean
val noticeFrCloudMsg = msgBoxBean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
if (noticeNormalData != null) {
CallerHmiManager.showNoticeNormalData(noticeNormalData)
}
is BubbleReportHolder -> {
data?.let {
val reportEntity = it[position].bean as ReportEntity
holder.tvBubbleReportTime.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvBubbleReceiveTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
var resultStr = "类型:"
for (result in reportEntity.resultList){
resultStr = "${resultStr}${CallerAutoPilotManager.getReportResultDesc(result)}"
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
if (noticeTrafficStylePushData != null) {
CallerHmiManager.showTrafficBanner(noticeTrafficStylePushData)
holder.tvBubbleReportType.text = resultStr
}
}
is BubbleNoticeHolder -> {
data?.let {
val msgBoxBean = it[position].bean
val noticeFrCloudMsg = msgBoxBean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
if (noticeNormalData != null) {
CallerHmiManager.showNoticeNormalData(noticeNormalData)
}
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
if (noticeTrafficStylePushData != null) {
CallerHmiManager.showTrafficBanner(noticeTrafficStylePushData)
}
}
}
}
}
}else if(holder is BubbleV2XHolder){
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvV2XContent.text = v2XMsg.content
if(msgBoxBean.type == MsgBoxType.OBU){
is BubbleV2XHolder -> {
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvV2XContent.text = v2XMsg.content
holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}else{
holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnum.getUpdateIconRes(v2XMsg.type)))
}
}
is BubbleSummaryHolder -> {
data?.let {
val summaryMsg = it[position].bean as V2XMsg
holder.tvSummaryTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvSummaryContent.text = summaryMsg.content
}
}
}
@@ -156,14 +173,16 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
if(data!![position].type == MsgBoxType.OPERATION){
return operation
return if(data!![position].type == MsgBoxType.OPERATION){
operation
}else if(data!![position].type == MsgBoxType.REPORT){
return report
report
}else if(data!![position].type == MsgBoxType.NOTICE){
return notice
}else{
return v2x
notice
}else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){
summary
} else{
v2x
}
}
@@ -196,6 +215,12 @@ class DriverMsgBoxBubbleAdapter(private val activity: Activity) : RecyclerView.A
var tvV2XContent: TextView = itemView.findViewById(R.id.tvV2XContent)
}
//汇总消息
class BubbleSummaryHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvSummaryContent: TextView = itemView.findViewById(R.id.tvSummaryContent)
var tvSummaryTime: TextView = itemView.findViewById(R.id.tvSummaryTime)
}
fun setChangeListener(listener: ChangeViewListener){
changeViewListener = listener
}

View File

@@ -9,7 +9,7 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.data.report.ReportEntity
@@ -28,198 +28,263 @@ import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat
* @description 司机端消息盒子列表视图RecyclerView适配器
* @since: 2022/11/25
*/
class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Adapter<RecyclerView.ViewHolder>(){
class DriverMsgBoxListAdapter(private val activity: Activity) :
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private var data: List<MsgBoxBean> ?= null
private var data: List<MsgBoxBean>? = null
private val operation: Int = 1
private val notice: Int = 2
private val v2x: Int = 3
private val obu: Int = 4
private val report: Int = 5
private val record: Int = 6
private val traffic: Int = 7
private val summary: Int = 8
//Error
val RESULT_AUTOPILOT_DISABLE = "RESULT_AUTOPILOT_DISABLE"
val RESULT_AUTOPILOT_SYSTEM_UNSTARTED = "RESULT_AUTOPILOT_SYSTEM_UNSTARTED"
val RESULT_REMOTEPILOT_DISABLE = "RESULT_REMOTEPILOT_DISABLE"
fun setData(data: List<MsgBoxBean>){
fun setData(data: List<MsgBoxBean>) {
this.data = data
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
if(viewType == record){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_bad_case,parent,false)
return BadCaseHolder(view)
}else if(viewType == report){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_box_ipc_report,parent,false)
return MsgBoxIpcReportHolder(view)
}else if(viewType == operation){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_box_operation,parent,false)
return MsgBoxOperation(view)
}else if(viewType == notice){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_box_notice,parent,false)
return MsgBoxNotice(view)
}else{
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_msg_box_v2x,parent,false)
return MsgBoxV2X(view)
when (viewType) {
record -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_bad_case, parent, false)
return BadCaseHolder(view)
}
report -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_ipc_report, parent, false)
return MsgBoxIpcReportHolder(view)
}
operation -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_operation, parent, false)
return MsgBoxOperation(view)
}
notice -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_notice, parent, false)
return MsgBoxNotice(view)
}
summary -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_summary, parent, false)
return MsgBoxSummary(view)
}
else -> {
val view = LayoutInflater.from(parent.context)
.inflate(R.layout.item_msg_box_v2x, parent, false)
return MsgBoxV2X(view)
}
}
}
@SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if(holder is BadCaseHolder){
data?.let {
holder.tvBagReceiveTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvBagRecordTime.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
val msgBoxBean = it[position]
holder.tvRecordCheck.setOnClickListener {
//打开被动录包弹窗
CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean,activity,false)
}
}
}else if(holder is MsgBoxIpcReportHolder){
data?.let { it ->
holder.tvReportTimeNormal.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTimeOpen.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
val reportEntity = (it[position].bean as ReportEntity)
if(reportEntity.resultList.contains(RESULT_AUTOPILOT_DISABLE)
|| reportEntity.resultList.contains(RESULT_AUTOPILOT_SYSTEM_UNSTARTED)
|| reportEntity.resultList.contains(RESULT_REMOTEPILOT_DISABLE)){
//Error
holder.ivReportImageNormal.setImageDrawable(getDrawable(R.drawable.icon_report_error_normal))
holder.ivReportImageOpen.setImageDrawable(getDrawable(R.drawable.icon_report_error_open))
holder.tvReportLevelNormal.text = "Error"
holder.tvReportLevelOpen.text = "Error"
}else{
//Warning
holder.ivReportImageNormal.setImageDrawable(getDrawable(R.drawable.icon_report_warning_normal))
holder.ivReportImageOpen.setImageDrawable(getDrawable(R.drawable.icon_report_warning_open))
holder.tvReportLevelNormal.text = "Warning"
holder.tvReportLevelOpen.text = "Warning"
}
holder.tvReportTimeNormal.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTimeOpen.text = "时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTime.text =TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
var resultStr = "类型:"
for (result in reportEntity.resultList){
resultStr = "${resultStr}${CallerAutoPilotManager.getReportResultDesc(result)}"
}
holder.tvReportTypeNormal.text = resultStr
holder.tvReportTypeOpen.text = resultStr
holder.tvReportReasonOpen.text = "原因:${reportEntity.msg}"
var actionStr = ""
for (action in reportEntity.actionsList){
actionStr = "${actionStr}${CallerAutoPilotManager.getReportActionDesc(action)}"
}
holder.tvReportActionOpen.text = "建议操作:$actionStr"
holder.tvStatusSelect.setOnClickListener {
if(holder.tvReportLevelNormal.isVisible){
holder.tvStatusSelect.setCompoundDrawablesWithIntrinsicBounds(getDrawable(R.drawable.icon_msg_close),null,null,null)
holder.ivReportImageNormal.visibility = View.GONE
holder.tvReportLevelNormal.visibility = View.GONE
holder.tvReportTimeNormal.visibility = View.GONE
holder.tvReportTypeNormal.visibility = View.GONE
holder.ivReportImageOpen.visibility = View.VISIBLE
holder.tvReportLevelOpen.visibility = View.VISIBLE
holder.tvReportTimeOpen.visibility = View.VISIBLE
holder.tvReportTypeOpen.visibility = View.VISIBLE
holder.tvReportReasonOpen.visibility = View.VISIBLE
holder.tvReportActionOpen.visibility = View.VISIBLE
}else{
holder.tvStatusSelect.setCompoundDrawablesWithIntrinsicBounds(getDrawable(R.drawable.icon_msg_open),null,null,null)
holder.ivReportImageNormal.visibility = View.VISIBLE
holder.tvReportLevelNormal.visibility = View.VISIBLE
holder.tvReportTimeNormal.visibility = View.VISIBLE
holder.tvReportTypeNormal.visibility = View.VISIBLE
holder.ivReportImageOpen.visibility = View.GONE
holder.tvReportLevelOpen.visibility = View.GONE
holder.tvReportTimeOpen.visibility = View.GONE
holder.tvReportTypeOpen.visibility = View.GONE
holder.tvReportReasonOpen.visibility = View.GONE
holder.tvReportActionOpen.visibility = View.GONE
when (holder) {
is BadCaseHolder -> {
data?.let {
holder.tvBagReceiveTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
holder.tvBagRecordTime.text =
"时间:${TimeUtils.millis2String(it[position].timestamp)}"
val msgBoxBean = it[position]
holder.tvRecordCheck.setOnClickListener {
//打开被动录包弹窗
CallerDevaToolsManager.onReceiveBadCaseRecord(msgBoxBean, activity, false)
}
}
}
}else if(holder is MsgBoxOperation){
data?.let {
val operationMsg = it[position].bean as OperationMsg
holder.tvOperationContentNormal.text = operationMsg.content
holder.tvOperationContentOpen.text = operationMsg.content
holder.tvOperationTime.text = TimeUtils.millis2String(operationMsg.timestamp,getHourMinFormat())
holder.tvOperationStatusSelect.setOnClickListener {
if(holder.ivOperationImageNormal.isVisible){
holder.tvOperationStatusSelect.setCompoundDrawablesWithIntrinsicBounds(getDrawable(R.drawable.icon_msg_close),null,null,null)
holder.ivOperationImageNormal.visibility = View.GONE
holder.tvOperationTitleNormal.visibility = View.GONE
holder.tvOperationContentNormal.visibility = View.GONE
is MsgBoxIpcReportHolder -> {
data?.let { it ->
holder.tvReportTimeNormal.text =
"时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTimeOpen.text =
"时间:${TimeUtils.millis2String(it[position].timestamp)}"
val reportEntity = (it[position].bean as ReportEntity)
if (reportEntity.resultList.contains(RESULT_AUTOPILOT_DISABLE)
|| reportEntity.resultList.contains(RESULT_AUTOPILOT_SYSTEM_UNSTARTED)
|| reportEntity.resultList.contains(RESULT_REMOTEPILOT_DISABLE)
) {
//Error
holder.ivReportImageNormal.setImageDrawable(getDrawable(R.drawable.icon_report_error_normal))
holder.ivReportImageOpen.setImageDrawable(getDrawable(R.drawable.icon_report_error_open))
holder.tvReportLevelNormal.text = "Error"
holder.tvReportLevelOpen.text = "Error"
} else {
//Warning
holder.ivReportImageNormal.setImageDrawable(getDrawable(R.drawable.icon_report_warning_normal))
holder.ivReportImageOpen.setImageDrawable(getDrawable(R.drawable.icon_report_warning_open))
holder.tvReportLevelNormal.text = "Warning"
holder.tvReportLevelOpen.text = "Warning"
}
holder.tvReportTimeNormal.text =
"时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTimeOpen.text =
"时间:${TimeUtils.millis2String(it[position].timestamp)}"
holder.tvReportTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
var resultStr = "类型:"
for (result in reportEntity.resultList) {
resultStr =
"${resultStr}${CallerAutoPilotManager.getReportResultDesc(result)}"
}
holder.tvReportTypeNormal.text = resultStr
holder.tvReportTypeOpen.text = resultStr
holder.tvReportReasonOpen.text = "原因:${reportEntity.msg}"
var actionStr = ""
for (action in reportEntity.actionsList) {
actionStr =
"${actionStr}${CallerAutoPilotManager.getReportActionDesc(action)}"
}
holder.tvReportActionOpen.text = "建议操作:$actionStr"
holder.tvStatusSelect.setOnClickListener {
if (holder.tvReportLevelNormal.isVisible) {
holder.tvStatusSelect.setCompoundDrawablesWithIntrinsicBounds(
getDrawable(R.drawable.icon_msg_close),
null,
null,
null
)
holder.ivReportImageNormal.visibility = View.GONE
holder.tvReportLevelNormal.visibility = View.GONE
holder.tvReportTimeNormal.visibility = View.GONE
holder.tvReportTypeNormal.visibility = View.GONE
holder.ivOperationImageOpen.visibility = View.VISIBLE
holder.tvOperationTitleOpen.visibility = View.VISIBLE
holder.tvOperationContentOpen.visibility = View.VISIBLE
}else{
holder.tvOperationStatusSelect.setCompoundDrawablesWithIntrinsicBounds(getDrawable(R.drawable.icon_msg_open),null,null,null)
holder.ivOperationImageNormal.visibility = View.VISIBLE
holder.tvOperationTitleNormal.visibility = View.VISIBLE
holder.tvOperationContentNormal.visibility = View.VISIBLE
holder.ivReportImageOpen.visibility = View.VISIBLE
holder.tvReportLevelOpen.visibility = View.VISIBLE
holder.tvReportTimeOpen.visibility = View.VISIBLE
holder.tvReportTypeOpen.visibility = View.VISIBLE
holder.tvReportReasonOpen.visibility = View.VISIBLE
holder.tvReportActionOpen.visibility = View.VISIBLE
} else {
holder.tvStatusSelect.setCompoundDrawablesWithIntrinsicBounds(
getDrawable(R.drawable.icon_msg_open),
null,
null,
null
)
holder.ivReportImageNormal.visibility = View.VISIBLE
holder.tvReportLevelNormal.visibility = View.VISIBLE
holder.tvReportTimeNormal.visibility = View.VISIBLE
holder.tvReportTypeNormal.visibility = View.VISIBLE
holder.ivOperationImageOpen.visibility = View.GONE
holder.tvOperationTitleOpen.visibility = View.GONE
holder.tvOperationContentOpen.visibility = View.GONE
holder.ivReportImageOpen.visibility = View.GONE
holder.tvReportLevelOpen.visibility = View.GONE
holder.tvReportTimeOpen.visibility = View.GONE
holder.tvReportTypeOpen.visibility = View.GONE
holder.tvReportReasonOpen.visibility = View.GONE
holder.tvReportActionOpen.visibility = View.GONE
}
}
}
}
}else if(holder is MsgBoxNotice){
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) }
is MsgBoxOperation -> {
data?.let {
val operationMsg = it[position].bean as OperationMsg
holder.tvOperationContentNormal.text = operationMsg.content
holder.tvOperationContentOpen.text = operationMsg.content
holder.tvOperationTime.text =
TimeUtils.millis2String(operationMsg.timestamp, getHourMinFormat())
holder.tvOperationStatusSelect.setOnClickListener {
if (holder.ivOperationImageNormal.isVisible) {
holder.tvOperationStatusSelect.setCompoundDrawablesWithIntrinsicBounds(
getDrawable(R.drawable.icon_msg_close),
null,
null,
null
)
holder.ivOperationImageNormal.visibility = View.GONE
holder.tvOperationTitleNormal.visibility = View.GONE
holder.tvOperationContentNormal.visibility = View.GONE
holder.ivOperationImageOpen.visibility = View.VISIBLE
holder.tvOperationTitleOpen.visibility = View.VISIBLE
holder.tvOperationContentOpen.visibility = View.VISIBLE
} else {
holder.tvOperationStatusSelect.setCompoundDrawablesWithIntrinsicBounds(
getDrawable(R.drawable.icon_msg_open),
null,
null,
null
)
holder.ivOperationImageNormal.visibility = View.VISIBLE
holder.tvOperationTitleNormal.visibility = View.VISIBLE
holder.tvOperationContentNormal.visibility = View.VISIBLE
holder.ivOperationImageOpen.visibility = View.GONE
holder.tvOperationTitleOpen.visibility = View.GONE
holder.tvOperationContentOpen.visibility = View.GONE
}
}
}
}
}else if(holder is MsgBoxV2X){
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvV2XContent.text = v2XMsg.content
if(msgBoxBean.type == MsgBoxType.OBU){
is MsgBoxNotice -> {
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if (noticeFrCloudMsg.type == 0) {
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvNoticeTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
holder.tvNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
}
} else if (noticeFrCloudMsg.type == 1) {
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvNoticeTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
holder.tvNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl)
.optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivNoticeImage)
holder.tvNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 ->
CallerHmiManager.showTrafficBanner(
it1
)
}
}
}
}
}
is MsgBoxV2X -> {
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvV2XTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
holder.tvV2XContent.text = v2XMsg.content
holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}else{
holder.ivV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnum.getUpdateIconRes(v2XMsg.type)))
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))
)
}
}
is MsgBoxSummary -> {
data?.let {
val summaryMsg = it[position].bean as V2XMsg
holder.tvSummaryTime.text =
TimeUtils.millis2String(it[position].timestamp, getHourMinFormat())
holder.tvSummaryContent.text = summaryMsg.content
}
}
}
@@ -229,26 +294,30 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Ada
override fun getItemViewType(position: Int): Int {
return when(data!![position].type){
MsgBoxType.OPERATION -> operation
MsgBoxType.NOTICE -> notice
MsgBoxType.V2X -> v2x
MsgBoxType.OBU -> obu
MsgBoxType.REPORT -> report
MsgBoxType.RECORD -> record
MsgBoxType.TRAFFIC -> traffic
}
return if (data!![position].type == MsgBoxType.OPERATION) {
operation
} else if (data!![position].type == MsgBoxType.NOTICE) {
notice
} else if (data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY) {
summary
} else if (data!![position].type == MsgBoxType.REPORT) {
report
} else if (data!![position].type == MsgBoxType.RECORD) {
record
} else {
v2x
}
}
//录包实体
class BadCaseHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvBagRecordTime: TextView= itemView.findViewById(R.id.tvBagRecordTime)
class BadCaseHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var tvBagRecordTime: TextView = itemView.findViewById(R.id.tvBagRecordTime)
var tvBagReceiveTime: TextView = itemView.findViewById(R.id.tvBagReceiveTime)
var tvRecordCheck: TextView = itemView.findViewById(R.id.tvRecordCheck)
}
//车辆系统信息
class MsgBoxIpcReportHolder(itemView: View): RecyclerView.ViewHolder(itemView){
class MsgBoxIpcReportHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var ivReportImageNormal: ImageView = itemView.findViewById(R.id.ivReportImageNormal)
var tvReportLevelNormal: TextView = itemView.findViewById(R.id.tvReportLevelNormal)
var tvReportTimeNormal: TextView = itemView.findViewById(R.id.tvReportTimeNormal)
@@ -264,10 +333,11 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Ada
}
//运营平台
class MsgBoxOperation(itemView: View): RecyclerView.ViewHolder(itemView){
class MsgBoxOperation(itemView: View) : RecyclerView.ViewHolder(itemView) {
var ivOperationImageNormal: ImageView = itemView.findViewById(R.id.ivOperationImageNormal)
var tvOperationTitleNormal: TextView = itemView.findViewById(R.id.tvOperationTitleNormal)
var tvOperationContentNormal: TextView = itemView.findViewById(R.id.tvOperationContentNormal)
var tvOperationContentNormal: TextView =
itemView.findViewById(R.id.tvOperationContentNormal)
var tvOperationStatusSelect: TextView = itemView.findViewById(R.id.tvOperationStatusSelect)
var tvOperationTime: TextView = itemView.findViewById(R.id.tvOperationTime)
var ivOperationImageOpen: ImageView = itemView.findViewById(R.id.ivOperationImageOpen)
@@ -276,7 +346,7 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Ada
}
//Notice
class MsgBoxNotice(itemView: View): RecyclerView.ViewHolder(itemView){
class MsgBoxNotice(itemView: View) : RecyclerView.ViewHolder(itemView) {
var ivNoticeImage: ImageView = itemView.findViewById(R.id.ivNoticeImage)
var tvNoticeTitle: TextView = itemView.findViewById(R.id.tvNoticeTitle)
var tvNoticeTime: TextView = itemView.findViewById(R.id.tvNoticeTime)
@@ -285,11 +355,17 @@ class DriverMsgBoxListAdapter(private val activity: Activity) : RecyclerView.Ada
}
//V2X,OBU
class MsgBoxV2X(itemView: View): RecyclerView.ViewHolder(itemView){
class MsgBoxV2X(itemView: View) : RecyclerView.ViewHolder(itemView) {
var ivV2XImage: ImageView = itemView.findViewById(R.id.ivV2XImage)
var tvV2XTime: TextView = itemView.findViewById(R.id.tvV2XTime)
var tvV2XContent: TextView = itemView.findViewById(R.id.tvV2XContent)
}
//汇总消息
class MsgBoxSummary(itemView: View) : RecyclerView.ViewHolder(itemView) {
var tvSummaryContent: TextView = itemView.findViewById(R.id.tvSummaryContent)
var tvSummaryTime: TextView = itemView.findViewById(R.id.tvSummaryTime)
}
}

View File

@@ -8,15 +8,12 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform
@@ -34,6 +31,7 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
private val notice: Int = 1
private val v2x: Int = 2
private val summary: Int = 3
var countDownTimer: CountDownTimer?=null
@@ -46,65 +44,83 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
if(viewType == notice){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_notice,parent,false)
return BubbleNoticeHolder(view)
}else{
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_v2x,parent,false)
return BubbleV2XHolder(view)
return when (viewType) {
notice -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_notice,parent,false)
BubbleNoticeHolder(view)
}
summary -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_summary,parent,false)
BubbleSummaryHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_box_v2x,parent,false)
BubbleV2XHolder(view)
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if(holder is BubbleNoticeHolder){
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
when (holder) {
is BubbleNoticeHolder -> {
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) }
}
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) }
}
}
}
}
}else if(holder is BubbleV2XHolder){
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvPassengerV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerV2XContent.text = v2XMsg.content
if(msgBoxBean.type == MsgBoxType.OBU){
is BubbleV2XHolder -> {
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvPassengerV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerV2XContent.text = v2XMsg.content
holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}else{
holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnum.getUpdateIconRes(v2XMsg.type)))
}
}
is BubbleSummaryHolder -> {
data?.let {
val summaryMsg= it[position].bean as V2XMsg
holder.tvPassengerSummaryTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerSummaryContent.text = summaryMsg.content
holder.tvPassengerSummaryCheck.setOnClickListener {
//跳转全览模式
// CallerHmiManager.showSmallFragment()
CallerMsgBoxEventListenerManager.invokeListener()
}
}
}
}
val msgBoxBean: MsgBoxBean = data!![position]
countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){
override fun onTick(p0: Long) {
@@ -125,10 +141,12 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
if(data!![position].type == MsgBoxType.NOTICE){
return notice
}else{
return v2x
return if(data!![position].type == MsgBoxType.NOTICE){
notice
}else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){
summary
} else{
v2x
}
}
@@ -148,4 +166,11 @@ class PassengerMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView
var tvPassengerV2XContent: TextView = itemView.findViewById(R.id.tvPassengerV2XContent)
}
//汇总消息
class BubbleSummaryHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvPassengerSummaryContent: TextView = itemView.findViewById(R.id.tvPassengerSummaryContent)
var tvPassengerSummaryCheck: TextView = itemView.findViewById(R.id.tvPassengerSummaryCheck)
var tvPassengerSummaryTime: TextView = itemView.findViewById(R.id.tvPassengerSummaryTime)
}
}

View File

@@ -7,14 +7,11 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.data.msgbox.*
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform
@@ -32,6 +29,7 @@ class PassengerMsgBoxListAdapter(private val activity: Activity): RecyclerView.A
private val notice: Int = 1
private val v2x: Int = 2
private val summary: Int = 3
fun setData(data: List<MsgBoxBean>){
this.data = data
@@ -39,61 +37,78 @@ class PassengerMsgBoxListAdapter(private val activity: Activity): RecyclerView.A
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return if(viewType == notice){
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_list_notice,parent,false)
ListNoticeHolder(view)
}else{
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_list_v2x,parent,false)
ListV2XHolder(view)
return when (viewType) {
notice -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_list_notice,parent,false)
ListNoticeHolder(view)
}
summary -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_list_summary,parent,false)
ListSummaryHolder(view)
}
else -> {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_passenger_msg_list_v2x,parent,false)
ListV2XHolder(view)
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if(holder is ListNoticeHolder){
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) }
when (holder) {
is ListNoticeHolder -> {
data?.let {
val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg
if(noticeFrCloudMsg.type == 0){
val noticeNormalData = noticeFrCloudMsg.noticeNormalData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeNormalData?.content
GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) }
}
}else if(noticeFrCloudMsg.type == 1){
val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData
holder.tvPassengerNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerNoticeContent.text = noticeTrafficStylePushData?.content
GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform(
GlideRoundedCornersTransform(
20f,
GlideRoundedCornersTransform.CornerType.ALL
)
).into(holder.ivPassengerNoticeImage)
holder.tvPassengerNoticeCheck.setOnClickListener {
//云公告
noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) }
}
}
}
}
}else if(holder is ListV2XHolder){
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvPassengerV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerV2XContent.text = v2XMsg.content
if(msgBoxBean.type == MsgBoxType.OBU){
is ListV2XHolder -> {
data?.let {
val msgBoxBean = it[position]
val v2XMsg = msgBoxBean.bean as V2XMsg
holder.tvPassengerV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerV2XContent.text = v2XMsg.content
holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnumNew.getUpdateIconRes(v2XMsg.type)))
}else{
holder.ivPassengerV2XImage.setImageDrawable(activity.resources.getDrawable(
EventTypeEnum.getUpdateIconRes(v2XMsg.type)))
}
}
is ListSummaryHolder -> {
data?.let {
val summaryMsg= it[position].bean as V2XMsg
holder.tvPassengerSummaryTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat())
holder.tvPassengerSummaryContent.text = summaryMsg.content
holder.tvPassengerSummaryCheck.setOnClickListener {
//跳转全览模式
// CallerHmiManager.showSmallFragment()
CallerMsgBoxEventListenerManager.invokeListener()
}
}
}
}
@@ -102,10 +117,12 @@ class PassengerMsgBoxListAdapter(private val activity: Activity): RecyclerView.A
override fun getItemCount() = data?.size ?: 0
override fun getItemViewType(position: Int): Int {
if(data!![position].type == MsgBoxType.NOTICE){
return notice
}else{
return v2x
return if(data!![position].type == MsgBoxType.NOTICE){
notice
}else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){
summary
} else{
v2x
}
}
@@ -125,4 +142,11 @@ class PassengerMsgBoxListAdapter(private val activity: Activity): RecyclerView.A
var tvPassengerV2XContent: TextView = itemView.findViewById(R.id.tvPassengerV2XContent)
}
//汇总消息
class ListSummaryHolder(itemView: View): RecyclerView.ViewHolder(itemView){
var tvPassengerSummaryContent: TextView = itemView.findViewById(R.id.tvPassengerSummaryContent)
var tvPassengerSummaryCheck: TextView = itemView.findViewById(R.id.tvPassengerSummaryCheck)
var tvPassengerSummaryTime: TextView = itemView.findViewById(R.id.tvPassengerSummaryTime)
}
}

View File

@@ -16,6 +16,7 @@ import androidx.appcompat.widget.PopupMenu
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.core.view.*
import androidx.lifecycle.lifecycleScope
import chassis.Chassis
import chassis.ChassisStatesOuterClass
import com.mogo.cloud.passport.MoGoAiCloudClient
@@ -63,6 +64,7 @@ import com.mogo.eagle.core.function.hmi.ui.logcatch.ILogViewListener
import com.mogo.eagle.core.function.hmi.ui.logcatch.LogInfoView
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
import com.mogo.eagle.core.utilcode.kotlin.currentPadding
import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
@@ -74,9 +76,12 @@ import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.map.uicontroller.VisualAngleMode
import com.mogo.map.uicontroller.VisualAngleMode.*
import com.zhidao.easysocket.utils.L
import com.mogo.support.obu.MogoObuManager
import com.mogo.support.obu.constants.MogoObuLogLevel
import com.mogo.support.obu.option.MogoObuLog
import com.zhjt.mogo_core_function_devatools.env.*
import kotlinx.android.synthetic.main.view_debug_setting.view.*
import kotlinx.coroutines.launch
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
import planning.RoboSweeperTaskIndexOuterClass
@@ -88,9 +93,7 @@ import kotlin.collections.component3
import kotlin.collections.component4
import kotlin.collections.set
import kotlin.math.abs
import androidx.lifecycle.lifecycleScope
import kotlinx.coroutines.launch
import com.mogo.eagle.core.utilcode.kotlin.lifecycleOwner
/**
* @author xiaoyuzhou
@@ -1035,49 +1038,6 @@ internal class DebugSettingView @JvmOverloads constructor(
* 设置Hmi点击监听
*/
private fun setHmiCheckedChangeListener() {
/**
* 显示、隐藏迈速表
*/
tbSpeedView.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) {
CallerHmiManager.setSpeedChartViewVisibility(View.VISIBLE)
} else {
CallerHmiManager.setSpeedChartViewVisibility(View.GONE)
}
}
/**
* 显示、隐藏“自动驾驶控制按钮”
*/
tbAutopilotStatusView.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) {
CallerHmiManager.setAutopilotStatusViewVisibility(View.VISIBLE)
} else {
CallerHmiManager.setAutopilotStatusViewVisibility(View.GONE)
}
}
/**
* 显示、隐藏视角切换按钮
*/
tbPerspectiveSwitchView.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) {
CallerHmiManager.setPerspectiveSwitchViewVisibility(View.VISIBLE)
} else {
CallerHmiManager.setPerspectiveSwitchViewVisibility(View.GONE)
}
}
/**
* 显示、隐藏工具箱
*/
tbCheckStatusView.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) {
CallerHmiManager.setToolsViewVisibility(View.VISIBLE)
} else {
CallerHmiManager.setToolsViewVisibility(View.GONE)
}
}
/**
* 隐藏、显示小地图
@@ -1275,7 +1235,14 @@ internal class DebugSettingView @JvmOverloads constructor(
* 设置是否输出OBU日志 true-打印日志false-不打印日志
*/
tbObuLog.setOnCheckedChangeListener { _, isChecked ->
L.setEnableLog(isChecked)
MogoObuManager.getInstance().setEnableLog(isChecked)
val builder: com.mogo.support.obu.option.MogoObuLog.Builder =
MogoObuLog.newBuilder().setEnableStdio(isChecked)
if (isChecked) {
builder.setStdioLevel(MogoObuLogLevel.DBG)
}
MogoObuManager.getInstance().logConfig(builder.build())
}
/**

View File

@@ -10,6 +10,7 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsFuncConfigListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
@@ -19,6 +20,7 @@ import com.mogo.eagle.core.utilcode.kotlin.currentPadding
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.function.business.routeoverlay.RouteStrategy
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.view_debug_setting.view.*
@@ -150,7 +152,7 @@ internal class SOPSettingView @JvmOverloads constructor(
HmiBuildConfig.isShowLimitingVelocityView = true
} else {
HmiBuildConfig.isShowLimitingVelocityView = false
CallerHmiManager.disableLimitingVelocity()
CallerHmiViewControlListenerManager.invokeVisible(IViewControlListener.LimitingVelocityView_TAG,View.GONE)
}
}

View File

@@ -10,23 +10,21 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
class DemoModeHiddenSwitch(context: Context?, attrs: AttributeSet?) : View(context, attrs) {
class DemoModeHiddenSwitch(context: Context, attrs: AttributeSet?) : View(context, attrs) {
override fun onAttachedToWindow() {
super.onAttachedToWindow()
init {
isClickable = true
setOnClickListener {
//只在司机端设置美化模式开关功能
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
//单次查询,是否有行程信息(订单进行中时点击不生效),autopilotControlParameters为null代表不处于自动驾驶状态下
if (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().autopilotControlParameters == null) {
FunctionBuildConfig.isDemoMode = !FunctionBuildConfig.isDemoMode
context?.let {
CallerHmiManager.updateStatusBarLeftView(
FunctionBuildConfig.isDemoMode,
"demoMode",
DemoModeView(it)
)
}
CallerHmiManager.updateStatusBarLeftView(
FunctionBuildConfig.isDemoMode,
"demoMode",
DemoModeView(context)
)
CallerAutoPilotManager.setDemoMode(FunctionBuildConfig.isDemoMode)
if (!FunctionBuildConfig.isDemoMode) {
//关闭美化模式时,通知工控机

View File

@@ -6,7 +6,7 @@ import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
@@ -56,10 +56,10 @@ class TakeOverView @JvmOverloads constructor(
MogoReport.Code.Error.EMAP.EXIT_AUTOPILOT_FOR_CHASSIS,
MogoReport.Code.Error.EMAP.EXIT_AUTOPILOT_FOR_DISTANCE -> {
CallerHmiManager.warningV2X(
EventTypeEnum.TAKE_OVER_EVENT.poiType,
EventTypeEnum.TAKE_OVER_EVENT.content,
EventTypeEnum.TAKE_OVER_EVENT.tts,
EventTypeEnum.TAKE_OVER_EVENT.poiType,
EventTypeEnumNew.TAKE_OVER_EVENT.poiType,
EventTypeEnumNew.TAKE_OVER_EVENT.content,
EventTypeEnumNew.TAKE_OVER_EVENT.tts,
EventTypeEnumNew.TAKE_OVER_EVENT.poiType,
object : IMoGoWarningStatusListener {
override fun onShow() {
takeOver = true

View File

@@ -2,34 +2,20 @@ package com.mogo.eagle.core.function.hmi.ui.tools
import android.content.Context
import android.util.AttributeSet
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.ToolsView_TAG
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.setting.ToolsView.Companion.toolsView
class ToolsImageView(context: Context, attrs: AttributeSet?) :
androidx.appcompat.widget.AppCompatImageView(context, attrs), IViewControlListener {
androidx.appcompat.widget.AppCompatImageView(context, attrs) {
override fun onAttachedToWindow() {
super.onAttachedToWindow()
scaleType = ScaleType.CENTER
setBackgroundResource(R.drawable.module_ext_check)
setImageResource(R.drawable.icon_tools_nor)
scaleType = ScaleType.CENTER
setOnClickListener{
toolsView.showToolsFloat(context)
}
CallerHmiViewControlListenerManager.addListener(ToolsView_TAG, this)
}
override fun visible(v: Int) {
super.visible(v)
visibility = v
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerHmiViewControlListenerManager.removeListener(ToolsView_TAG)
}
}

View File

@@ -8,14 +8,11 @@ import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.AutoPilotStatusView_TAG
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getCurWgs84Lat
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getCurWgs84Lon
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
@@ -33,7 +30,7 @@ class AutoPilotStatusView constructor(
attrs: AttributeSet
) : ConstraintLayout(context, attrs),
View.OnClickListener,
IMoGoAutopilotStatusListener, IViewControlListener {
IMoGoAutopilotStatusListener {
companion object {
const val TAG = "AutopilotStatusView"
@@ -41,33 +38,21 @@ class AutoPilotStatusView constructor(
private var mAutopilotStatus: Int = 0
override fun onAttachedToWindow() {
super.onAttachedToWindow()
init{
initView(context)
}
private fun initView(context: Context) {
setBackgroundResource(R.drawable.module_hmi_autopilot_status_bg)
LayoutInflater.from(context).inflate(R.layout.view_autopilot_status, this, true)
val lp = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)
layoutParams = lp
// 设置点击监听
setOnClickListener(this)
// 自动驾驶状态监听
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerHmiViewControlListenerManager.addListener(AutoPilotStatusView_TAG, this)
CallerLogger.d("$M_HMI$TAG", "autopilotStatus: $mAutopilotStatus")
setAutoPilotStatus(mAutopilotStatus)
}
override fun visible(v: Int) {
super.visible(v)
visibility = v
}
override fun onClick(v: View?) {
when (mAutopilotStatus) {
0 -> {// 不可自动驾驶adas与工控机没有链接或工控机异常
@@ -139,7 +124,6 @@ class AutoPilotStatusView constructor(
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerHmiViewControlListenerManager.removeListener(AutoPilotStatusView_TAG)
}
}

View File

@@ -2,15 +2,12 @@ package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
import android.util.AttributeSet
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.CameraView_TAG
import com.mogo.eagle.core.function.call.biz.CallerFuncBizManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.setting.CameraLiveView.Companion.cameraLiveView
class CameraView(context: Context, attrs: AttributeSet?) :
androidx.appcompat.widget.AppCompatImageView(context, attrs), IViewControlListener {
androidx.appcompat.widget.AppCompatImageView(context, attrs) {
override fun onAttachedToWindow() {
super.onAttachedToWindow()
@@ -28,16 +25,6 @@ class CameraView(context: Context, attrs: AttributeSet?) :
}
}
CallerHmiViewControlListenerManager.addListener(CameraView_TAG, this)
}
override fun visible(v: Int) {
super.visible(v)
visibility = v
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerHmiViewControlListenerManager.removeListener(CameraView_TAG)
}
}

View File

@@ -3,25 +3,59 @@ package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import com.mogo.eagle.core.function.api.hmi.view.IViewLimitingVelocity
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.LimitingVelocityView_TAG
import com.mogo.eagle.core.function.api.v2x.ILimitingVelocityListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.v2x.CallerViewLimitingVelocityListenerManager
import com.mogo.eagle.core.function.hmi.R
import kotlinx.android.synthetic.main.view_limiting_speed_vr.view.*
/**
* 限速控件
*/
class LimitingVelocityView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : IViewLimitingVelocity(context, attrs, defStyleAttr) {
class LimitingVelocityView constructor(
context: Context,
attrs: AttributeSet? = null,
) : ConstraintLayout(context, attrs), ILimitingVelocityListener, IViewControlListener {
companion object {
private const val TAG = "LimitingVelocityView"
}
init {
LayoutInflater.from(context).inflate(R.layout.view_limiting_speed_vr, this, true)
}
override fun updateLimitingSpeed(limitingSpeed: Int, limitSource: Int) {
super.updateLimitingSpeed(limitingSpeed, limitSource)
tvLimitingVelocity.text = "$limitingSpeed"
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerViewLimitingVelocityListenerManager.addListener(TAG, this)
CallerHmiViewControlListenerManager.addListener(LimitingVelocityView_TAG, this)
}
override fun onLimitingVelocityChange(limitingVelocity: Int, sourceType: DataSourceType) {
if (limitingVelocity > 0) {
this.visibility = View.VISIBLE
tvLimitingVelocity.text = "$limitingVelocity"
tvLimitingSource.text = sourceType.name
} else {
this.visibility = View.GONE
tvLimitingSource.text = ""
}
}
override fun visible(v: Int) {
super.visible(v)
this.visibility = v
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerViewLimitingVelocityListenerManager.removeListener(TAG)
CallerHmiViewControlListenerManager.removeListener(LimitingVelocityView_TAG)
}
}

View File

@@ -5,9 +5,6 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.PerspectiveSwitchView_TAG
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getMapUIController
import com.mogo.eagle.core.function.hmi.R
import com.mogo.map.uicontroller.VisualAngleMode
@@ -22,20 +19,13 @@ class PerspectiveSwitchView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : FrameLayout(context, attrs, defStyleAttr), View.OnClickListener, IViewControlListener{
) : FrameLayout(context, attrs, defStyleAttr), View.OnClickListener{
override fun onAttachedToWindow() {
super.onAttachedToWindow()
LayoutInflater.from(context).inflate(R.layout.view_perspective_switch, this, true)
setBackgroundResource(R.drawable.module_switch_map_bg)
setOnClickListener(this)
CallerHmiViewControlListenerManager.addListener(PerspectiveSwitchView_TAG,this)
}
override fun visible(v: Int) {
super.visible(v)
visibility = v
}
override fun onClick(v: View?) {
@@ -53,9 +43,4 @@ class PerspectiveSwitchView @JvmOverloads constructor(
}
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerHmiViewControlListenerManager.removeListener(PerspectiveSwitchView_TAG)
}
}

View File

@@ -6,11 +6,7 @@ import android.util.AttributeSet
import android.view.Gravity
import android.widget.FrameLayout
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.SpeedPanelView_TAG
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
@@ -25,7 +21,7 @@ class SpeedPanelView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : FrameLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener,IViewControlListener {
) : FrameLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener {
companion object {
const val TAG = "SpeedPanelView"
@@ -58,8 +54,6 @@ class SpeedPanelView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
// 注册view控制显示隐藏监听
CallerHmiViewControlListenerManager.addListener(SpeedPanelView_TAG,this)
// 注册位置回调
CallerChassisLocationGCJ20ListenerManager.addListener(TAG, this)
// 开启定时查询速度
@@ -89,15 +83,9 @@ class SpeedPanelView @JvmOverloads constructor(
}
}
override fun visible(v: Int) {
super.visible(v)
visibility = v
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
// 解除注册
CallerHmiViewControlListenerManager.removeListener(SpeedPanelView_TAG)
CallerChassisLocationGCJ20ListenerManager.removeListener(TAG)
try {
timerTask?.cancel()

View File

@@ -6,6 +6,7 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.LinearLayout
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.mofang.MfConstants
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
@@ -51,6 +52,7 @@ class StatusBarView @JvmOverloads constructor(
//将状态窗口中的状态移到状态栏上
CallerDevaToolsManager.showStatusBar(context, status_container)
updateStatusBarRightView(FunctionBuildConfig.isDemoMode, "demoMode", DemoModeView(this.context))
}
override fun onSkinModeChange(skinMode: Int) {

View File

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

View File

@@ -27,32 +27,14 @@ class VipIdentificationView : ConstraintLayout, IMoGoVipSetListener {
attributeSet,
defStyleAttr
) {
init(attributeSet, defStyleAttr)
}
private var marginStart: Float = 0.0f
private var marginTop: Float = 0.0f
private fun init(attrs: AttributeSet, defStyleAttr: Int) {
init {
LayoutInflater.from(context).inflate(R.layout.view_vip_identification, this, true)
val a = context.obtainStyledAttributes(
attrs,
R.styleable.VipIdentificationView,
defStyleAttr,
0
)
marginStart = a.getDimension(R.styleable.VipIdentificationView_marginStart, 0.0f)
marginTop = a.getDimension(R.styleable.VipIdentificationView_marginTop, 0.0f)
a.recycle()
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
val lp = this.layoutParams as LayoutParams
lp.marginStart = marginStart.toInt()
lp.topMargin = marginTop.toInt()
this.layoutParams = lp
invalidate()
CallVipSetListenerManager.addListener(TAG, this)
}

View File

@@ -41,10 +41,10 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.call.startup.CallerStartUpManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView;
import com.mogo.eagle.core.function.main.modules.MogoModulesManager;
import com.mogo.eagle.core.function.main.stagetwo.AutopilotStartup;
import com.mogo.eagle.core.function.main.windowview.FloatingViewHandler;
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
@@ -163,7 +163,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
ContextHolderUtil.holdContext(this);
// 监听工控机连接信息
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
startUpInStage2();
CallerStartUpManager.initStageTwo();
// 加载模块
mPresenter.postLoadModuleMsg();
// 监听网络状态
@@ -218,26 +218,6 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
mConnectInfoRV.setAdapter(mConnAdapter);
}
/**
* 第二阶段初始化,第一阶段初始化可查看:{@link com.mogo.launcher.stageone}
*/
public void startUpInStage2() {
StartupConfig config = null;
if (DebugConfig.isDebug()) {
config = new StartupConfig.Builder()
.setLoggerLevel(LoggerLevel.DEBUG)
.setOpenStatistics(true)
.build();
}
new StartupManager.Builder()
.addStartup(new AutopilotStartup())
// .addStartup(new APMStartup())
.setConfig(config)
.build(this)
.start()
.await();
}
@Override
public void loadModules() {
final long start = System.currentTimeMillis();

View File

@@ -149,10 +149,14 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
.build("/driver/api")
.navigation(getContext());
} else {
} else if(AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)){
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
.build("/passenger/api")
.navigation(getContext());
} else {
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
.build("/noop/api")
.navigation(getContext());
}
}
// 处理一个机器多个屏幕方案

View File

@@ -34,7 +34,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
import com.mogo.eagle.core.utilcode.util.SPUtils;
import com.zhidao.support.obu.ami.AmiClientManager;
import java.io.File;
import java.lang.reflect.Field;
@@ -203,7 +202,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
*/
private void connectAmiIp() {
String ipAddress = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp().getBaseContext()).getString(MoGoConfig.OBU_IP, "192.168.1.199");
AmiClientManager.getInstance().setObuIp(ipAddress);
// AmiClientManager.getInstance().setObuIp(ipAddress);
}
private void initModules() {

View File

@@ -1,40 +0,0 @@
package com.mogo.eagle.core.function.main.stagetwo;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.rousetime.android_startup.AndroidStartup;
import java.util.ArrayList;
import java.util.List;
public class AutopilotStartup extends AndroidStartup<Boolean> {
@Nullable
@Override
public Boolean create(@NonNull Context context) {
ARouter.getInstance().build(MogoServicePaths.PATH_AUTO_PILOT).navigation();
return true;
}
@Override
public boolean callCreateOnMainThread() {
return true;
}
@Override
public boolean waitOnMainThread() {
return false;
}
// @Nullable
// @Override
// public List<String> dependenciesByName() {
// List<String> deps = new ArrayList<>();
// deps.add("com.mogo.eagle.core.function.main.stagetwo.APMStartup");
// return deps;
// }
}

View File

@@ -1,38 +0,0 @@
package com.mogo.eagle.core.function.main.stagetwo;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.rousetime.android_startup.AndroidStartup;
import java.util.ArrayList;
import java.util.List;
public class MapStartup extends AndroidStartup<Boolean> {
@Nullable
@Override
public Boolean create(@NonNull Context context) {
// TODO:暂不支持分步加载
return true;
}
@Override
public boolean callCreateOnMainThread() {
return true;
}
@Override
public boolean waitOnMainThread() {
return false;
}
// @Nullable
// @Override
// public List<String> dependenciesByName() {
// List<String> deps = new ArrayList<>();
// deps.add("com.mogo.eagle.core.function.main.stagetwo.APMStartup");
// return deps;
// }
}

View File

@@ -20,82 +20,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="72dp">
<!--Vip车辆标志-->
<com.mogo.eagle.core.function.hmi.ui.widget.VipIdentificationView
android:layout_width="@dimen/module_vip_width"
android:layout_height="@dimen/module_vip_height"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--接管提示-->
<com.mogo.eagle.core.function.hmi.ui.takeover.TakeOverView
android:id="@+id/clTakeOverView"
android:layout_width="@dimen/hmi_take_over_request_width"
android:layout_height="@dimen/hmi_take_over_request_height"
android:layout_marginTop="@dimen/hmi_take_over_request_m_top"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--地图视角切换-->
<com.mogo.eagle.core.function.hmi.ui.widget.PerspectiveSwitchView
android:id="@+id/viewPerspectiveSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginBottom="40dp"
android:elevation="@dimen/dp_10"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<!--隐藏态下的 美化模式按钮-->
<com.mogo.eagle.core.function.hmi.ui.switch.DemoModeHiddenSwitch
android:id="@+id/viewDemoModeSwitch"
android:layout_width="120dp"
android:layout_height="100dp"
android:layout_marginStart="40dp"
android:layout_marginBottom="200dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<!--限速牌子-->
<com.mogo.eagle.core.function.hmi.ui.widget.LimitingVelocityView
android:id="@+id/viewLimitingVelocity"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="30dp"
android:layout_marginEnd="40dp"
android:background="@drawable/bg_waring_limiting_velocity"
android:elevation="@dimen/dp_10"
android:gravity="center"
android:text="60"
android:textColor="#FFFFFF"
android:textSize="60dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_goneMarginEnd="40dp"
app:layout_goneMarginTop="40dp"
tools:visibility="gone" />
<!-- todo 需要放入使用方 -->
<!-- app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"-->
<!--限速来源-->
<TextView
android:id="@+id/tvLimitingSource"
android:layout_width="120dp"
android:layout_height="35dp"
android:gravity="center"
android:text=""
android:textColor="@color/color_FFFFFF"
android:textSize="@dimen/dp_30"
android:textStyle="bold"
android:layout_marginEnd="40dp"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/viewLimitingVelocity" />
<!--消息盒子司机端选择入口-->
<CheckBox
@@ -107,9 +31,10 @@
android:background="@drawable/selector_msg_box"
android:button="@null"
android:visibility="gone"
app:layout_constraintRight_toLeftOf="@id/viewLimitingVelocity"
app:layout_constraintRight_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<!-- todo 需要放入使用方 , view先gone掉方便重组 -->
<!-- app:layout_constraintRight_toLeftOf="@id/viewLimitingVelocity"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon" />-->
<!--司机端消息提示-->
@@ -209,33 +134,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--pnc行为决策-->
<com.mogo.eagle.core.function.hmi.ui.pnc.PncActionsView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_110"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<!--APP、MAP版本-->
<com.mogo.eagle.core.function.hmi.ui.widget.VersionNameView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="45dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<RelativeLayout
android:id="@+id/statusBarContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="30dp"
app:layout_constraintEnd_toStartOf="@+id/viewLimitingVelocity"
app:layout_constraintTop_toTopOf="@+id/viewLimitingVelocity"
app:layout_goneMarginEnd="40dp"
app:layout_goneMarginTop="30dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.eagle.core.widget.RoundConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="804dp"
android:layout_height="160dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#53000000"
app:roundLayoutRadius="24dp"
android:layout_gravity="center_horizontal"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp"
>
<ImageView
android:id="@+id/ivSummaryImage"
android:layout_width="140dp"
android:layout_height="130dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginStart="15dp"
android:src="@drawable/icon_notice_default"
/>
<TextView
android:id="@+id/tvSummaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="蘑菇小助手"
android:textColor="#FFFFFFFF"
android:textSize="32dp"
app:layout_constraintLeft_toRightOf="@id/ivSummaryImage"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvSummaryContent"
android:layout_marginStart="15dp"
/>
<TextView
android:id="@+id/tvSummaryContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="@id/tvSummaryTitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSummaryTitle"
app:layout_constraintRight_toRightOf="@id/tvSummaryTime"
android:gravity="start"
android:textColor="#B3FFFFFF"
android:textSize="28dp"
/>
<TextView
android:id="@+id/tvSummaryTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvSummaryTitle"
app:layout_constraintBottom_toBottomOf="@id/tvSummaryTitle"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginEnd="25dp"
android:textColor="#80FFFFFF"
android:textSize="24dp"
/>
</com.mogo.eagle.core.widget.RoundConstraintLayout>

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.eagle.core.widget.RoundConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="804dp"
android:layout_height="160dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#53000000"
app:roundLayoutRadius="24dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp"
>
<ImageView
android:id="@+id/ivSummaryImage"
android:layout_width="140dp"
android:layout_height="130dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginStart="15dp"
android:src="@drawable/icon_notice_default"
/>
<TextView
android:id="@+id/tvSummaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="蘑菇小助手"
android:textColor="#FFFFFFFF"
android:textSize="32dp"
app:layout_constraintLeft_toRightOf="@id/ivSummaryImage"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvSummaryContent"
android:layout_marginStart="15dp"
/>
<TextView
android:id="@+id/tvSummaryContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="@id/tvSummaryTitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSummaryTitle"
app:layout_constraintRight_toRightOf="@id/tvSummaryTime"
android:gravity="start"
android:textColor="#B3FFFFFF"
android:textSize="28dp"
/>
<TextView
android:id="@+id/tvSummaryTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvSummaryTitle"
app:layout_constraintBottom_toBottomOf="@id/tvSummaryTitle"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginEnd="25dp"
android:textColor="#80FFFFFF"
android:textSize="24dp"
/>
</com.mogo.eagle.core.widget.RoundConstraintLayout>

View File

@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.eagle.core.widget.RoundConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="650dp"
android:layout_height="160dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#465878"
app:roundLayoutRadius="24dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
>
<ImageView
android:id="@+id/ivPassengerSummaryImage"
android:layout_width="160dp"
android:layout_height="160dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:src="@drawable/icon_passenger_operation"
/>
<TextView
android:id="@+id/tvPassengerSummaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="蘑菇小助手"
android:textColor="#FFFFFFFF"
android:textSize="36dp"
android:layout_marginStart="20dp"
app:layout_constraintLeft_toRightOf="@id/ivPassengerSummaryImage"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvPassengerSummaryContent"
/>
<TextView
android:id="@+id/tvPassengerSummaryContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#FFFFFFFF"
android:textSize="28dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@id/tvPassengerSummaryTitle"
app:layout_constraintTop_toBottomOf="@id/tvPassengerSummaryTitle"
app:layout_constraintRight_toRightOf="@id/tvPassengerSummaryTime"
android:gravity="start"
/>
<TextView
android:id="@+id/tvPassengerSummaryCheck"
android:layout_width="140dp"
android:layout_height="160dp"
android:text="查 看"
android:textColor="#FF84D4FF"
android:textSize="28dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:gravity="center"
/>
<View
android:layout_width="1dp"
android:layout_height="80dp"
android:background="#5E70A6"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@id/tvPassengerSummaryCheck"
/>
<TextView
android:id="@+id/tvPassengerSummaryTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFFFF"
android:textSize="26dp"
app:layout_constraintTop_toTopOf="@id/tvPassengerSummaryTitle"
app:layout_constraintBottom_toBottomOf="@id/tvPassengerSummaryTitle"
app:layout_constraintRight_toLeftOf="@id/tvPassengerSummaryCheck"
android:layout_marginEnd="20dp"
/>
</com.mogo.eagle.core.widget.RoundConstraintLayout>

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="150dp"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:id="@+id/ivPassengerSummaryImage"
android:layout_width="96dp"
android:layout_height="96dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:src="@drawable/icon_passenger_operation"
/>
<TextView
android:id="@+id/tvPassengerSummaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="蘑菇小助手"
android:textColor="#FFFFFFFF"
android:textSize="36dp"
android:layout_marginStart="20dp"
app:layout_constraintLeft_toRightOf="@id/ivPassengerSummaryImage"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tvPassengerSummaryContent"
/>
<TextView
android:id="@+id/tvPassengerSummaryContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#FFFFFFFF"
android:textSize="28dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPassengerSummaryTitle"
app:layout_constraintLeft_toLeftOf="@id/tvPassengerSummaryTitle"
app:layout_constraintRight_toRightOf="@id/tvPassengerSummaryTime"
android:gravity="start"
/>
<TextView
android:id="@+id/tvPassengerSummaryCheck"
android:layout_width="140dp"
android:layout_height="150dp"
android:text="查 看"
android:textColor="#FF84D4FF"
android:textSize="28dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:gravity="center"
/>
<View
android:layout_width="1dp"
android:layout_height="80dp"
android:background="#5E70A6"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@id/tvPassengerSummaryCheck"
/>
<TextView
android:id="@+id/tvPassengerSummaryTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFFFF"
android:textSize="26dp"
app:layout_constraintTop_toTopOf="@id/tvPassengerSummaryTitle"
app:layout_constraintBottom_toBottomOf="@id/tvPassengerSummaryTitle"
app:layout_constraintRight_toLeftOf="@id/tvPassengerSummaryCheck"
android:layout_marginEnd="20dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1274,54 +1274,6 @@
app:layout_constraintLeft_toRightOf="@+id/tbChangeCurrentCarIcon"
app:layout_constraintTop_toTopOf="@id/tbChangeCurrentCarIcon" />
<ToggleButton
android:id="@+id/tbSpeedView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_margin="2dp"
android:gravity="center"
android:padding="@dimen/dp_20"
android:textOff="隐藏「脉速表」"
android:textOn="显示「脉速表」"
android:textSize="@dimen/dp_24" />
<ToggleButton
android:id="@+id/tbAutopilotStatusView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_margin="2dp"
android:gravity="center"
android:padding="@dimen/dp_20"
android:textOff="隐藏「自动驾驶控制按钮」"
android:textOn="显示「自动驾驶控制按钮」"
android:textSize="@dimen/dp_24" />
<ToggleButton
android:id="@+id/tbPerspectiveSwitchView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_margin="2dp"
android:gravity="center"
android:padding="@dimen/dp_20"
android:textOff="隐藏「视角切换按钮」"
android:textOn="显示「视角切换按钮」"
android:textSize="@dimen/dp_24" />
<ToggleButton
android:id="@+id/tbCheckStatusView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_margin="2dp"
android:gravity="center"
android:padding="@dimen/dp_20"
android:textOff="隐藏「工具箱」"
android:textOn="显示「工具箱」"
android:textSize="@dimen/dp_24" />
<ToggleButton
android:id="@+id/tbControlView"
android:layout_width="wrap_content"

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="150dp"
android:layout_height="150dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<!--消息盒子司机端选择入口-->
<CheckBox
android:id="@+id/cbMsgBoxDriver"
android:layout_width="150dp"
android:layout_height="150dp"
android:background="@drawable/selector_msg_box"
android:button="@null"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
/>
<!--司机端消息提示-->
<View
android:id="@+id/MsgBoxTipView"
android:layout_width="8dp"
android:layout_height="8dp"
android:background="@drawable/version_upgrade_tips_background"
android:translationZ="30dp"
android:visibility="gone"
app:layout_constraintCircle="@id/cbMsgBoxDriver"
app:layout_constraintCircleAngle="40"
app:layout_constraintCircleRadius="32dp"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,22 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<TextView
android:id="@+id/tvLimitingVelocity"
android:layout_width="120dp"
android:layout_height="120dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:background="@drawable/bg_waring_limiting_velocity"
android:elevation="@dimen/dp_10"
android:gravity="center"
android:text="60"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_60"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivCameraIcon"
/>
android:textSize="@dimen/dp_60"/>
</LinearLayout>
<!--限速来源-->
<TextView
android:id="@+id/tvLimitingSource"
android:layout_width="120dp"
android:layout_height="35dp"
android:layout_marginEnd="40dp"
android:gravity="center"
android:text=""
android:textColor="@color/color_FFFFFF"
android:textSize="@dimen/dp_30"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvLimitingVelocity"
android:visibility="gone" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="100dp"
android:layout_height="100dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<!--消息盒子乘客端选择入口-->
<CheckBox
android:id="@+id/cbMsgBoxPassenger"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@drawable/selector_msg_box_p"
android:button="@null"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<!--乘客端消息提示-->
<View
android:id="@+id/MsgBoxPTipView"
android:layout_width="15dp"
android:layout_height="15dp"
android:background="@drawable/version_upgrade_tips_background"
android:translationZ="30dp"
android:visibility="gone"
app:layout_constraintCircle="@id/cbMsgBoxPassenger"
app:layout_constraintCircleAngle="40"
app:layout_constraintCircleRadius="50dp"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -69,9 +69,4 @@
<item name="android:borderlessButtonStyle">@android:color/transparent</item>
</style>
<declare-styleable name="VipIdentificationView">
<attr name="marginStart" format="dimension" />
<attr name="marginTop" format="dimension" />
</declare-styleable>
</resources>

View File

@@ -1,19 +1,15 @@
package com.mogo.eagle.function.biz.v2x.speedlimit;
import static com.mogo.eagle.core.data.config.HmiBuildConfig.isShowObuLimitSpeedView;
import static com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.BIZ_SLW;
import static com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.V2I;
package com.mogo.eagle.core.function.business;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.enums.DataSourceType;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager;
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.v2x.CallLimitingVelocityListenerManager;
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.zhjt.service_biz.BizConfig;
import java.util.Objects;
import java.util.Timer;
import java.util.TimerTask;
@@ -27,8 +23,8 @@ import mogo.telematics.pad.MessagePad;
public class SpeedLimitDataManager implements IMoGoChassisLocationGCJ02Listener {
private final static String TAG = "SpeedLimitDataManager";
private static SpeedLimitDataManager instance;
private MessagePad.GnssInfo mLocation;
private static volatile SpeedLimitDataManager instance;
private MessagePad.GnssInfo mLocation;
private SpeedLimitDataManager() {
}
@@ -53,24 +49,19 @@ public class SpeedLimitDataManager implements IMoGoChassisLocationGCJ02Listener
@Override
public void run() {
if (mLocation != null) {
if(CallerMapUIServiceManager.INSTANCE.getMapUIController()!=null){
if (CallerMapUIServiceManager.INSTANCE.getMapUIController() != null) {
getSpeedLimit();
}
}
}
@BizConfig(biz = V2I, dependentBizNode = "", bizNode = BIZ_SLW)
private void getSpeedLimit() {
// if (!isShowObuLimitSpeedView) {
int speedLimit = CallerMapUIServiceManager.INSTANCE.getMapUIController().getLimitSpeed(mLocation.getLongitude(), mLocation.getLatitude(), (float) mLocation.getHeading());
UiThreadHandler.post(() -> {
if (speedLimit > 0) {
// CallerHmiManager.INSTANCE.showLimitingVelocity(speedLimit, 1);
CallLimitingVelocityListenerManager.INSTANCE.invokeOnLimitingVelocityChange(speedLimit);
}
});
// }
int speedLimit = Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMapUIController()).getLimitSpeed(mLocation.getLongitude(), mLocation.getLatitude(), (float) mLocation.getHeading());
UiThreadHandler.post(() -> {
if (speedLimit > 0) {
CallerLimitingVelocityListenerManager.INSTANCE.invokeOnLimitingVelocityChange(speedLimit, DataSourceType.MAP);
}
});
}
}

View File

@@ -10,23 +10,24 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.api.autopilot.*
import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
import com.zhidaoauto.map.operational.open.GatherApi
import com.zhidaoauto.map.operational.open.GatherParams
import com.zhidaoauto.map.operational.open.abs.OnTaskListener
import mogo.telematics.pad.MessagePad.GnssInfo
import record_cache.RecordPanelOuterClass
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CopyOnWriteArrayList
import java.util.concurrent.atomic.AtomicReference
@Route(path = MogoServicePaths.PATH_MAP_DATA_COLLECT_PROVIDER)
class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener, IMoGoMapLocationListener, IMoGoTokenCallback,
class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener, IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
IMoGoAutopilotRecordListener {
companion object {
@@ -52,7 +53,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
override fun init(context: Context?) {
CallerMapLocationListenerManager.addListener(TAG, this, false)
CallerChassisLocationGCJ20ListenerManager.addListener(TAG, this)
CallerAutopilotRecordListenerManager.addListener(TAG, this)
executor.set(context?.let {
@@ -74,7 +75,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
override fun onDestroy() {
CallerLogger.d("$M_MAP$TAG", "--------- onDestroy --------")
CallerMapLocationListenerManager.removeListener(TAG, false)
CallerChassisLocationGCJ20ListenerManager.removeListener(TAG)
CallerAutopilotRecordListenerManager.removeListener(TAG)
executor.get()?.setOnTaskListener(null)
listeners.clear()
@@ -170,18 +171,17 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
}
}
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
location ?: return
override fun onChassisLocationGCJ02(gnssInfo: GnssInfo?) {
val location = CallerMapLocationListenerManager.getCurrentLocation() ?: return
executor.get()?.updateLocation(
location.longitude,
location.latitude,
location.longitude,
location.latitude,
location.altitude,
location.bearing,
location.speed,
isGps)
false)
}
private fun isInValidStatus(): Boolean {
if (map.isEmpty()) {
return true

View File

@@ -5,6 +5,7 @@ import android.text.TextUtils;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.data.enums.EventTypeEnumNew;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.MarkerNoveltyInfo;
@@ -19,7 +20,6 @@ import com.mogo.map.MogoMarkerManager;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.eagle.core.data.enums.EventTypeEnum;
/**
* @author congtaowang
@@ -81,7 +81,7 @@ public class MarkerDrawer {
Object bindObj = markerShowEntity.getBindObj();
if (bindObj instanceof MarkerExploreWay && ((MarkerExploreWay) bindObj).getPoiType() != null) {
String poiType = ((MarkerExploreWay) bindObj).getPoiType();
options.icon3DRes(EventTypeEnum.getMarker3DRes(poiType));
options.icon3DRes(EventTypeEnumNew.getMarker3DRes(poiType));
}
}

View File

@@ -15,6 +15,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
import com.mogo.eagle.core.function.business.MapPointCloudSubscriber
import com.mogo.eagle.core.function.business.SpeedLimitDataManager
import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
import com.mogo.eagle.core.function.business.routeoverlay.MogoRouteOverlayManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
@@ -199,6 +200,8 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
MapIdentifySubscriber.instance
MogoRouteOverlayManager.getInstance().init()
MapPointCloudSubscriber.instance
SpeedLimitDataManager.getInstance().start()
// TODO GD地图业务需要与高精地图业务拆开 --- 扶风
queryInfStructure()
}

View File

@@ -1,45 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.eagle.core.function.obu.mogo">
<application>
<receiver android:name="com.mogo.eagle.core.function.obu.mogo.receiver.ObuTestTriggerReceiver">
<intent-filter>
<action android:name="com.obu.test_trigger" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name="com.mogo.eagle.core.function.obu.mogo.receiver.ObuTestTriggerRecognizedReceiver">
<intent-filter>
<action android:name="com.obu.test_trigger_recognized" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name="com.mogo.eagle.core.function.obu.mogo.receiver.ObuRsuTestTriggerReceiver">
<intent-filter>
<action android:name="com.obu.test_light_recognized" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name="com.mogo.eagle.core.function.obu.mogo.receiver.ObuTestNewObuReceiver">
<intent-filter>
<action android:name="com.obu.test_newobu" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name="com.mogo.eagle.core.function.obu.mogo.receiver.ObuTestNewObuRsiReceiver">
<intent-filter>
<action android:name="com.obu.test_newobu_rsi" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

@@ -1,133 +0,0 @@
package com.mogo.eagle.core.function.obu.mogo.utils
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
import com.zhidao.support.obu.constants.ObuConstants
import com.zhidao.support.obu.model.CvxPtcThreatIndInfo
import com.zhidao.support.obu.model.CvxRtiThreatIndInfo
import com.zhidao.support.obu.model.CvxRvInfoIndInfo
import com.zhidao.support.obu.model.CvxV2vThreatIndInfo
/**
* @author xiaoyuzhou
* @date 2021/8/18 2:30 下午
*/
object TrafficDataConvertUtils {
val TAG = "TrafficDataConvertUtils"
/**
* OBU 远车 转换交通元素数据
*/
fun cvxRvInfoIndInfo2TrafficData(info: CvxRvInfoIndInfo): TrafficData? {
if (info.basic_info == null || info.basic_info.position == null) {
CallerLogger.e("$M_OBU$TAG", "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE
trafficData.uuid = info.vehicle_id
trafficData.lat = info.basic_info.position.latitude
trafficData.lon = info.basic_info.position.longitude
trafficData.heading = info.basic_info.heading
trafficData.speed = info.basic_info.speed
return trafficData
}
/**
* OBU RSU道路事件预警信息 转换交通元素数据
*/
fun cvxRtiThreatIndInfo2TrafficData(info: CvxRtiThreatIndInfo): TrafficData? {
// 这里只处理道路施工
if(info.ext_info.rti_type != 0x7){
return null
}
if (info.rti_id == null || info.ext_info == null
|| info.zones_info == null || info.zones_info.first() == null
|| info.zones_info.first().path_points.first() == null
|| info.threat_info == null
) {
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG
trafficData.uuid = info.rti_id
trafficData.lat = info.zones_info.first().path_points.first().latitude
trafficData.lon = info.zones_info.first().path_points.first().longitude
trafficData.threatLevel = info.threat_info.threat_level
return trafficData
}
/**
* OBU 预警事件 转换交通元素数据
*/
fun cvxV2vThreatIndInfo2TrafficData(info: CvxV2vThreatIndInfo): TrafficData? {
if (info.basic_info == null || info.basic_info.position == null || info.threat_info == null) {
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
trafficData.uuid = info.vehicle_id
trafficData.lat = info.basic_info.position.latitude
trafficData.lon = info.basic_info.position.longitude
trafficData.heading = info.basic_info.heading
trafficData.speed = info.basic_info.speed
// 判断车辆V2X预警级别调整车辆颜色
trafficData.threatLevel = info.threat_info.threat_level
if (info.threat_info.app_id == ObuConstants.USE_CASE_ID.EVW) {
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_SPECIAL_VEHICLE
} else {
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE
}
return trafficData
}
/**
* OBU 弱势交通参与者信息 转换交通元素数据 TODO
*/
fun cvxPtcThreatIndInfo2TrafficData(info: CvxPtcThreatIndInfo): TrafficData? {
if (info.ptc_pos == null || info.threat_info == null) {
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
trafficData.uuid = info.ptc_id
trafficData.lat = info.ptc_pos.latitude
trafficData.lon = info.ptc_pos.longitude
// trafficData.heading = info.ptc_pos.heading
// trafficData.speed = info.ptc_pos.speed
when (info.ptc_type) {
// 未知
0x0 -> {
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI
}
// 非机动车
0x1 -> {
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO
}
// 行人
0x2 -> {
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE
}
}
// 判断车辆V2X预警级别调整车辆颜色
if (info.threat_info != null) {
trafficData.threatLevel = info.threat_info.threat_level
}
return trafficData
}
}

View File

@@ -5,7 +5,6 @@ plugins {
id 'kotlin-kapt'
id 'com.alibaba.arouter'
}
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
defaultConfig {
@@ -13,10 +12,8 @@ android {
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
//ARouter apt
kapt {
useBuildCache = false
@@ -32,36 +29,43 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.rxandroid
implementation project(path: ':foudations:mogo-commons')
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.android_start_up
implementation rootProject.ext.dependencies.mogocustommap
implementation rootProject.ext.dependencies.thread_opt
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_res
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_function_api
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation rootProject.ext.dependencies.crashreport
implementation rootProject.ext.dependencies.mogomap
implementation rootProject.ext.dependencies.mogomapapi
} else {
implementation project(':core:mogo-core-res')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-function-api')
implementation project(':core:mogo-core-function-call')
implementation project(":test:crashreport")
implementation project(':libraries:mogo-map')
implementation project(":libraries:mogo-map-api")
}
implementation rootProject.ext.dependencies.mogoobuold
implementation rootProject.ext.dependencies.mogoobu
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -0,0 +1,18 @@
/**
* Automatically generated file. DO NOT MODIFY
*/
package com.mogo.eagle.core.function.startup;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String LIBRARY_PACKAGE_NAME = "com.mogo.eagle.core.function.startup";
/**
* @deprecated APPLICATION_ID is misleading in libraries. For the library package name use LIBRARY_PACKAGE_NAME
*/
@Deprecated
public static final String APPLICATION_ID = "com.mogo.eagle.core.function.startup";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "";
}

View File

@@ -0,0 +1,18 @@
package com.alibaba.android.arouter.routes;
import com.alibaba.android.arouter.facade.enums.RouteType;
import com.alibaba.android.arouter.facade.model.RouteMeta;
import com.alibaba.android.arouter.facade.template.IRouteGroup;
import com.mogo.eagle.core.function.startup.MogoStartUpProvider;
import java.lang.Override;
import java.lang.String;
import java.util.Map;
/**
* DO NOT EDIT THIS FILE!!! IT WAS GENERATED BY AROUTER. */
public class ARouter$$Group$$start_up implements IRouteGroup {
@Override
public void loadInto(Map<String, RouteMeta> atlas) {
atlas.put("/start_up/api", RouteMeta.build(RouteType.PROVIDER, MogoStartUpProvider.class, "/start_up/api", "start_up", null, -1, -2147483648));
}
}

View File

@@ -0,0 +1,18 @@
package com.alibaba.android.arouter.routes;
import com.alibaba.android.arouter.facade.enums.RouteType;
import com.alibaba.android.arouter.facade.model.RouteMeta;
import com.alibaba.android.arouter.facade.template.IProviderGroup;
import com.mogo.eagle.core.function.startup.MogoStartUpProvider;
import java.lang.Override;
import java.lang.String;
import java.util.Map;
/**
* DO NOT EDIT THIS FILE!!! IT WAS GENERATED BY AROUTER. */
public class ARouter$$Providers$$mogocorefunctionstartup implements IProviderGroup {
@Override
public void loadInto(Map<String, RouteMeta> providers) {
providers.put("com.mogo.eagle.core.function.api.startup.IStartUpProvider", RouteMeta.build(RouteType.PROVIDER, MogoStartUpProvider.class, "/start_up/api", "start_up", null, -1, -2147483648));
}
}

View File

@@ -0,0 +1,17 @@
package com.alibaba.android.arouter.routes;
import com.alibaba.android.arouter.facade.template.IRouteGroup;
import com.alibaba.android.arouter.facade.template.IRouteRoot;
import java.lang.Class;
import java.lang.Override;
import java.lang.String;
import java.util.Map;
/**
* DO NOT EDIT THIS FILE!!! IT WAS GENERATED BY AROUTER. */
public class ARouter$$Root$$mogocorefunctionstartup implements IRouteRoot {
@Override
public void loadInto(Map<String, Class<? extends IRouteGroup>> routes) {
routes.put("start_up", ARouter$$Group$$start_up.class);
}
}

View File

@@ -1,3 +1,3 @@
GROUP=com.mogo.eagle.core.function.impl
POM_ARTIFACT_ID=obu-mogo
POM_ARTIFACT_ID=startup
VERSION_CODE=1

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.eagle.core.function.startup">
<application>
</application>
</manifest>

View File

@@ -0,0 +1,89 @@
package com.mogo.eagle.core.function.startup
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.startup.IStartUpProvider
import com.mogo.eagle.core.function.startup.stageone.APMStartup
import com.mogo.eagle.core.function.startup.stageone.HttpDnsStartUp
import com.mogo.eagle.core.function.startup.stageone.ThreadOptStartup
import com.mogo.eagle.core.function.startup.stagetwo.AutopilotStartUp
import com.mogo.eagle.core.function.startup.stagetwo.DataCenterStartUp
import com.mogo.eagle.core.function.startup.stagetwo.ObuStartUp
import com.mogo.eagle.core.function.startup.stagetwo.V2XStartUp
import com.rousetime.android_startup.StartupListener
import com.rousetime.android_startup.StartupManager
import com.rousetime.android_startup.model.CostTimesModel
import com.rousetime.android_startup.model.LoggerLevel
import com.rousetime.android_startup.model.StartupConfig
import org.greenrobot.eventbus.EventBus
@Route(path = MogoServicePaths.PATH_STARTUP_PROVIDER)
class MogoStartUpProvider: IStartUpProvider {
private var context: Context? = null
override fun init(context: Context?) {
this.context = context
}
private val startupListener: StartupListener =
object : StartupListener {
override fun onCompleted(
totalMainThreadCostTime: Long,
costTimesModels: List<CostTimesModel>
) {
EventBus.getDefault().postSticky(costTimesModels)
}
}
override fun initStageOne() {
var config: StartupConfig? = null
config = if (DebugConfig.isDebug()) {
StartupConfig.Builder()
.setLoggerLevel(LoggerLevel.DEBUG)
.setOpenStatistics(true)
.setListener(startupListener)
.build()
} else {
StartupConfig.Builder()
.setLoggerLevel(LoggerLevel.NONE)
.setOpenStatistics(false)
.setAwaitTimeout(10000L)
.setListener(startupListener)
.build()
}
context?.let {
StartupManager.Builder()
.addStartup(HttpDnsStartUp())
.addStartup(APMStartup())
.addStartup(ThreadOptStartup())
.setConfig(config)
.build(it)
.start()
.await()
}
}
override fun initStageTwo() {
var config: StartupConfig? = null
if (DebugConfig.isDebug()) {
config = StartupConfig.Builder()
.setLoggerLevel(LoggerLevel.DEBUG)
.setOpenStatistics(true)
.build()
}
context?.let {
StartupManager.Builder()
.addStartup(DataCenterStartUp())
.addStartup(AutopilotStartUp())
.addStartup(ObuStartUp())
.addStartup(V2XStartUp())
.setConfig(config)
.build(it)
.start()
.await()
}
}
}

View File

@@ -0,0 +1,26 @@
package com.mogo.eagle.core.function.startup.stageone
import android.content.Context
import com.rousetime.android_startup.AndroidStartup
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.test.crashreport.CrashReportConstants
class APMStartup : AndroidStartup<Boolean?>() {
override fun create(context: Context): Boolean? {
// apm
ARouter.getInstance().build(CrashReportConstants.PATH).navigation()
return true
}
override fun callCreateOnMainThread(): Boolean {
return true
}
override fun waitOnMainThread(): Boolean {
return false
}
override fun dependenciesByName(): List<String> {
return listOf("com.mogo.eagle.core.function.startup.stageone.ThreadOptStartup")
}
}

View File

@@ -0,0 +1,378 @@
package com.mogo.eagle.core.function.startup.stageone
import android.content.Context
import com.mogo.aicloud.services.httpdns.HttpDnsConst
import com.mogo.aicloud.services.httpdns.IMogoHttpDns
import com.mogo.aicloud.services.httpdns.MogoHttpDnsHandler
import com.mogo.aicloud.services.locationinfo.MogoLocationInfoServices
import com.mogo.aicloud.services.socket.IMogoLifecycleListener
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
import com.mogo.cloud.httpdns.MogoHttpDnsConfig
import com.mogo.cloud.httpdns.bean.HttpDnsSimpleLocation
import com.mogo.cloud.httpdns.listener.IHttpDnsCurrentLocation
import com.mogo.cloud.httpdns.listener.OnAddressChangedListener
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.constants.HostConst
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.network.Utils
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_HTTP_DNS_CHANGED
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
import com.mogo.eagle.core.function.api.autopilot.*
import com.mogo.eagle.core.function.call.analytics.AnalyticsManager
import com.mogo.eagle.core.function.call.autopilot.*
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.CallerMapLocationListenerManager
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.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.AppUtils
import com.mogo.eagle.core.utilcode.util.ProcessUtils
import com.mogo.eagle.core.utilcode.util.ThreadPoolService
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.rousetime.android_startup.AndroidStartup
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
import mogo.telematics.pad.MessagePad.GnssInfo
class HttpDnsStartUp : AndroidStartup<Boolean>() {
private val TAG = "MogoApplication"
// 配置云服务API
private val clientConfig by lazy {
MoGoAiCloudClientConfig.getInstance()
}
// 缓存IP地址
private var cacheIp: String? = null
private lateinit var mogoHttpDns: IMogoHttpDns
private var context: Context? = null
private var gotToken = false
override fun callCreateOnMainThread() = true
override fun waitOnMainThread() = false
override fun dependenciesByName(): List<String> {
return listOf(
"com.mogo.eagle.core.function.startup.stageone.APMStartup"
)
}
override fun create(context: Context): Boolean {
this.context = context
initGDLoc()
initHttpDns()
return true
}
private fun initGDLoc() {
CallerMapUIServiceManager.getGDLocationServer(context!!)?.start()
}
/**
* 初始化 HttpDNS ,这里会通过一个接口获取所有鹰眼中使用的微服务域名以及端口号
* 后续的网络请求会通过 HttpDnsInterceptor 进行拦截替换
*/
private fun initHttpDns() {
mogoHttpDns = MogoHttpDnsHandler.getHttpDnsApi()
preparePassportEnvironment()
}
private fun preparePassportEnvironment() {
// 设置网络环境HTTP_DNS_ENV_QA、HTTP_DNS_ENV_RELEASE、HTTP_DNS_ENV_DEV
when (DebugConfig.getNetMode()) {
DebugConfig.NET_MODE_DEV -> clientConfig.netMode = MogoHttpDnsConfig.HTTP_DNS_ENV_DEV
DebugConfig.NET_MODE_QA -> clientConfig.netMode = MogoHttpDnsConfig.HTTP_DNS_ENV_QA
DebugConfig.NET_MODE_DEMO -> clientConfig.netMode = MogoHttpDnsConfig.HTTP_DNS_ENV_DEMO
else -> clientConfig.netMode = MogoHttpDnsConfig.HTTP_DNS_ENV_RELEASE
}
// 设置是否是第三APP登录
clientConfig.isThirdLogin =
DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE
// 设置是否输出日志
clientConfig.isShowDebugLog = true
// 使用中台长链接
clientConfig.isUseOriginSocket = true
// 设置是否输出网络日志
clientConfig.isShowNetDebugLog = false
// 设置是否是直播推流的主播
clientConfig.isAnchor = true
when (DebugConfig.getCarMachineType()) {
DebugConfig.CAR_MACHINE_TYPE_BYD -> clientConfig.thirdPartyAppKey = "bydauto"
DebugConfig.CAR_MACHINE_TYPE_LENOVO -> clientConfig.thirdPartyAppKey = "pfieouqg"
else -> clientConfig.thirdPartyAppKey = "wbvpzgar"
}
// 设置应用服务AppId 长链、鉴权
if (DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE) {
clientConfig.serviceAppId = "com_mogo_launcher"
} else {
clientConfig.serviceAppId = "com.mogo.launcher"
}
// 设置AI云平台分配给三方应用的签名密钥需要从AI云平台申请
// 设置车机设备的唯一标识(这些表识必须是通过后台录入的设备)
// TODO 现在这块逻辑因为网约车业务那后台的限制,还没有更换,条件成熟后替换为 DeviceIdUtils.getWidevineIDWithMd5(context)
// 这里影响当前Activity的身份信息多进程先保持与原来一样主进程为司机端:passenger 进程为乘客端
if (ProcessUtils.getCurrentProcessName().contains(":passenger")) {
clientConfig.thirdPartyDeviceId = Utils.getDevicesId() + "_passenger"
} else {
clientConfig.thirdPartyDeviceId = Utils.getDevicesId()
}
// 设置循环检测间隔时间每隔2小时loop一次httpDnsConfig
clientConfig.loopCheckDelay = (60 * 60 * 2 * 1000).toLong()
//设置长链接的secretKey //todo 通过SHA1和包名找中台服务生成后续包名分渠道,需要做对应操作
clientConfig.secretKey = "YMj2VFDFxJ3Q4gNoZceJ"
clientConfig.iHttpDnsCurrentLocation = object : IHttpDnsCurrentLocation {
override fun getCurrentLocation(): HttpDnsSimpleLocation {
val envConfig = CallerDevaToolsManager.getEnvConfig()
if (envConfig != null) {
return HttpDnsSimpleLocation(envConfig.cityCode, envConfig.lat, envConfig.lon)
}
var mogoLocation: MogoLocation? = null
val locationClient = CallerMapLocationListenerManager.getCurrentLocation()
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
)
}
} 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)
}
}
return httpDnsSimpleLocation
}
}
initAiCloudSDK()
}
private fun initAiCloudSDK() {
// 初始化SDK可以设置状态回调来监听
MoGoAiCloudClient.getInstance().init(context, clientConfig).addTokenCallbacks(
object : IMoGoTokenCallback {
override fun onTokenGot(token: String, sn: String) {
clientConfig.token = token
// 由于存在token过期问题在更新后会回调至此处增加二次判定
if (!gotToken) {
CallerLogger.d(
SceneConstant.M_MAIN + TAG,
"onTokenGot token : $token , sn :$sn"
)
CallerCloudListenerManager.invokeCloudTokenGot(token, sn)
// 异步初始化NetConfig
asyncInit()
// HttpDns ttl回调 --- socketTTL
// registerSocketHttpDnsTTL()
startSocketService()
// 开启每5s/次定位上报
uploadLocPerFiveSecond()
gotToken = true
}
}
override fun onError(code: Int, msg: String) {
CallerLogger.d(
SceneConstant.M_MAIN + TAG,
"初始化MogoAiCloudSdk failed ,reason : $msg , 未能开启长链服务和初始化Modules服务"
)
}
}
)
}
/**
* 异步初始化
*/
private fun asyncInit() {
ThreadPoolService.execute {
//初始化网络配置
NetConfigUtils.init()
// 初始化埋点
AnalyticsManager.init(context, DebugConfig.isDebug())
// 加入启动统计
val mStartParams: HashMap<String, Any> = HashMap()
mStartParams["start_time"] = TimeUtils.getNowMills()
mStartParams["app_version"] = AppUtils.getAppVersionName()
mStartParams["app_flavor"] = DebugConfig.getProductFlavor();
mStartParams["app_identity_mode"] = FunctionBuildConfig.appIdentityMode
AnalyticsManager.track("app_start_time", mStartParams)
}
}
/**
* 请求获取最新的 DNS 微服务 域名信息
*/
private fun registerSocketHttpDnsTTL() {
mogoHttpDns.addressChangedListener(object : OnAddressChangedListener {
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS,
linkCode = CHAIN_LINK_CLOUD,
endpoint = PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_HTTP_DNS_CHANGED,
paramIndexes = [0, 1],
clientPkFileName = "sn"
)
override fun onAddressChanged(cityCode: String, address: Map<String, String>?) {
val dnsCacheIp = mogoHttpDns.getCachedHttpDnsIps(
HostConst.SOCKET_CENTER_DOMAIN,
HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_HTTP
) ?: return
if (dnsCacheIp != cacheIp) {
CallerLogger.d(
SceneConstant.M_MAIN + TAG,
"获取缓存Dns IP : $dnsCacheIp , 原缓存 IP $cacheIp"
)
cacheIp = dnsCacheIp
}
}
})
}
/**
* 上传自车位置信息到云端
*/
private fun uploadLocPerFiveSecond() {
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
context?.let {
MogoLocationInfoServices.getInstance().init(it)
MogoLocationInfoServices.getInstance().start()
CallerChassisLocationGCJ20ListenerManager.addListener(
TAG,
object : IMoGoChassisLocationGCJ02Listener {
override fun onChassisLocationGCJ02(gnssInfo: GnssInfo?) {
CallerMapLocationListenerManager.getCurrentLocation()?.let { loc ->
MogoLocationInfoServices.getInstance().provideLocation(loc)
}
}
},
)
}
}
}
private fun startSocketService() {
CallerLogger.d(SceneConstant.M_MAIN + TAG, "startSocketService")
val location = CallerMapLocationListenerManager.getCurrentLocation()
// 关闭长链服务
MogoAiCloudSocketManager.getInstance(context).destroy()
MogoAiCloudSocketManager.getInstance(context)
.registerLifecycleListener(10020, object : IMogoLifecycleListener {
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS,
linkCode = CHAIN_LINK_CLOUD,
endpoint = PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_CLOUD_CONNECT_FAIL,
paramIndexes = [-1],
clientPkFileName = "sn"
)
override fun onConnectFailure() {
CallerLogger.d(SceneConstant.M_MAIN + TAG, "socket-onConnectFailure")
MogoStatusManager.getInstance().setCloudSocketMode(TAG, false)
}
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS,
linkCode = CHAIN_LINK_CLOUD,
endpoint = PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_CLOUD_CONNECT_SUCCESS,
paramIndexes = [-1],
clientPkFileName = "sn"
)
override fun onConnectSuccess() {
CallerLogger.d(SceneConstant.M_MAIN + TAG, "socket-onConnectSuccess")
MogoStatusManager.getInstance().setCloudSocketMode(TAG, true)
}
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS,
linkCode = CHAIN_LINK_CLOUD,
endpoint = PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_CLOUD_CONNECT_LOST,
paramIndexes = [-1],
clientPkFileName = "sn"
)
override fun onConnectLost() {
CallerLogger.d(SceneConstant.M_MAIN + TAG, "socket-onConnectLost")
MogoStatusManager.getInstance().setCloudSocketMode(TAG, false)
}
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS,
linkCode = CHAIN_LINK_CLOUD,
endpoint = PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_CLOUD_CONNECT_LOST,
paramIndexes = [0, 1],
clientPkFileName = "sn"
)
override fun onError(code: String, msg: String?) {
CallerLogger.d(
SceneConstant.M_MAIN + TAG,
"socket-onError code : $code , msg : $msg"
)
}
})
// 开启Socket长链服务
val lat =
location?.latitude ?: CallerMapUIServiceManager.getGDLocationServer(context!!)!!.lastLat
val lon = location?.longitude
?: CallerMapUIServiceManager.getGDLocationServer(context!!)!!.lastLon
MogoAiCloudSocketManager.getInstance(context)
.init(context, DebugConfig.getSocketAppId(), lat, lon)
}
}

View File

@@ -0,0 +1,43 @@
package com.mogo.eagle.core.function.startup.stageone
import com.rousetime.android_startup.BuildConfig
import com.rousetime.android_startup.StartupListener
import com.rousetime.android_startup.model.CostTimesModel
import com.rousetime.android_startup.model.LoggerLevel
import com.rousetime.android_startup.model.StartupConfig
import com.rousetime.android_startup.provider.StartupProviderConfig
import org.greenrobot.eventbus.EventBus
class MogoStartupProviderConfig: StartupProviderConfig {
private val startupListener by lazy {
object : StartupListener {
override fun onCompleted(
totalMainThreadCostTime: Long,
costTimesModels: List<CostTimesModel>
) {
EventBus.getDefault().postSticky(costTimesModels)
}
}
}
override fun getConfig(): StartupConfig {
return when {
BuildConfig.DEBUG -> {
StartupConfig.Builder()
.setLoggerLevel(LoggerLevel.DEBUG)
.setOpenStatistics(true)
.setListener(startupListener)
.build()
}
else -> {
StartupConfig.Builder()
.setLoggerLevel(LoggerLevel.NONE)
.setOpenStatistics(false)
.setAwaitTimeout(10000L)
.setListener(startupListener)
.build()
}
}
}
}

View File

@@ -0,0 +1,30 @@
package com.mogo.eagle.core.function.startup.stageone
import android.content.*
import com.mogo.thread.ext.core.*
import com.mogo.thread.ext.core.config.*
import com.rousetime.android_startup.*
import java.util.concurrent.TimeUnit.SECONDS
class ThreadOptStartup: AndroidStartup<Boolean>() {
override fun create(context: Context): Boolean {
ThreadManager
.init(ThreadConfig.Builder()
.maxKeepAliveTime(5, SECONDS)
/*.dump(DumpConfig.Builder()
.dumpLogFilePath(File(context.getExternalFilesDir(null), "thread_dump_log_${ SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.ROOT).format(Date()) }.txt").absolutePath)
.dumpPeriod(5, SECONDS)
.threadRunThreshold(10, SECONDS)
.build())*/)
return true
}
override fun callCreateOnMainThread(): Boolean {
return true
}
override fun waitOnMainThread(): Boolean {
return true
}
}

View File

@@ -0,0 +1,28 @@
package com.mogo.eagle.core.function.startup.stagetwo
import android.content.Context
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.rousetime.android_startup.AndroidStartup
class AutopilotStartUp: AndroidStartup<Boolean>() {
override fun create(context: Context): Boolean? {
ARouter.getInstance().build(MogoServicePaths.PATH_AUTO_PILOT).navigation()
return true
}
override fun callCreateOnMainThread(): Boolean {
return true
}
override fun waitOnMainThread(): Boolean {
return false
}
override fun dependenciesByName(): List<String>? {
val deps = arrayListOf<String>()
deps.add("com.mogo.eagle.core.function.startup.stagetwo.DataCenterStartUp")
return deps
}
}

View File

@@ -0,0 +1,22 @@
package com.mogo.eagle.core.function.startup.stagetwo
import android.content.Context
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.rousetime.android_startup.AndroidStartup
class DataCenterStartUp: AndroidStartup<Boolean>() {
override fun create(context: Context): Boolean? {
ARouter.getInstance().build(MogoServicePaths.PATH_DATA_CENTER_MODULE).navigation()
return true
}
override fun callCreateOnMainThread(): Boolean {
return true
}
override fun waitOnMainThread(): Boolean {
return true
}
}

View File

@@ -0,0 +1,28 @@
package com.mogo.eagle.core.function.startup.stagetwo
import android.content.Context
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.rousetime.android_startup.AndroidStartup
class ObuStartUp: AndroidStartup<Boolean>() {
override fun create(context: Context): Boolean? {
ARouter.getInstance().build(MogoServicePaths.PATH_V2X_OBU_MOGO).navigation()
return true
}
override fun callCreateOnMainThread(): Boolean {
return true
}
override fun waitOnMainThread(): Boolean {
return false
}
override fun dependenciesByName(): List<String>? {
val deps = arrayListOf<String>()
deps.add("com.mogo.eagle.core.function.startup.stagetwo.DataCenterStartUp")
return deps
}
}

View File

@@ -0,0 +1,28 @@
package com.mogo.eagle.core.function.startup.stagetwo
import android.content.Context
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.rousetime.android_startup.AndroidStartup
class V2XStartUp: AndroidStartup<Boolean>() {
override fun create(context: Context): Boolean? {
ARouter.getInstance().build(MogoServicePaths.PATH_V2X_MODULE).navigation()
return true
}
override fun callCreateOnMainThread(): Boolean {
return true
}
override fun waitOnMainThread(): Boolean {
return false
}
override fun dependenciesByName(): List<String>? {
val deps = arrayListOf<String>()
deps.add("com.mogo.eagle.core.function.startup.stagetwo.DataCenterStartUp")
return deps
}
}

View File

@@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.eagle.core.function.v2x">
<application>
<receiver android:name=".events.receiver.TestPanelBroadcastReceiver">
<receiver android:name=".events.test.TestV2XReceiver">
<intent-filter>
<action android:name="com.v2x.test_panel_control" />
<category android:name="android.intent.category.DEFAULT" />

View File

@@ -19,15 +19,15 @@ import com.mogo.eagle.core.data.map.entity.MarkerExploreWay
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity
import com.mogo.eagle.core.data.msgbox.DataSourceType
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.data.traffic.*
import com.mogo.eagle.core.function.api.autopilot.*
import com.mogo.eagle.core.function.api.hmi.warning.*
import com.mogo.eagle.core.function.api.map.listener.*
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.function.call.hmi.*
import com.mogo.eagle.core.function.call.map.*
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Default
@@ -36,10 +36,8 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.v2x.events.alarm.*
import com.mogo.eagle.core.function.v2x.events.bridge.*
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.context
import com.mogo.eagle.core.function.v2x.events.consts.*
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.*
import com.mogo.eagle.core.function.v2x.events.manager.*
import com.mogo.eagle.core.function.v2x.events.observer.*
import com.mogo.eagle.core.function.v2x.events.receiver.*
import com.mogo.eagle.core.function.v2x.events.scenario.impl.*
import com.mogo.eagle.core.function.v2x.events.utils.*
@@ -49,12 +47,10 @@ import com.mogo.eagle.core.function.v2x.internal.callback.IV2XCallback
import com.mogo.eagle.core.function.v2x.internal.config.V2XConfig
import com.mogo.eagle.core.function.v2x.internal.data.V2XAdvanceWarning
import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerCardResult
import com.mogo.eagle.core.function.v2x.internal.data.V2XOptimalRoute
import com.mogo.eagle.core.function.v2x.internal.data.V2XWarningTarget
import com.mogo.eagle.core.function.v2x.internal.event.V2XEvent
import com.mogo.eagle.core.function.v2x.road.V2XEventServiceApi
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.network.utils.*
import com.mogo.eagle.core.utilcode.mogo.logger.*
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
import com.mogo.eagle.core.utilcode.util.*
@@ -72,12 +68,13 @@ import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.*
import kotlinx.coroutines.android.*
import mogo.telematics.pad.MessagePad.GnssInfo
import tv.danmaku.ijk.media.player.*
import java.util.concurrent.*
import java.util.concurrent.atomic.*
object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallback {
object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback, IV2XCallback {
private const val TAG = "V2XEventManager"
@@ -87,8 +84,6 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
private val hasInit by lazy { AtomicBoolean(false) }
// 记录历史行驶轨迹,用于车行驶方向计算,只保留两个数据
private val historyPath = arrayOfNulls<MogoLocation>(2)
var v2xEventDisposable: Disposable? = null
@@ -120,7 +115,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
private fun registerListener() {
V2XManager.addCallback(this)
CallerMapLocationListenerManager.addListener(TAG, this, false)
CallerChassisLocationGCJ20ListenerManager.addListener(TAG, this)
mogoMarkersHandler.registerMarkerClickListener(CARD_TYPE_ROAD_CONDITION,
object : IMogoMarkerClickListener {
override fun onMarkerClicked(marker: IMogoMarker?): Boolean {
@@ -132,8 +127,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
private fun unRegisterListener() {
V2XManager.removeCallback(this)
CallerMapLocationListenerManager.removeListener(TAG, false)
CallerChassisLocationGCJ20ListenerManager.removeListener(TAG)
mogoMarkersHandler.unregisterMarkerClickListener(CARD_TYPE_ROAD_CONDITION)
}
@@ -162,8 +156,8 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
v2XMessageEntity.isOnlyShow = true
v2XMessageEntity.isNeedAddLine = false
v2XMessageEntity.content = roadEventEntity
val intent = Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION)
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity)
val intent = Intent(BROADCAST_SCENE_HANDLER_ACTION)
intent.putExtra(BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity)
LocalBroadcastManager.getInstance(context()).sendBroadcast(intent)
//埋点
TrackUtils.trackV2XMarkerClick(2)
@@ -194,20 +188,8 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
return null
}
/**
* 刷新自车求助状态
*
* @param isTrue
*/
private fun refreshMeSeekHelp(isTrue: Boolean) {
val entity = V2XMessageEntity<Boolean>()
entity.type = V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP
entity.content = isTrue
V2XScenarioManager.getInstance().handlerMessage(entity)
}
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
location ?: return
override fun onChassisLocationGCJ02(gnssInfo: GnssInfo?) {
val location = CallerMapLocationListenerManager.getCurrentLocation() ?: return
BridgeApi.location.set(location)
if (V2XManager.hasInit()) {
V2XManager.onLocationChanged(
@@ -215,35 +197,12 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
latitude = location.latitude
)
}
V2XOptimalRouteObserver.getInstance().update(location)
refreshCarState(location)
}
private fun refreshCarState(location: MogoLocation) {
V2XStatusManager.getInstance().location = location
val v2xPolyline = BridgeApi.v2xPolyline()?.mogoPolyline
val isRoadEventPOIShow = BridgeApi.v2xStatus()?.isRoadEventPOIShow ?: false
val v2xStatusManager = V2XStatusManager.getInstance()
if (v2xPolyline != null && (isRoadEventPOIShow) && v2xStatusManager.targetMoGoLatLng != null) { // 取出原有的绘制线的经纬度点
// 取出原有的绘制线的经纬度点
val pointsOdl: MutableList<MogoLatLng> = v2xPolyline.points // 重新设置第一个坐标,也就是当前车辆位置
// 重新设置第一个坐标,也就是当前车辆位置
pointsOdl[0] = MogoLatLng(location.latitude, location.longitude)
v2xPolyline.points = pointsOdl
//CallerLogger.d("$M_V2X$TAG", "当前地图的缩放比例为:" + zoomLevel);
val zoomLevel: Float = CallerMapUIServiceManager.getMapUIController()?.zoomLevel ?: 0.0f
//CallerLogger.d("$M_V2X$TAG", "当前地图的缩放比例为:" + zoomLevel);
if (zoomLevel > 0 && zoomLevel <= 17) { // 缩放地图
val context: Context = context()
MapUtils.zoomMap(v2xStatusManager.targetMoGoLatLng, context)
}
}
// 巡航处理
val v2XRoadEventEntity = V2XAlarmServer.getDriveFrontAlarmEvent(
BridgeApi.v2xMarker()?.v2XRoadEventEntityList,
V2XStatusManager.getInstance().location
)
BridgeApi.v2xMarker()?.v2XRoadEventEntityList, location)
if (v2XRoadEventEntity != null) {
val distance = v2XRoadEventEntity.distance
val min = if (EventTypeEnumNew.isCloudSocketEvent(v2XRoadEventEntity.poiType)) 0 else 5
@@ -289,9 +248,6 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
is V2XEvent.ForwardsWarning -> {
handleAdvanceWarningEvent(event)
}
is V2XEvent.OptimalRoute -> {
handleOptimalRouteEvent(event)
}
is V2XEvent.Marker -> {
event.data.result?.let {
handleRoadMarkerEvent(it)
@@ -315,6 +271,9 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
is V2XEvent.RoadEventX -> {
handleRoadMarkerEvent(event.data.toRoadMarker())
}
else -> {
Logger.d(TAG, "other event: $event")
}
}
}
private fun handleWarningTargetEvent(data: V2XWarningTarget) {
@@ -337,17 +296,6 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
}
}
private fun handleOptimalRouteEvent(event: V2XEvent.OptimalRoute) {
val v2xMessageEntity: V2XMessageEntity<V2XOptimalRoute> =
V2XMessageEntity<V2XOptimalRoute>() // 控制类型
v2xMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW // 设置数据
v2xMessageEntity.content = event.data // 控制展示状态
v2xMessageEntity.isShowState = true
val intent = Intent(BROADCAST_SCENE_HANDLER_ACTION)
intent.putExtra(BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity)
LocalBroadcastManager.getInstance(Utils.getApp()).sendBroadcast(intent)
}
private fun handleAdvanceWarningEvent(event: V2XEvent.ForwardsWarning) {
scope.launch {
val message = event.data
@@ -377,12 +325,10 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
}
1003 -> {
// 交叉路口碰撞预警
/*
TODO xiaopeng 先注掉,编译通过
changeVisualAngle = true
tempAppId = EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType.toInt()
tempTts = EventTypeEnumNew.TYPE_USECASE_ID_ICW.tts
tempContent = EventTypeEnumNew.TYPE_USECASE_ID_ICW.content*/
tempContent = EventTypeEnumNew.TYPE_USECASE_ID_ICW.content
}
1004 -> {
// 交叉路口碰撞预警
@@ -424,7 +370,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
}
}
// 不显示弹框,其它保留
if (tempContent.isNullOrEmpty() || tempTts.isNullOrEmpty()) {
if (tempContent.isEmpty() || tempTts.isEmpty()) {
Log.d("MsgBox-V2XEventManager", "alertContent或ttsContent为空!")
}
CallerMsgBoxManager.saveMsgBox(

View File

@@ -1,15 +1,18 @@
package com.mogo.eagle.core.function.v2x.events.alarm;
import android.util.Log;
import com.mogo.eagle.core.data.enums.EventTypeEnumNew;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.data.map.entity.MarkerLocation;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.data.enums.EventTypeEnum;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils;
import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;
import io.netty.util.internal.ConcurrentSet;
import android.util.Log;
/**
* @author donghongyu
@@ -25,6 +28,8 @@ import android.util.Log;
*/
public class V2XAlarmServer {
private static final String TAG = "V2XAlarmServer";
// 记录道路播报的事件
private static final ConcurrentSet<V2XRoadEventEntity> showedEvents = new ConcurrentSet<>();
/**
@@ -34,7 +39,7 @@ public class V2XAlarmServer {
CopyOnWriteArrayList<V2XRoadEventEntity> v2XRoadEventEntityList,
MogoLocation currentLocation) {
try {
Log.d("RWJ", "getDriveFrontAlarmEvent --- 1 ---" + currentLocation );
Logger.d(TAG, "getDriveFrontAlarmEvent --- 1 ---" + currentLocation );
if (!showedEvents.isEmpty()) {
Iterator<V2XRoadEventEntity> iterator = showedEvents.iterator();
while (iterator.hasNext()) {
@@ -51,20 +56,20 @@ public class V2XAlarmServer {
}
}
}
Log.d("RWJ", "getDriveFrontAlarmEvent --- 2 ---" + currentLocation);
Logger.d(TAG, "getDriveFrontAlarmEvent --- 2 ---" + currentLocation);
if (currentLocation != null && v2XRoadEventEntityList != null) {
// 因为集合是按照距离排序后的所以这里检索出来第一个就发出警告
for (V2XRoadEventEntity v2XRoadEventEntity : v2XRoadEventEntityList) {
// 0、道路事件必须有朝向角度>=0;
Log.d("RWJ", "entity:" + v2XRoadEventEntity.getLocation());
Logger.d(TAG, "entity:" + v2XRoadEventEntity.getLocation());
if (v2XRoadEventEntity.getLocation().getAngle() >= 0) {
// 计算车辆距离指定气泡的距离
MarkerLocation eventLocation = v2XRoadEventEntity.getLocation();
// 1、判断是否到达了触发距离,20 ~ 500,
double distance = v2XRoadEventEntity.getDistance();
Log.d("RWJ", "distance:" + distance);
Logger.d(TAG, "distance:" + distance);
if (distance <= 500) {
if (EventTypeEnum.GHOST_PROBE.getPoiType().equals(v2XRoadEventEntity.getPoiType())) {
if (EventTypeEnumNew.GHOST_PROBE.getPoiType().equals(v2XRoadEventEntity.getPoiType())) {
if (distance > 25) {
continue;
}
@@ -73,7 +78,7 @@ public class V2XAlarmServer {
double carBearing = currentLocation.getBearing();
double eventBearing = eventLocation.getAngle();
double diffAngle = DrivingDirectionUtils.getAngleDiff(carBearing, eventBearing);
Log.d("RWJ", "car_bearing:" + carBearing + ",eventBearing:" + eventBearing + ",diffAngle:" + diffAngle);
Logger.d(TAG, "car_bearing:" + carBearing + ",eventBearing:" + eventBearing + ",diffAngle:" + diffAngle);
if (diffAngle <= 20) {
// 3、计算当前车辆行驶方向与事件位置之间夹角《20度保证道路事件在车辆前方
double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
@@ -84,12 +89,12 @@ public class V2XAlarmServer {
(int) currentLocation.getBearing()
);
Log.d("RWJ", "eventAngle:" + eventAngle);
Logger.d(TAG, "eventAngle:" + eventAngle);
if (0 <= eventAngle && eventAngle <= 20) {
if (showedEvents.contains(v2XRoadEventEntity)) {
return null;
}
Log.d("RWJ", "showed---");
Logger.d(TAG, "showed---");
showedEvents.add(v2XRoadEventEntity);
return v2XRoadEventEntity;
}
@@ -100,7 +105,7 @@ public class V2XAlarmServer {
}
} catch (Exception e) {
e.printStackTrace();
Log.w("RWJ", "error: " + e.getMessage());
Logger.w(TAG, "error: " + e.getMessage());
}
return null;
}

View File

@@ -23,10 +23,6 @@ internal object BridgeApi {
ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_MARKER_MANAGER).navigation(context()) as? IMoGoV2XMarkerManager
}
private val v2xPolyline by lazy {
ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_POLYLINE_MANAGER).navigation(context()) as? IMoGoV2XPolylineManager
}
private val v2xWarnPolyline by lazy {
ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER).navigation(context()) as? IMoGoWarnPolylineManager
}
@@ -39,10 +35,6 @@ internal object BridgeApi {
ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STOP_POLYLINE_MANAGER).navigation(context()) as? IMoGoStopPolylineManager
}
private val v2xStatus by lazy {
ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER).navigation(context()) as? IMoGoV2XStatusManager
}
fun init(context: Context) {
this.context.set(WeakReference(context))
}
@@ -51,14 +43,9 @@ internal object BridgeApi {
fun v2xMarker() = v2xMarker
fun v2xPolyline() = v2xPolyline
fun v2xWarnPolyline() = v2xWarnPolyline
fun v2xPersonWarnPolyline() = v2xPersonWarnPolyline
fun v2xStopPolyline() = v2xStopPolyline
fun v2xStatus() = v2xStatus
}

View File

@@ -19,11 +19,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
*/
public interface IMoGoV2XMarkerManager extends IProvider {
/**
* 重新绘制最后一次的POI点
*/
void drawableLastAllPOI();
/**
* 获取所有的道路事件点,探路事件,返回结果是按照距离当前车辆从近到远排列好的
*
@@ -43,20 +38,4 @@ public interface IMoGoV2XMarkerManager extends IProvider {
* @return
*/
IMogoMarker drawableAlarmPOI(Context context, V2XRoadEventEntity roadEventEntity, IMogoMarkerClickListener clickListener);
/**
* 清除 道路事件 POI
*/
void clearAlarmPOI();
/**
* 清除 所有的 POI
*/
void clearALLPOI();
/**
* 强制清除道路事件POI
*/
void forceClearAlarmPOI();
}

View File

@@ -1,31 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.manager;
import android.content.Context;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.map.overlay.IMogoPolyline;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/4/17 9:49 PM
* desc : 当前车辆与道路事件的连接线
* version: 1.0
*/
public interface IMoGoV2XPolylineManager extends IProvider {
/**
* 绘制连接线,目标车,与当前车辆间连线
*
* @param context
* @param roadEventEntity
*/
void drawablePolyline(Context context, V2XRoadEventEntity roadEventEntity);
/**
* 移除连接线
*/
void clearLine();
IMogoPolyline getMogoPolyline();
}

View File

@@ -1,19 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.manager;
import com.alibaba.android.arouter.facade.template.IProvider;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/4/17 7:44 PM
* desc : 状态控制器监听
* version: 1.0
*/
public interface IMoGoV2XStatusChangedListener extends IProvider {
/**
* @param descriptor 状态类型
* @param isTrue true - v2x ui show
*/
void onStatusChanged(V2XStatusDescriptor descriptor, boolean isTrue);
}

View File

@@ -1,34 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.manager;
import com.alibaba.android.arouter.facade.template.IProvider;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/4/17 7:20 PM
* desc : V2X 状态管理
* version: 1.0
*/
public interface IMoGoV2XStatusManager extends IProvider {
/**
* 地图区域 V2X道路预警POI 是否在展示
*/
boolean isRoadEventPOIShow();
/**
* 设置 V2X道路预警POI 是否在展示
*
* @param tag
* @param show
*/
void setRoadEventPOIShow(String tag, boolean show);
/**
* 地图区域 推送的 POI 是否在展示
*
* @param tag
* @param show
*/
void setPushPOIShow(String tag, boolean show);
}

View File

@@ -1,70 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.manager;
/**
* @author congtaowang
* @since 2020-01-04
* <p>
* 状态描述
*/
public enum V2XStatusDescriptor {
/**
* 地图 V2X道路预警POI
*/
RoadEventPOI_UI,
/**
* 按钮 V2X道路预警
*/
RoadEventButton_UI,
/**
* 头部 V2X道路预警 UI
*/
RoadEventWindow_UI,
/**
* 头部 V2X的道路直播 UI
*/
RoadLiveCarWindow_UI,
/**
* 地图 他人车辆故障求助POI
*/
OtherSeekHelpPOI_UI,
/**
* 头部 他人车辆故障求助 UI 是否在展示
*/
OtherSeekHelpWindow_UI,
/**
* 右侧2/3 V2X 场景动画 UI 是否在展示
*/
V2XAnimationWindow_UI,
/**
* 右侧2/3 左下角 模拟直播车机 UI 是否在展示
*/
LiveCarWindow_UI,
/**
* 右侧2/3 左下角 模拟直播车机 UI 是否在展示
*/
V2XRoadVideo_UI,
/**
* 推送的POI
*/
PushWindowPOI_UI,
/**
* 推送的弹窗
*/
PushWindow_UI,
/**
* 疲劳驾驶弹窗
*/
FatigueDrivingWindow_UI
}

Some files were not shown because too many files have changed in this diff Show More