diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/obu/V2xObuEventManager.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/obu/V2xObuEventManager.kt index 7677124647..85f54b0207 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/obu/V2xObuEventManager.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/obu/V2xObuEventManager.kt @@ -13,7 +13,6 @@ import com.mogo.eagle.core.function.call.obu.CallerObuSaveMessageListenerManager * 处理obu分发出来,在消息盒子展示的消息 */ object V2xObuEventManager : IMoGoObuSaveMessageListener { - private const val TAG = "V2xObuEventManager" fun init(context: Context) { @@ -33,7 +32,7 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener { * @param content 事件内容 * @param tts 事件语音播报 */ - override fun onMoGoObuSaveMessage(type: String, content: String, tts: String) { + override fun onMoGoObuSaveMessage(type: String, content: String, tts: String, source: DataSourceType) { CallerMsgBoxManager.saveMsgBox( MsgBoxBean( MsgBoxType.V2X, @@ -43,7 +42,7 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener { tts ) ).apply { - sourceType = DataSourceType.OBU + sourceType = source } ) } diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt index f460537065..fa5f14ed05 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt @@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.datacenter.autopilot import android.Manifest.permission import android.content.Context -import android.util.Log import androidx.annotation.RequiresPermission import chassis.SpecialVehicleTaskCmdOuterClass import com.alibaba.android.arouter.facade.annotation.Route @@ -737,4 +736,37 @@ class MoGoAutopilotControlProvider : MessageType.TYPE_RECEIVE_POINT_CLOUD) } } + + override fun sendRoboBusJinlvM1FrontDoorCmd(switchCmd: Int): Boolean { + return AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(switchCmd) + } + + override fun sendRoboBusJinlvM1AirConditionerCmd( + switchCmd: Int, + modeCmd: Int, + windSpeedCmd: Int, + temperatureCmd: Int + ): Boolean { + return AdasManager.getInstance().sendRoboBusJinlvM1AirConditionerCmd(switchCmd, modeCmd, windSpeedCmd, temperatureCmd) + } + + override fun sendRoboBusJinlvM1HeaderCmd(switchCmd: Int, windSpeedCmd: Int): Boolean { + return AdasManager.getInstance().sendRoboBusJinlvM1HeaderCmd(switchCmd, windSpeedCmd) + } + + override fun sendRoboBusJinlvM1MainLamp1Cmd(switchCmd: Int): Boolean { + return AdasManager.getInstance().sendRoboBusJinlvM1MainLamp1Cmd(switchCmd) + } + + override fun sendRoboBusJinlvM1MainLamp2Cmd(switchCmd: Int): Boolean { + return AdasManager.getInstance().sendRoboBusJinlvM1MainLamp2Cmd(switchCmd) + } + + override fun sendRoboBusJinlvM1SmallLampCmd(switchCmd: Int): Boolean { + return AdasManager.getInstance().sendRoboBusJinlvM1SmallLampCmd(switchCmd) + } + + override fun sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd: SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd): Boolean { + return AdasManager.getInstance().sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd) + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt index e2703257ff..6374bb350c 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -173,7 +173,7 @@ class MoGoAdasListenerImpl : OnAdasListener { CallerChassisLamplightListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus) //方向盘转向角数据 CallerChassisSteeringStateListenerManager.invokeAutopilotSteeringData(vehicleState.steering) - //挂挡档位数据 + //挂档档位数据 CallerChassisGearStateListenerManager.invokeAutopilotGearData(vehicleState.gear) //加速度 CallerChassisAccStateListenerManager.invokeAutopilotAcc(vehicleState.accel) @@ -237,7 +237,7 @@ class MoGoAdasListenerImpl : OnAdasListener { } chassisStates.gearSystemStates?.let { gearSystemStates -> gearSystemStates.gearPosition?.let { - //挂挡档位数据 + //挂档档位数据 CallerChassisGearStateListenerManager.invokeAutopilotGearData(it) } } diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoObuDcCombineManager.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoObuDcCombineManager.kt index f76929ab06..d97e5a1c5d 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoObuDcCombineManager.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoObuDcCombineManager.kt @@ -16,19 +16,16 @@ import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningSpatListener import com.mogo.eagle.core.function.call.hmi.CallerHmiManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager -import com.mogo.eagle.core.function.call.obu.CallerObuMapMathListenerManager -import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsiListenerManager -import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsmListenerManager -import com.mogo.eagle.core.function.call.obu.CallerObuWarningSpatListenerManager +import com.mogo.eagle.core.function.call.obu.* import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager +import com.mogo.eagle.core.function.datacenter.obu.utils.TrafficDataConvertUtilsNew import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU import com.mogo.support.obu.ObuScene import com.mogo.support.obu.constants.MogoObuConstants import kotlin.math.roundToInt - /** * * @author lixiaopeng @@ -78,7 +75,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener onMogoObuMapMath(mapMatchData) } - /** * RSI预警信息 CvxRtiThreatIndInfo(交通标志预警(前方限速、前方学校等等),交通事件预警(前方拥堵、前方积水等等)) */ @@ -140,9 +136,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener //车内标牌 MogoObuConstants.RSI_SCENE_TYPE.IVS.toString() -> { when (rsiWarningData.warningMsgList[0].signSerialNum) { -// MogoObuConstants.RTS.RTI_TYPE_INTERSECTION -> { //十字路口 -// appId = V2iEventTypeEnum.TYPE_ID_NTERSECTION.poiType -// } MogoObuConstants.RTS.RTI_TYPE_SHAPR_TURNS -> { //急转弯 appId = EventTypeEnumNew.TYPE_ID_SHAPR_TURNS.poiType } @@ -191,10 +184,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener MogoObuConstants.RTS.RTI_TYPE_SPEED_LIMIT -> { //限速 appId = EventTypeEnumNew.TYPE_USECASE_ID_ROAD_SPEED_LIMIT.poiType } -// MogoObuConstants.RTS.RTI_TYPE_GO_STRAIGHT_TURN_RIGHT -> { //直行或右转 -// appId = -// EventTypeEnumNew.TYPE_USECASE_ID_GO_STRAIGHT_TURN_RIGHT.poiType -// } MogoObuConstants.RTS.RTI_TYPE_BUS_WARNING -> { //公交提醒 appId = EventTypeEnumNew.TYPE_USECASE_ID_BUS_WARNING.poiType } @@ -258,11 +247,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener MogoObuConstants.STATUS.ADD -> { saveObuToDcData(appId, alertContent, ttsContent) showWarning(appId, alertContent, ttsContent, direction) - // 更新数据,是否需要 -// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData)?.let { -// CallerMapUIServiceManager.getMarkerService() -// ?.updateITrafficThreatLevelInfo(it) -// } } MogoObuConstants.STATUS.UPDATE -> { // 更新 @@ -272,14 +256,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener MogoObuConstants.STATUS.DELETE -> { // 关闭警告红边 CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_NON) - // 更新数据,删除标牌? -// TrafficDataConvertUtilsNew.cvxRtiThreatIndInfo2TrafficData(rsiWarningData) -// ?.let { -// // 事件结束,还原车辆颜色 -// it.threatLevel = 0x01 -// CallerMapUIServiceManager.getMarkerService() -// ?.updateITrafficInfo(it) -// } } } } @@ -296,25 +272,55 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener ) // 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu if (rsmWarningData != null && rsmWarningData.participant != null) { - var v2xType = "" - if (rsmWarningData.participant.ptcType == 1) { //机动车 - v2xType = + var v2xType = when (rsmWarningData.participant.ptcType) { + 1 -> { //机动车 EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType - } else if (rsmWarningData.participant.ptcType == 2) { //非机动车 - v2xType = + } + 2 -> { //非机动车 EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType - } else if (rsmWarningData.participant.ptcType == 3) { //行人 - v2xType = + } + 3 -> { //行人 EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType - } else { //未知 - v2xType = EventTypeEnumNew.TYPE_ERROR.poiType + } + else -> { //未知 + EventTypeEnumNew.TYPE_ERROR.poiType + } } val ttsContent = EventTypeEnumNew.getWarningTts(v2xType) val alertContent = EventTypeEnumNew.getWarningContent(v2xType) var level = -1 - val direction = - getMessageDirection(rsmWarningData.participant.targetPosition) //TODO 只有一个 + val direction = getMessageDirection(rsmWarningData.participant.targetPosition) + //模型的显示 + when (rsmWarningData.status) { + MogoObuConstants.STATUS.ADD -> { // 添加 + // 更新数据,模型变色的时候是不是update,如果不是更新,可能导致模型不变色,(add的时候,是否有level高的) TODO + TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(rsmWarningData) + ?.let { + CallerMapUIServiceManager.getMarkerService() + ?.updateITrafficThreatLevelInfo(it) + } + } + + MogoObuConstants.STATUS.UPDATE -> { // 更新 + } + + MogoObuConstants.STATUS.DELETE -> { // 删除 + // 更新数据 TODO 删除原来的,改变颜色,删除marker。不影响别的模型添加 + TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(rsmWarningData) + ?.let { + // 事件结束,还原交通参与者颜色 + it.threatLevel = 0x01 + CallerMapUIServiceManager.getMarkerService() + ?.updateITrafficThreatLevelInfo(it) + } + + //删除弱势交通元素 + CallerMapUIServiceManager.getMarkerService() + ?.removeCvxRvInfoIndInfo(rsmWarningData.participant.ptcId.toString()) + } + } + if (rsmWarningData.warningMsg != null && rsmWarningData.warningMsg.warningDataList != null && rsmWarningData.warningMsg.warningDataList.size > 0) { level = rsmWarningData.warningMsg.warningDataList[0].warningLevel CallerLogger.d( @@ -323,45 +329,36 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener rsmWarningData.warningMsg.warningDataList[0].status } --v2xType--- $v2xType ---alertContent = $alertContent ---ttsContent= $ttsContent" ) - when (rsmWarningData.warningMsg.warningDataList[0].status) { MogoObuConstants.STATUS.ADD -> { // 添加 + //更新模型的颜色 + TrafficDataConvertUtilsNew.cvxPtcThreatIndInfo2TrafficData(rsmWarningData) + ?.let { + CallerMapUIServiceManager.getMarkerService() + ?.updateITrafficThreatLevelInfo(it) + } + + if (alertContent.isEmpty() || ttsContent.isEmpty()) { + return + } saveObuToDcData(v2xType, alertContent, ttsContent) showWarning(v2xType, alertContent, ttsContent, direction) - - // 更新数据 TODO -// TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let { -//// TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it) -// CallerMapUIServiceManager.getMarkerService() -// ?.updateITrafficThreatLevelInfo(it) -// } } MogoObuConstants.STATUS.UPDATE -> {// 更新 } - // 删除 - MogoObuConstants.STATUS.DELETE -> { + MogoObuConstants.STATUS.DELETE -> { // 删除 // 关闭警告红边 CallerHmiManager.dismissWarning(WarningDirectionEnum.ALERT_WARNING_ALL) - // 更新数据 TODO 由于obu通过域控需要转换单位,这里临时转换,后面3.0不需要转换 -// TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(rsmWarningData)?.let { -// // 事件结束,还原交通参与者颜色 -// it.threatLevel = 0x01 -//// TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it) -// CallerMapUIServiceManager.getMarkerService() -// ?.updateITrafficThreatLevelInfo(it) -// } //删除弱势交通元素 CallerMapUIServiceManager.getMarkerService() ?.removeCvxRvInfoIndInfo(rsmWarningData.participant.ptcId.toString()) -// TrafficMarkerDrawer.removeCvxRvInfoIndInfo(rsmWarningData.participantOfOne.ptcID.toString()) } } } } } - } /** @@ -383,10 +380,6 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener * 地图匹配 是OBU算法输出地图匹配结果,主车匹配道路哪条路或者哪条车道 */ fun onMogoObuMapMath(data: ObuScene.MapMatchData?) { - CallerLogger.d( - "${M_OBU}${TAG}", - "MogoObuDcCombineManager onMogoObuMapMath HmiBuildConfig.isShowObuLimitSpeedView = " + HmiBuildConfig.isShowObuLimitSpeedView - ) if (HmiBuildConfig.isShowObuLimitSpeedView) { if (data != null) { CallerLogger.d( @@ -398,7 +391,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener } --- data.speedMaxLimit = ${data.speedMaxLimit}" ) when (data.status) { - MogoObuConstants.STATUS.ADD -> { // 添加 TODO + MogoObuConstants.STATUS.ADD -> { // 添加 CallerLimitingVelocityListenerManager.invokeUnion( (data.speedMaxLimit * 0.02 * 3.6).roundToInt().toInt(), DataSourceType.OBU @@ -469,6 +462,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener MogoObuConstants.STATUS.DELETE -> { // 移除顶部弹窗,当收不到信号的时候触发一次 CallerTrafficLightListenerManager.disableTrafficLight() + CallerTrafficLightListenerManager.invokeTrafficLightDisapper() isShowGreenWave = false isShowRunRedLight = false } @@ -598,18 +592,7 @@ class MogoObuDcCombineManager private constructor() : IMoGoObuWarningRsiListener * 保存obu通过工控机传输的数据到消息盒子 */ private fun saveObuToDcData(type: String, content: String, tts: String) { - CallerMsgBoxManager.saveMsgBox( - MsgBoxBean( - MsgBoxType.V2X, - V2XMsg( - type, - content, - tts - ) - ).apply { - sourceType = DataSourceType.TELEMATIC - } - ) + CallerObuSaveMessageListenerManager.invokeObuSaveMessage(type, content, tts, DataSourceType.TELEMATIC) } /** diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt index fcba382bc8..3dcdaea07f 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/obu/MogoPrivateObuNewManager.kt @@ -107,7 +107,7 @@ class MogoPrivateObuNewManager private constructor() { fun setObuLog(isChecked: Boolean) { ObuManager.getInstance().setEnableLog(isChecked) - val builder: com.mogo.support.obu.option.MogoObuLog.Builder = + val builder: MogoObuLog.Builder = MogoObuLog.newBuilder().setEnableStdio(isChecked) if (isChecked) { builder.setStdioLevel(MogoObuLogLevel.DBG) @@ -437,27 +437,24 @@ class MogoPrivateObuNewManager private constructor() { if (HmiBuildConfig.isShowObuWeaknessTrafficView) { // 交通参与者类型 0x0:未知 UNKNOWN | 1机动车 2:非机动车 NON_MOTOR | 3:行人 PEDESTRIAN 4:obu if (data != null && data.participant != null) { - var v2xType = "" - if (data.participant.ptcType == 1) { //机动车 - v2xType = + var v2xType = when (data.participant.ptcType) { + 1 -> { //机动车 EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_MOTOR_VEHICLES.poiType - } else if (data.participant.ptcType == 2) { //非机动车 - v2xType = + } + 2 -> { //非机动车 EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_NOT_MOTOR_VEHICLES.poiType - } else if (data.participant.ptcType == 3) { //行人 - v2xType = + } + 3 -> { //行人 EventTypeEnumNew.TYPE_USECASE_ID_VRUCW_PERSON.poiType - } else { //未知 - v2xType = EventTypeEnumNew.TYPE_ERROR.poiType + } + else -> { //未知 + EventTypeEnumNew.TYPE_ERROR.poiType + } } - val ttsContent = EventTypeEnumNew.getWarningTts(v2xType) - val alertContent = - EventTypeEnumNew.getWarningContent(v2xType) + val alertContent = EventTypeEnumNew.getWarningContent(v2xType) var level = -1 val direction = getMessageDirection(data.participant.targetPosition) - - //物体数据绘制 CallerLogger.d( "$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "onMogoObuRsmWarning ---- data.status = ${data.status} ---data.participant.ptcId = ${data.participant.ptcId} ---data.participant.ptcType = ${data.participant.ptcType} ---data.warningMsg = ${data.warningMsg} -----data = ${data.toString()}" @@ -745,11 +742,6 @@ class MogoPrivateObuNewManager private constructor() { v2xType = EventTypeEnumNew.TYPE_USECASE_ID_EVW.poiType } - // 这里处理固定的提示信息,包括了<紧急车辆提醒> - else -> { - // ttsContent = EventTypeEnumNew.getWarningTts(appId.toString()) - // alertContent = EventTypeEnumNew.getWarningContent(appId.toString()) - } } when (status) { @@ -830,9 +822,9 @@ class MogoPrivateObuNewManager private constructor() { MogoObuConstants.STATUS.DELETE -> { // 移除顶部弹窗 CallerTrafficLightListenerManager.disableTrafficLight() + CallerTrafficLightListenerManager.invokeTrafficLightDisapper() isShowGreenWave = false isShowRunRedLight = false - CallerTrafficLightListenerManager.invokeTrafficLightDisapper() } } } @@ -969,7 +961,7 @@ class MogoPrivateObuNewManager private constructor() { * 保存obu直连数据到消息盒子 */ private fun saveObuData(type: String, content: String, tts: String) { - CallerObuSaveMessageListenerManager.invokeObuSaveMessage(type, content, tts) + CallerObuSaveMessageListenerManager.invokeObuSaveMessage(type, content, tts, DataSourceType.OBU) } /** diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 76059bf6c6..963bdac269 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -1931,12 +1931,12 @@ internal class DebugSettingView @JvmOverloads constructor( } /** - * 车辆挂挡档位 + * 车辆挂档档位 * @param gear 档位 */ override fun onAutopilotGearData(gear: Chassis.GearPosition) { ThreadUtils.runOnUiThread { - tvGearInfo.text = "挂挡档位:${gear}" + tvGearInfo.text = "挂档档位:${gear}" } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/VersionNameView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/VersionNameView.kt index 28f464b10f..cbfbab04bf 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/VersionNameView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/VersionNameView.kt @@ -60,7 +60,7 @@ class VersionNameView @JvmOverloads constructor( @SuppressLint("SetTextI18n") private fun showCurrentPadVersion() { tvAppVersionName?.let { -// it.text = "APP:${AppUtils.getAppVersionName()}" + it.text = "APP:${AppUtils.getAppVersionName()}" } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml index f42dae9896..d5507a2fbc 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_debug_setting.xml @@ -1009,7 +1009,7 @@ style="@style/DebugSettingText" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="挂挡档位:" /> + android:text="挂档档位:" /> () { - private val TAG = "MogoApplication" + companion object { + private const val TAG = "HttpDnsStartUp" + } // 配置云服务API private val clientConfig by lazy { MoGoAiCloudClientConfig.getInstance() } - // 缓存IP地址 - private var cacheIp: String? = null - private var context: Context? = null private var gotToken = false + private var httpDnsSimpleLocation by Delegates.observable(getDefaultSimpleLocation()) { _, oldValue, newValue -> + if (oldValue.cityCode != newValue.cityCode) { + reConnectSocket(oldValue.cityCode, newValue.cityCode) + } + } + override fun callCreateOnMainThread() = true override fun waitOnMainThread() = false @@ -90,9 +97,9 @@ class HttpDnsStartUp : AndroidStartup() { clientConfig.isUseOriginSocket = true // 设置是否输出网络日志 clientConfig.isShowNetDebugLog = false - clientConfig.passportUrl = FunctionBuildConfig.urlJson.passportUrl - clientConfig.socketBaseUrl = FunctionBuildConfig.urlJson.socketBaseUrl - clientConfig.socketTechUrl = FunctionBuildConfig.urlJson.socketTechUrl +// clientConfig.passportUrl //todo 亚坤 +// clientConfig.socketBaseUrl +// clientConfig.socketTechUrl // 设置是否是直播推流的主播 clientConfig.isAnchor = true when (DebugConfig.getCarMachineType()) { @@ -121,7 +128,10 @@ class HttpDnsStartUp : AndroidStartup() { override fun getCurrentLocation(): HttpDnsSimpleLocation { val envConfig = CallerDevaToolsManager.getEnvConfig() if (envConfig != null) { - return HttpDnsSimpleLocation(envConfig.cityCode, envConfig.lat, envConfig.lon) + // 更新 + httpDnsSimpleLocation = + HttpDnsSimpleLocation(envConfig.cityCode, envConfig.lat, envConfig.lon) + return httpDnsSimpleLocation } var mogoLocation: MogoLocation? = null val locationClient = @@ -129,49 +139,25 @@ class HttpDnsStartUp : AndroidStartup() { if (locationClient != null) { mogoLocation = locationClient } - val httpDnsSimpleLocation = - if (mogoLocation != null && mogoLocation.latitude != 0.0 && mogoLocation.longitude != 0.0) { - if (mogoLocation.cityCode.isNullOrEmpty() - && !CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode.isNullOrEmpty() - ) { - HttpDnsSimpleLocation( - CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode - ?: "010", - mogoLocation.latitude, - mogoLocation.longitude - ) - } else { - HttpDnsSimpleLocation( - mogoLocation.cityCode, - mogoLocation.latitude, - mogoLocation.longitude - ) - } + if (mogoLocation != null && mogoLocation.latitude != 0.0 && mogoLocation.longitude != 0.0) { + // 更新 + httpDnsSimpleLocation = if (mogoLocation.cityCode.isNullOrEmpty() + && !CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode.isNullOrEmpty() + ) { + HttpDnsSimpleLocation( + CallerMapUIServiceManager.getGDLocationServer(context!!)?.lastCityCode + ?: "010", + mogoLocation.latitude, + mogoLocation.longitude + ) } else { - val ciyCode = - SharedPrefsMgr.getInstance( - AbsMogoApplication.getApp() - ) - .getString(SharedPrefsConstants.LOCATION_CITY_CODE) - val latitude = - SharedPrefsMgr.getInstance( - AbsMogoApplication.getApp() - ) - .getString(SharedPrefsConstants.LOCATION_LATITUDE) - val longitude = - SharedPrefsMgr.getInstance( - AbsMogoApplication.getApp() - ) - .getString(SharedPrefsConstants.LOCATION_LONGITUDE) - try { - HttpDnsSimpleLocation( - ciyCode, latitude.toDouble(), longitude.toDouble() - ) - } catch (e: NumberFormatException) { - // e.printStackTrace(); - HttpDnsSimpleLocation("010", 1.0, 1.0) - } + HttpDnsSimpleLocation( + mogoLocation.cityCode, + mogoLocation.latitude, + mogoLocation.longitude + ) } + } return httpDnsSimpleLocation } } @@ -186,10 +172,7 @@ class HttpDnsStartUp : AndroidStartup() { clientConfig.token = token // 由于存在token过期问题,在更新后会回调至此处,增加二次判定 if (!gotToken) { - CallerLogger.d( - SceneConstant.M_MAIN + TAG, - "onTokenGot token : $token , sn :$sn" - ) + CallerLogger.d("$M_MAIN$TAG", "onTokenGot token : $token , sn :$sn") CallerCloudListenerManager.invokeCloudTokenGot(token, sn) // 异步初始化NetConfig asyncInit() @@ -202,7 +185,7 @@ class HttpDnsStartUp : AndroidStartup() { override fun onError(code: Int, msg: String) { CallerLogger.d( - SceneConstant.M_MAIN + TAG, + "$M_MAIN$TAG", "初始化MogoAiCloudSdk failed ,reason : $msg , 未能开启长链服务和初始化Modules服务" ) } @@ -250,13 +233,10 @@ class HttpDnsStartUp : AndroidStartup() { } private fun startSocketService() { - CallerLogger.d(SceneConstant.M_MAIN + TAG, "startSocketService") + CallerLogger.d("$M_MAIN$TAG","startSocketService") val location = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02() - // 关闭长链服务 - MogoAiCloudSocketManager.getInstance(context).destroy() MogoAiCloudSocketManager.getInstance(context) .registerLifecycleListener(10020, object : IMogoLifecycleListener { - @ChainLog( linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS, linkCode = CHAIN_LINK_CLOUD, @@ -266,7 +246,7 @@ class HttpDnsStartUp : AndroidStartup() { clientPkFileName = "sn" ) override fun onConnectFailure() { - CallerLogger.d(SceneConstant.M_MAIN + TAG, "socket-onConnectFailure") + CallerLogger.d("$M_MAIN$TAG", "socket-onConnectFailure") MogoStatusManager.getInstance().setCloudSocketMode(TAG, false) } @@ -279,7 +259,7 @@ class HttpDnsStartUp : AndroidStartup() { clientPkFileName = "sn" ) override fun onConnectSuccess() { - CallerLogger.d(SceneConstant.M_MAIN + TAG, "socket-onConnectSuccess") + CallerLogger.d("$M_MAIN$TAG", "socket-onConnectSuccess") MogoStatusManager.getInstance().setCloudSocketMode(TAG, true) } @@ -292,7 +272,7 @@ class HttpDnsStartUp : AndroidStartup() { clientPkFileName = "sn" ) override fun onConnectLost() { - CallerLogger.d(SceneConstant.M_MAIN + TAG, "socket-onConnectLost") + CallerLogger.d("$M_MAIN$TAG", "socket-onConnectLost") MogoStatusManager.getInstance().setCloudSocketMode(TAG, false) } @@ -305,10 +285,7 @@ class HttpDnsStartUp : AndroidStartup() { clientPkFileName = "sn" ) override fun onError(code: String, msg: String?) { - CallerLogger.d( - SceneConstant.M_MAIN + TAG, - "socket-onError code : $code , msg : $msg" - ) + CallerLogger.d("$M_MAIN$TAG", "socket-onError code : $code , msg : $msg") } }) // 开启Socket长链服务 @@ -319,4 +296,42 @@ class HttpDnsStartUp : AndroidStartup() { MogoAiCloudSocketManager.getInstance(context) .init(context, DebugConfig.getSocketAppId(), lat, lon) } + + @ChainLog( + linkChainLog = CHAIN_LINK_LOG_CONNECT_STATUS, + linkCode = CHAIN_LINK_CLOUD, + endpoint = PAD, + nodeAliasCode = CHAIN_ALIAS_CODE_CLOUD_RECONNECT, + paramIndexes = [0, 1], + clientPkFileName = "sn" + ) + private fun reConnectSocket(oldCityCode: String, newCityCode: String) { + CallerLogger.d("$M_MAIN$TAG", "reConnectSocket oldCityCode : $oldCityCode , newCityCode : $newCityCode") + MogoAiCloudSocketManager.getInstance(context).reConnect() + } + + private fun getDefaultSimpleLocation(): HttpDnsSimpleLocation { + val ciyCode = + SharedPrefsMgr.getInstance( + AbsMogoApplication.getApp() + ) + .getString(SharedPrefsConstants.LOCATION_CITY_CODE) + val latitude = + SharedPrefsMgr.getInstance( + AbsMogoApplication.getApp() + ) + .getString(SharedPrefsConstants.LOCATION_LATITUDE) + val longitude = + SharedPrefsMgr.getInstance( + AbsMogoApplication.getApp() + ) + .getString(SharedPrefsConstants.LOCATION_LONGITUDE) + return try { + HttpDnsSimpleLocation( + ciyCode, latitude.toDouble(), longitude.toDouble() + ) + } catch (e: NumberFormatException) { + HttpDnsSimpleLocation("010", 1.0, 1.0) + } + } } \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt index da65a90d98..b3b4418ca4 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/deva/chain/ChainConstant.kt @@ -58,6 +58,7 @@ class ChainConstant { const val CHAIN_ALIAS_CODE_CLOUD_CONNECT_FAIL = "CHAIN_ALIAS_CODE_CLOUD_CONNECT_FAIL" const val CHAIN_ALIAS_CODE_CLOUD_CONNECT_SUCCESS = "CHAIN_ALIAS_CODE_CLOUD_CONNECT_SUCCESS" + const val CHAIN_ALIAS_CODE_CLOUD_RECONNECT = "CHAIN_ALIAS_CODE_CLOUD_RECONNECT" const val CHAIN_ALIAS_CODE_CLOUD_CONNECT_LOST = "CHAIN_ALIAS_CODE_CLOUD_CONNECT_LOST" const val CHAIN_ALIAS_CODE_CLOUD_CONNECT_ERROR = "CHAIN_ALIAS_CODE_CLOUD_CONNECT_ERROR" const val CHAIN_ALIAS_CODE_HTTP_DNS_CHANGED = "CHAIN_ALIAS_CODE_HTTP_DNS_CHANGED" diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt index 559928123e..5559e67b9f 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt @@ -290,4 +290,26 @@ interface IMoGoAutopilotControlProvider : IMoGoFunctionServerProvider { * @param isDrawPointCloud 是否绘制点云 */ fun setIsDrawPointCloud(isDrawPointCloud: Boolean) + + fun sendRoboBusJinlvM1FrontDoorCmd(switchCmd: Int): Boolean + + fun sendRoboBusJinlvM1AirConditionerCmd( + switchCmd: Int, + modeCmd: Int, + windSpeedCmd: Int, + temperatureCmd: Int + ): Boolean + + fun sendRoboBusJinlvM1HeaderCmd(switchCmd: Int, windSpeedCmd: Int): Boolean + + fun sendRoboBusJinlvM1MainLamp1Cmd(switchCmd: Int): Boolean + + fun sendRoboBusJinlvM1MainLamp2Cmd(switchCmd: Int): Boolean + + /** + * 车门控制 + */ + fun sendRoboBusJinlvM1SmallLampCmd(switchCmd: Int): Boolean + + fun sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd: SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd): Boolean } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisGearStateListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisGearStateListener.kt index 6c5f58060e..9e8ab937ae 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisGearStateListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoChassisGearStateListener.kt @@ -3,12 +3,12 @@ package com.mogo.eagle.core.function.api.autopilot import chassis.Chassis /** - * 车辆挂挡档位 数据 回调监听 + * 车辆挂档档位 数据 回调监听 */ interface IMoGoChassisGearStateListener { /** - * 车辆挂挡档位 + * 车辆挂档档位 * @param gear 档位 */ fun onAutopilotGearData(gear: Chassis.GearPosition) diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuSaveMessageListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuSaveMessageListener.kt index ec5e0531fd..03b914b51c 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuSaveMessageListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/obu/IMoGoObuSaveMessageListener.kt @@ -1,5 +1,7 @@ package com.mogo.eagle.core.function.api.obu +import com.mogo.eagle.core.data.enums.DataSourceType + /** * OBU 数据保存 * @author lixiaopeng @@ -11,8 +13,8 @@ interface IMoGoObuSaveMessageListener { * @param type 事件id,类似与uuid * @param content 事件内容 * @param tts 事件语音播报 - * + * @param sourceType 来源 */ - fun onMoGoObuSaveMessage(type: String, content: String, tts: String) + fun onMoGoObuSaveMessage(type: String, content: String, tts: String, sourceType: DataSourceType) } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt index e6089e167b..1980bf91db 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt @@ -415,4 +415,39 @@ object CallerAutoPilotControlManager { providerApi?.setIsDrawPointCloud(isDrawPointCloud) } + fun sendRoboBusJinlvM1FrontDoorCmd(switchCmd: Int): Boolean { + return providerApi?.sendRoboBusJinlvM1FrontDoorCmd(switchCmd) ?: false + } + + fun sendRoboBusJinlvM1AirConditionerCmd( + switchCmd: Int, + modeCmd: Int, + windSpeedCmd: Int, + temperatureCmd: Int + ): Boolean { + return providerApi?.sendRoboBusJinlvM1AirConditionerCmd(switchCmd, modeCmd, windSpeedCmd, temperatureCmd) ?: false + } + + fun sendRoboBusJinlvM1HeaderCmd(switchCmd: Int, windSpeedCmd: Int): Boolean { + return providerApi?.sendRoboBusJinlvM1HeaderCmd(switchCmd, windSpeedCmd) ?: false + } + + fun sendRoboBusJinlvM1MainLamp1Cmd(switchCmd: Int): Boolean { + return providerApi?.sendRoboBusJinlvM1MainLamp1Cmd(switchCmd) ?: false + } + + fun sendRoboBusJinlvM1MainLamp2Cmd(switchCmd: Int): Boolean { + return providerApi?.sendRoboBusJinlvM1MainLamp2Cmd(switchCmd) ?: false + } + + /** + * 车门控制 + */ + fun sendRoboBusJinlvM1SmallLampCmd(switchCmd: Int): Boolean { + return providerApi?.sendRoboBusJinlvM1SmallLampCmd(switchCmd) ?: false + } + + fun sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd: SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd): Boolean { + return providerApi?.sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd) ?: false + } } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisBrakeStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisBrakeStateListenerManager.kt index 27f92fef1d..1f5797029f 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisBrakeStateListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisBrakeStateListenerManager.kt @@ -4,7 +4,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisBrakeStateListener import com.mogo.eagle.core.function.call.base.CallerBase /** - * 车辆挂挡档位 回调监听 + * 车辆刹车 回调监听 */ object CallerChassisBrakeStateListenerManager : CallerBase() { diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisGearStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisGearStateListenerManager.kt index 907e4b0553..30d52e1a72 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisGearStateListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisGearStateListenerManager.kt @@ -5,12 +5,12 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener import com.mogo.eagle.core.function.call.base.CallerBase /** - * 车辆挂挡档位 回调监听 + * 车辆挂档档位 回调监听 */ object CallerChassisGearStateListenerManager : CallerBase() { /** - * 车辆挂挡档位 + * 车辆挂档档位 * @param gear 档位 */ fun invokeAutopilotGearData(gear: Chassis.GearPosition) { diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLocationGCJ02ListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLocationGCJ02ListenerManager.kt index 671a05f57a..0c20a62a84 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLocationGCJ02ListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerChassisLocationGCJ02ListenerManager.kt @@ -35,8 +35,6 @@ object CallerChassisLocationGCJ02ListenerManager : CallerBase { return } M_LISTENERS.remove(tag) + + if (!M_LISTENERS_HZ.containsKey(tag)) { + return + } + M_LISTENERS_HZ.remove(tag) + + if (!M_LISTENERS_HZ_LAST_SEND_TIME.containsKey(tag)) { + return + } + M_LISTENERS_HZ_LAST_SEND_TIME.remove(tag) } /** @@ -83,6 +93,16 @@ open class CallerBase { M_LISTENERS.forEach { if (it.value == listener) { M_LISTENERS.remove(it.key) + + if (!M_LISTENERS_HZ.containsKey(it.key)) { + return + } + M_LISTENERS_HZ.remove(it.key) + + if (!M_LISTENERS_HZ_LAST_SEND_TIME.containsKey(it.key)) { + return + } + M_LISTENERS_HZ_LAST_SEND_TIME.remove(it.key) } } } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuSaveMessageListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuSaveMessageListenerManager.kt index 3865080049..95b48fdfc7 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuSaveMessageListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/obu/CallerObuSaveMessageListenerManager.kt @@ -1,5 +1,6 @@ package com.mogo.eagle.core.function.call.obu +import com.mogo.eagle.core.data.enums.DataSourceType import com.mogo.eagle.core.function.api.obu.IMoGoObuSaveMessageListener import com.mogo.eagle.core.function.api.obu.IMoGoObuWarningRsiListener import com.mogo.eagle.core.function.call.base.CallerBase @@ -11,11 +12,11 @@ import com.mogo.support.obu.ObuScene */ object CallerObuSaveMessageListenerManager : CallerBase() { - fun invokeObuSaveMessage(type: String, content: String, tts: String) { + fun invokeObuSaveMessage(type: String, content: String, tts: String, sourceType: DataSourceType) { M_LISTENERS.forEach { val tag = it.key val listener = it.value - listener.onMoGoObuSaveMessage(type, content, tts) + listener.onMoGoObuSaveMessage(type, content, tts, sourceType) } } diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/AppIdentityModeUtils.kt b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/AppIdentityModeUtils.kt index 505b57a4e4..55e04731dc 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/AppIdentityModeUtils.kt +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/AppIdentityModeUtils.kt @@ -31,7 +31,6 @@ object AppIdentityModeUtils { - private fun getInfo(appIdentityMode: String): Array { val split = appIdentityMode.split("_") if (split.size == 3) { @@ -40,6 +39,14 @@ object AppIdentityModeUtils { return arrayOf("", "", "") } + fun getBuildCarType(appIdentityMode: String): String { + val (_, _, carType) = getInfo(appIdentityMode) + if(carType.isNotEmpty()){ + return carType + } + return "" + } + /** * 是否是 司机端(这里不细分具体是:小巴、出租车等类型) * diff --git a/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/IMogoSocketManager.java b/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/IMogoSocketManager.java index 158b60f36c..54f1b65fd8 100644 --- a/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/IMogoSocketManager.java +++ b/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/IMogoSocketManager.java @@ -21,6 +21,11 @@ public interface IMogoSocketManager extends IProvider { */ void init( Context context, String appId , double lat, double lon); + /** + * 重新连接 + */ + void reConnect(); + /** * 注册消息监听 * diff --git a/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/MogoAiCloudSocketManager.java b/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/MogoAiCloudSocketManager.java index 5285ac617c..568bc72725 100644 --- a/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/MogoAiCloudSocketManager.java +++ b/foudations/mogo-aicloud-services-sdk/src/main/java/com/mogo/aicloud/services/socket/MogoAiCloudSocketManager.java @@ -74,6 +74,11 @@ public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implem SocketManager.getInstance().init(context, lat, lon); } + @Override + public void reConnect() { + SocketManager.getInstance().reConnect(); + } + @Override public void registerOnMessageListener(int msgType, IMogoOnMessageListener listener) { if (mListeners.containsKey(msgType)) { diff --git a/gradle.properties b/gradle.properties index a00490ab10..f5313f4759 100644 --- a/gradle.properties +++ b/gradle.properties @@ -66,23 +66,23 @@ SERVICE_BIZ_VERSION=1.2.4 LOGLIB_VERSION=1.5.10 ######## MogoAiCloudSDK Version ######## # 网络请求LOGLIB_VERSION -MOGO_NETWORK_VERSION=1.4.4.4 +MOGO_NETWORK_VERSION=1.4.4.7 # 鉴权 -MOGO_PASSPORT_VERSION=1.4.4.4 +MOGO_PASSPORT_VERSION=1.4.4.7 # 常链接 -MOGO_SOCKET_VERSION=1.4.4.4 +MOGO_SOCKET_VERSION=1.4.4.7 # 数据采集 -MOGO_REALTIME_VERSION=1.4.4.4 +MOGO_REALTIME_VERSION=1.4.4.7 # 探路,道路事件发布,获取 -MOGO_TANLU_VERSION=1.4.4.4 +MOGO_TANLU_VERSION=1.4.4.7 # 直播推流 -MOGO_LIVE_VERSION=1.4.4.4 +MOGO_LIVE_VERSION=1.4.4.7 # 直播拉流 -MOGO_TRAFFICLIVE_VERSION=1.4.4.4 +MOGO_TRAFFICLIVE_VERSION=1.4.4.7 # 定位服务 -MOGO_LOCATION_VERSION=1.4.4.4 +MOGO_LOCATION_VERSION=1.4.4.7 # 远程通讯模块 -MOGO_TELEMATIC_VERSION=1.4.4.4 +MOGO_TELEMATIC_VERSION=1.4.4.7 ######## MogoAiCloudSDK Version ######## # 自研地图 MAP_SDK_VERSION=2.10.0.2_test_01 diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java index f68cbe9677..298d893a2c 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java @@ -23,7 +23,6 @@ import androidx.annotation.Nullable; import com.google.protobuf.InvalidProtocolBufferException; import com.zhidao.support.adas.high.bean.AutopilotStatistics; import com.zhidao.support.adas.high.bean.VersionCompatibility; -import com.zhidao.support.adas.high.common.AutopilotAbilityManager; import com.zhidao.support.adas.high.common.AutopilotReview; import com.zhidao.support.adas.high.common.ByteUtil; import com.zhidao.support.adas.high.common.Constants; @@ -34,6 +33,7 @@ import com.zhidao.support.adas.high.common.MessageType; import com.zhidao.support.adas.high.common.ProtocolStatus; import com.zhidao.support.adas.high.common.ReceiveTimeoutManager; import com.zhidao.support.adas.high.common.RegexUtils; +import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager; import com.zhidao.support.adas.high.msg.IMsg; import com.zhidao.support.adas.high.msg.MyMessageFactory; import com.zhidao.support.adas.high.protocol.RawData; @@ -129,6 +129,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 乘客屏无法进行注册或取消注册,因为乘客屏无法感知司机屏与工控机连接状态。无法重置已注册或未注册接口列表 */ private SubscribeInterface subscribeInterface; + private Timer carConfigReqTimer;//车辆基础信息请求 多次请求防止无法收到基础信息情况出现 public void setOnMultiDeviceListener(OnMultiDeviceListener onMultiDeviceListener) { this.onMultiDeviceListener = onMultiDeviceListener; @@ -535,7 +536,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec @Override public void onWebSocketConnectSuccess(String ipAddress, int port) { - sendCarConfigReq(); + startCarConfigReq(); ipcConnectedIp = ipAddress; ipcConnectedPort = port; subscribeInterface = new SubscribeInterface(this); @@ -662,6 +663,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec if (status == Constants.IPC_CONNECTION_STATUS.DISCONNECTED) { AdasManager.getInstance().setCarConfig(null); stopDispatchHandler(); + stopCarConfigReq(); } if (adasConnectStatusListener != null) { adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus.get(), reason); @@ -775,6 +777,40 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec CupidLogUtils.setEnableLog(isEnableLog); } + //车辆基础信息请求 + private void startCarConfigReq() { + if (carConfigReqTimer == null) { + carConfigReqTimer = new Timer(); + carConfigReqTimer.schedule(new TimerTask() { + int num = 0; + + @Override + public void run() { + if (getIpcConnectionStatus() == Constants.IPC_CONNECTION_STATUS.CONNECTED) { + if (AdasManager.getInstance().getCarConfig() == null) { + num++; + if (num > 3) { + CupidLogUtils.i(TAG, "最后一次也未获取到车机基础信息"); + stopCarConfigReq(); + } else { + CupidLogUtils.i(TAG, "第" + num + "次获取车机基础信息"); + sendCarConfigReq(); + } + } else { + stopCarConfigReq(); + } + } + } + }, 10, 2000L); + } + } + + private synchronized void stopCarConfigReq() { + if (carConfigReqTimer != null) { + carConfigReqTimer.cancel(); + carConfigReqTimer = null; + } + } /**************************************************************************************************************************/ /** @@ -1284,6 +1320,12 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec .build()); } + /** + * 金旅M1顶灯1控制 + * + * @param switchCmd //0: default, 1: 开启顶灯, 2: 关闭顶灯 + * @return boolean + */ @Override public boolean sendRoboBusJinlvM1MainLamp1Cmd(int switchCmd) { return sendRoboBusJinlvM1TaskCmd(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd.newBuilder() @@ -1291,6 +1333,12 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec .build()); } + /** + * 金旅M1顶灯2控制 + * + * @param switchCmd //0: default, 1: 开启顶灯, 2: 关闭顶灯 + * @return boolean + */ @Override public boolean sendRoboBusJinlvM1MainLamp2Cmd(int switchCmd) { return sendRoboBusJinlvM1TaskCmd(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd.newBuilder() @@ -1298,7 +1346,6 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec .build()); } - /** * 金旅M1小灯(氛围灯)控制 * diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasManager.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasManager.java index 1c91f3e4d8..74bb199b85 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasManager.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasManager.java @@ -685,9 +685,9 @@ public class AdasManager implements IAdasNetCommApi { } /** - * 金旅M1车门控制 + * 金旅M1小灯(氛围灯)控制 * - * @param switchCmd //0: default, 1: 开启车门, 2: 关闭车门 + * @param switchCmd //0: default, 1: 开启小灯(氛围灯), 2: 关闭小灯(氛围灯) * @return boolean */ @Override diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasOptions.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasOptions.java index 9caee97d94..3c38a18599 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasOptions.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasOptions.java @@ -1,6 +1,6 @@ package com.zhidao.support.adas.high; -import com.zhidao.support.adas.high.common.AutopilotAbilityManager; +import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager; import com.zhidao.support.adas.high.subscribe.SubscribeInterfaceOptions; import java.util.HashSet; diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility230.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility230.java new file mode 100644 index 0000000000..9c6ce3ea4c --- /dev/null +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility230.java @@ -0,0 +1,118 @@ +package com.zhidao.support.adas.high.common.autopilot.ability; + +import com.zhidao.support.adas.high.OnAdasListener; + +import java.util.Timer; +import java.util.TimerTask; +import java.util.regex.Pattern; + +import chassis.Chassis; +import chassis.ChassisStatesOuterClass; + +/** + * 是否可以启动自动驾驶能力检测 工控机版本>=230&& <250 使用此类 + * 目前监控了底盘的一些状态和查询节点状态应答的数据 + * 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知 + *

+ * 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态 + */ +public class AutopilotAbility230 { + private static final String TAG = AutopilotAbility230.class.getSimpleName(); + private static final long DEFAULT_DETECTION_TIME = 3 * 1000L;//默认检测时间 + private volatile Timer timer; + private ChassisStatesOuterClass.ChassisStates chassisStates; + + public AutopilotAbility230() { + } + + + public void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) { + this.chassisStates = chassisStates; + } + + private void onCallback() { + //金旅、开沃小巴乘客端 不能启动自动驾驶 + if (AutopilotAbilityManager.getInstance().isBusPassenger()) { + return; + } + boolean isAutopilotAbility = true;//是否能启动自动驾驶 + String unableAutopilotReason = null;//不能启动自动驾驶原因 + //检测底盘相关 + if (chassisStates != null) { + if (chassisStates.hasBrakeSystemStates()) { + float brake = chassisStates.getBrakeSystemStates().getBrakePedalResponsePosition(); + if (brake > 0) { + isAutopilotAbility = false; + unableAutopilotReason = "制动踏板被踩下"; + } + } + if (isAutopilotAbility) { + /** + * 档位状态判断 目前判断的车型包括 东风Taxi 红旗Taxi 金旅Bus 金旅M1 金旅M1 福田清扫车 开沃 + * TODO 如果 identityMode 未赋值以及目前已知其他车型判断逻辑跟东风Taxi和红旗 走 + */ + //开沃任何档位都能启动自驾 + if (!AutopilotAbilityManager.getInstance().isBusDriverVan()) { + if (chassisStates.hasGearSystemStates()) { + Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition(); + //金旅Bus和清扫车 档位不正常 + if (AutopilotAbilityManager.getInstance().isBusDriver()) { + if (gear == Chassis.GearPosition.GEAR_N || gear == Chassis.GearPosition.GEAR_R) { + isAutopilotAbility = false; + unableAutopilotReason = "档位不正常"; + } + } else if (AutopilotAbilityManager.getInstance().isSweeperDriverFutian()) { + if (gear == Chassis.GearPosition.GEAR_N) { + isAutopilotAbility = false; + unableAutopilotReason = "档位不正常"; + } + } else { + //东风Taxi和红旗 司机端和乘客端 档位不正常 + if (gear == Chassis.GearPosition.GEAR_P || gear == Chassis.GearPosition.GEAR_R) { + isAutopilotAbility = false; + unableAutopilotReason = "档位不正常"; + } + } + } + } + } + + //TODO 关于手刹:不同车型的实现不同所以目前没法使用此字段 +// if (isAutopilotAbility) { +// //电子驻车制动系统 +// if (chassisStates.hasEpbSystemStates()) { +// ChassisStatesOuterClass.EPBSystemStates epb = chassisStates.getEpbSystemStates(); +// if (epb.hasEpbEnableState()){ +// epb.getEpbWorkState(); +// } +// } +// } + } + if (AutopilotAbilityManager.getInstance().getListener() != null) { + AutopilotAbilityManager.getInstance().getListener().onAutopilotAbility(isAutopilotAbility, unableAutopilotReason); + } + } + + public synchronized void start() { + if (timer == null) { + timer = new Timer(); + timer.schedule(new TimerTask() { + @Override + public void run() { + onCallback(); + } + }, 2000L, DEFAULT_DETECTION_TIME);//延迟执行,避免刚连接成功后底盘信息无法及时同步 + } + } + + public synchronized void stop() { + if (timer != null) { + timer.cancel(); + timer = null; + } + this.chassisStates = null; + } + + + +} diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/AutopilotAbilityManager.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java similarity index 61% rename from libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/AutopilotAbilityManager.java rename to libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java index 03ec76b745..01bf359101 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/AutopilotAbilityManager.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java @@ -1,106 +1,41 @@ -package com.zhidao.support.adas.high.common; +package com.zhidao.support.adas.high.common.autopilot.ability; -import android.os.Handler; import android.os.Message; -import android.text.TextUtils; import com.zhidao.support.adas.high.AdasManager; -import com.zhidao.support.adas.high.OnAdasListener; import java.util.List; import java.util.Timer; import java.util.TimerTask; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import chassis.Chassis; import chassis.ChassisStatesOuterClass; import system_master.SystemStatusInfo; /** - * 是否可以启动自动驾驶能力检测 + * 是否可以启动自动驾驶能力检测 工控机版本>=250使用此类 * 目前监控了底盘的一些状态和查询节点状态应答的数据 * 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知 *

* 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态 */ -public class AutopilotAbilityManager { - private static final String TAG = AutopilotAbilityManager.class.getSimpleName(); +public class AutopilotAbility250 { + private static final String TAG = AutopilotAbility250.class.getSimpleName(); private static final int WHAT_TIMEOUT = 0; private static final int DEFAULT_TIMEOUT = 1500; private static final long DEFAULT_DETECTION_TIME = 3 * 1000L;//默认检测时间 private static final String[] NODE_INFO_STATE = {"未知状态 ", "依赖未就绪 ", "启动中 ", "运行 ", "停止 ", "无法启动状态 ", "人为启动状态 ", "人为关闭状态 "}; - private static volatile AutopilotAbilityManager INSTANCE; - private OnAdasListener listener; private volatile Timer timer; - private final Pattern pattern = Pattern.compile("\\d+.\\d+.\\d+"); private ChassisStatesOuterClass.ChassisStates chassisStates; - private Handler handler; - private OnAutopilotAbilityListener onAutopilotAbilityListener; - /** - * 身份/车型 - */ - private String identityMode; - public interface OnAutopilotAbilityListener { - void onStatusQuery();//查询是被调用 + public AutopilotAbility250() { } - /** - * 身份规则定义根据app/productFlavors/README.md - * * taxi司机屏 Taxi_Driver_Base (东风、红旗司机端) - * * taxi乘客屏 Taxi_Passenger_Base (东风、红旗乘客端) - * * bus司机屏 Bus_Driver_Base (金旅小巴司机端) - * * Bus_Driver_Van (开沃小巴司机端) - * * bus乘客屏 Bus_Passenger_Base (金旅、开沃小巴乘客端) - * * Bus_Passenger_M1 (M1小巴乘客端) - * * Bus_Passenger_M2 (M2小巴乘客端) - * * 清扫车 Sweeper_Driver_FT (福田清扫车司机端) - *

- * 此定义不区分角色,只区分业务线和车型 - */ - private interface IDENTITY_MODE { - String TAXI_DRIVER_BASE = "Taxi_Driver_Base";//(东风、红旗司机端) - String TAXI_PASSENGER_BASE = "Taxi_Passenger_Base";//(东风、红旗乘客端) - String BUS_DRIVER_BASE = "Bus_Driver_Base";//(金旅小巴司机端) - String BUS_DRIVER_VAN = "Bus_Driver_Van";//(开沃小巴司机端) - String BUS_PASSENGER_BASE = "Bus_Passenger_Base";//(金旅、开沃小巴乘客端) - String BUS_PASSENGER_M1 = "Bus_Passenger_M1";//(M1小巴乘客端) - String BUS_PASSENGER_M2 = "Bus_Passenger_M2";//(M2小巴乘客端) - String SWEEPER_DRIVER_FT = "Sweeper_Driver_FT";//(福田清扫车司机端) - } - - - public void setIdentityMode(String identityMode) { - this.identityMode = identityMode; - } - - public void setOnAdasListener(OnAdasListener listener) { - this.listener = listener; - } - - public void setOnAutopilotAbilityListener(OnAutopilotAbilityListener onAutopilotAbilityListener) { - this.onAutopilotAbilityListener = onAutopilotAbilityListener; - } - - private AutopilotAbilityManager() { - } - - public static AutopilotAbilityManager getInstance() { - if (INSTANCE == null) { - synchronized (AutopilotAbilityManager.class) { - if (INSTANCE == null) { - INSTANCE = new AutopilotAbilityManager(); - } - } - } - return INSTANCE; - } public void setStatusInfo(SystemStatusInfo.StatusInfo statusInfo) { - if (handler != null) { - if (handler.hasMessages(WHAT_TIMEOUT)) - handler.removeMessages(WHAT_TIMEOUT); + if (AutopilotAbilityManager.getInstance().getHandler() != null) { + if (AutopilotAbilityManager.getInstance().getHandler().hasMessages(WHAT_TIMEOUT)) + AutopilotAbilityManager.getInstance().getHandler().removeMessages(WHAT_TIMEOUT); } onCallback(statusInfo); } @@ -111,7 +46,7 @@ public class AutopilotAbilityManager { private void onCallback(SystemStatusInfo.StatusInfo statusInfo) { //金旅、开沃小巴乘客端 不能启动自动驾驶 - if (IDENTITY_MODE.BUS_PASSENGER_BASE.equalsIgnoreCase(identityMode)) { + if (AutopilotAbilityManager.getInstance().isBusPassenger()) { return; } boolean isAutopilotAbility = true;//是否能启动自动驾驶 @@ -122,20 +57,7 @@ public class AutopilotAbilityManager { if (statusInfo.hasMasterVersion()) { //截取Master Version String masterVersion = statusInfo.getMasterVersion(); - if (!TextUtils.isEmpty(masterVersion)) { - try { - Matcher matcher = pattern.matcher(masterVersion); - if (matcher.find()) { - String group = matcher.group(); - if (!TextUtils.isEmpty(group)) { - String v = group.split("\\.")[0]; - version = Integer.parseInt(v); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } + version = AutopilotAbilityManager.getInstance().parseVersion(false, masterVersion); } //如果 maser version 大于1,还需要判断AutoPilotReady字段是否存在,以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行 if (version > 1 && statusInfo.hasAutoPilotReady()) { @@ -204,24 +126,26 @@ public class AutopilotAbilityManager { * 档位状态判断 目前判断的车型包括 东风Taxi 红旗Taxi 金旅Bus 金旅M1 金旅M1 福田清扫车 开沃 * TODO 如果 identityMode 未赋值以及目前已知其他车型判断逻辑跟东风Taxi和红旗 走 */ - if (chassisStates.hasGearSystemStates()) { - Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition(); - if (TextUtils.isEmpty(identityMode)) { - identityMode = ""; - } - //开沃任何档位都能启动自驾 - if (!IDENTITY_MODE.BUS_DRIVER_VAN.equalsIgnoreCase(identityMode)) { + //开沃任何档位都能启动自驾 + if (!AutopilotAbilityManager.getInstance().isBusDriverVan()) { + if (chassisStates.hasGearSystemStates()) { + Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition(); //金旅Bus和清扫车 档位不正常 - if (IDENTITY_MODE.BUS_DRIVER_BASE.equalsIgnoreCase(identityMode) || IDENTITY_MODE.SWEEPER_DRIVER_FT.equalsIgnoreCase(identityMode)) { + if (AutopilotAbilityManager.getInstance().isBusDriver()) { if (gear == Chassis.GearPosition.GEAR_N || gear == Chassis.GearPosition.GEAR_R) { isAutopilotAbility = false; - unableAutopilotReason = "挡位不正常"; + unableAutopilotReason = "档位不正常"; + } + } else if (AutopilotAbilityManager.getInstance().isSweeperDriverFutian()) { + if (gear == Chassis.GearPosition.GEAR_N) { + isAutopilotAbility = false; + unableAutopilotReason = "档位不正常"; } } else { //东风Taxi和红旗 司机端和乘客端 档位不正常 if (gear == Chassis.GearPosition.GEAR_P || gear == Chassis.GearPosition.GEAR_R) { isAutopilotAbility = false; - unableAutopilotReason = "挡位不正常"; + unableAutopilotReason = "档位不正常"; } } } @@ -239,8 +163,8 @@ public class AutopilotAbilityManager { // } // } } - if (listener != null) { - listener.onAutopilotAbility(isAutopilotAbility, unableAutopilotReason); + if (AutopilotAbilityManager.getInstance().getListener() != null) { + AutopilotAbilityManager.getInstance().getListener().onAutopilotAbility(isAutopilotAbility, unableAutopilotReason); } } @@ -250,14 +174,14 @@ public class AutopilotAbilityManager { timer.schedule(new TimerTask() { @Override public void run() { - if (onAutopilotAbilityListener != null) { - onAutopilotAbilityListener.onStatusQuery(); + if (AutopilotAbilityManager.getInstance().getOnAutopilotAbilityListener() != null) { + AutopilotAbilityManager.getInstance().getOnAutopilotAbilityListener().onStatusQuery(); } AdasManager.getInstance().sendStatusQueryReq(); - if (handler != null) { - if (handler.hasMessages(WHAT_TIMEOUT)) - handler.removeMessages(WHAT_TIMEOUT); - handler.sendEmptyMessageDelayed(WHAT_TIMEOUT, DEFAULT_TIMEOUT); + if (AutopilotAbilityManager.getInstance().getHandler() != null) { + if (AutopilotAbilityManager.getInstance().getHandler().hasMessages(WHAT_TIMEOUT)) + AutopilotAbilityManager.getInstance().getHandler().removeMessages(WHAT_TIMEOUT); + AutopilotAbilityManager.getInstance().getHandler().sendEmptyMessageDelayed(WHAT_TIMEOUT, DEFAULT_TIMEOUT); } } }, 2000L, DEFAULT_DETECTION_TIME);//延迟执行,避免刚连接成功后底盘信息无法及时同步 @@ -269,18 +193,15 @@ public class AutopilotAbilityManager { timer.cancel(); timer = null; } - handler = null; this.chassisStates = null; } - public void setHandler(Handler handler) { - this.handler = handler; - } - public void onHandleMessage(Message msg) { if (msg.what == WHAT_TIMEOUT) { onCallback(null); } } + + } diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java new file mode 100644 index 0000000000..1e80fe6805 --- /dev/null +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java @@ -0,0 +1,274 @@ +package com.zhidao.support.adas.high.common.autopilot.ability; + +import android.os.Handler; +import android.os.Message; +import android.text.TextUtils; +import android.util.Log; + +import com.zhidao.support.adas.high.AdasManager; +import com.zhidao.support.adas.high.OnAdasListener; +import com.zhidao.support.adas.high.common.Constants; +import com.zhidao.support.adas.high.common.CupidLogUtils; + +import java.util.Timer; +import java.util.TimerTask; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import chassis.ChassisStatesOuterClass; +import mogo.telematics.pad.MessagePad; +import system_master.SystemStatusInfo; + +/** + * 是否可以启动自动驾驶能力检测 + * 目前监控了底盘的一些状态和查询节点状态应答的数据 + * 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知 + *

+ * 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态 + */ +public class AutopilotAbilityManager { + private static final String TAG = AutopilotAbilityManager.class.getSimpleName(); + private static volatile AutopilotAbilityManager INSTANCE; + private OnAdasListener listener; + private final Pattern pattern = Pattern.compile("\\d+\\.\\d+\\.\\d+"); + private Handler handler; + private OnAutopilotAbilityListener onAutopilotAbilityListener; + private int dockerVersion = -1;//工控机版本 + private AutopilotAbility230 autopilotAbility230; + private AutopilotAbility250 autopilotAbility250; + private Timer startTimer; + /** + * 身份/车型 + */ + private String identityMode; + + public interface OnAutopilotAbilityListener { + void onStatusQuery();//查询是被调用 + } + + /** + * 身份规则定义根据app/productFlavors/README.md + * * taxi司机屏 Taxi_Driver_Base (东风、红旗司机端) + * * taxi乘客屏 Taxi_Passenger_Base (东风、红旗乘客端) + * * bus司机屏 Bus_Driver_Base (金旅小巴司机端) + * * Bus_Driver_Van (开沃小巴司机端) + * * bus乘客屏 Bus_Passenger_Base (金旅、开沃小巴乘客端) + * * Bus_Passenger_M1 (M1小巴乘客端) + * * Bus_Passenger_M2 (M2小巴乘客端) + * * 清扫车 Sweeper_Driver_FT (福田清扫车司机端) + *

+ * 此定义不区分角色,只区分业务线和车型 + */ + private interface IDENTITY_MODE { + String TAXI_DRIVER_BASE = "Taxi_Driver_Base";//(东风、红旗司机端) + String TAXI_PASSENGER_BASE = "Taxi_Passenger_Base";//(东风、红旗乘客端) + String BUS_DRIVER_BASE = "Bus_Driver_Base";//(金旅小巴司机端) + String BUS_DRIVER_VAN = "Bus_Driver_Van";//(开沃小巴司机端) + String BUS_PASSENGER_BASE = "Bus_Passenger_Base";//(金旅、开沃小巴乘客端) + String BUS_PASSENGER_M1 = "Bus_Passenger_M1";//(M1小巴乘客端) + String BUS_PASSENGER_M2 = "Bus_Passenger_M2";//(M2小巴乘客端) + String SWEEPER_DRIVER_FT = "Sweeper_Driver_FT";//(福田清扫车司机端) + } + + private AutopilotAbilityManager() { + } + + public static AutopilotAbilityManager getInstance() { + if (INSTANCE == null) { + synchronized (AutopilotAbilityManager.class) { + if (INSTANCE == null) { + INSTANCE = new AutopilotAbilityManager(); + } + } + } + return INSTANCE; + } + + public void setIdentityMode(String identityMode) { + this.identityMode = identityMode; + } + + public void setCarConfig(MessagePad.CarConfigResp carConfig) { + if (dockerVersion == -1) { + String v = carConfig.getDockVersion(); + int version = parseVersion(true, v); + if (version != -1) { + stopTimer(); + dockerVersion = version; + Log.i("dddd", "工控机版本=" + dockerVersion); + initAutopilotAbility(); + } + } + } + + public void setOnAdasListener(OnAdasListener listener) { + this.listener = listener; + } + + public OnAdasListener getListener() { + return listener; + } + + public void setHandler(Handler handler) { + this.handler = handler; + } + + public Handler getHandler() { + return handler; + } + + public void setOnAutopilotAbilityListener(OnAutopilotAbilityListener onAutopilotAbilityListener) { + this.onAutopilotAbilityListener = onAutopilotAbilityListener; + } + + public OnAutopilotAbilityListener getOnAutopilotAbilityListener() { + return onAutopilotAbilityListener; + } + + + public void setStatusInfo(SystemStatusInfo.StatusInfo statusInfo) { + if (autopilotAbility250 != null) { + autopilotAbility250.setStatusInfo(statusInfo); + } + } + + public void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) { + if (autopilotAbility230 != null) { + autopilotAbility230.setChassisStates(chassisStates); + } + if (autopilotAbility250 != null) { + autopilotAbility250.setChassisStates(chassisStates); + } + } + + public void onHandleMessage(Message msg) { + if (autopilotAbility250 != null) { + autopilotAbility250.onHandleMessage(msg); + } + } + + private void initAutopilotAbility() { + if (dockerVersion >= 250) { + stop230(); + if (autopilotAbility250 == null) { + autopilotAbility250 = new AutopilotAbility250(); + autopilotAbility250.start(); + } + } else { + stop250(); + if (autopilotAbility230 == null) { + autopilotAbility230 = new AutopilotAbility230(); + autopilotAbility230.start(); + } + + } + } + + private void stop230() { + if (autopilotAbility230 != null) { + autopilotAbility230.stop(); + autopilotAbility230 = null; + } + } + + private void stop250() { + if (autopilotAbility250 != null) { + autopilotAbility250.stop(); + autopilotAbility250 = null; + } + } + + private void stopTimer() { + if (startTimer != null) { + startTimer.cancel(); + startTimer = null; + } + } + + /** + * 连接工控机成功调用此函数,如果dockerVersion还未获取到将启动最低版本的启动自动驾驶能力检测 + * 此函数为保险措施 以防无法获取工控机版本时 也能 正常执行逻辑 + */ + public synchronized void start() { + if (startTimer == null) { + startTimer = new Timer(); + startTimer.schedule(new TimerTask() { + @Override + public void run() { + if (dockerVersion == -1 && AdasManager.getInstance().getIpcConnectionStatus() == Constants.IPC_CONNECTION_STATUS.CONNECTED) { + dockerVersion = 230; + initAutopilotAbility(); + } + } + }, 8000L);//延迟执行,避免刚连接成功后底盘信息无法及时同步 + } + + } + + public synchronized void stop() { + stopTimer(); + stop230(); + stop250(); + handler = null; + dockerVersion = -1; + } + + + /** + * 解析版本 格式 xxx.xxx.xxx(x的数量不固定) + * + * @param isUserAll 是否使用全部截取数据 true:表示 12.34.56 截取之后 123456 false:表示12.34.56 截取之后 12 + * @param ver 版本字符串 + * @return -1表示解析失败 + */ + public int parseVersion(boolean isUserAll, String ver) { + int version = -1; + if (!TextUtils.isEmpty(ver)) { + try { + Matcher matcher = pattern.matcher(ver); + if (matcher.find()) { + String group = matcher.group(); + if (!TextUtils.isEmpty(group)) { + if (isUserAll) { + group = group.replace(".", ""); + } else { + group = group.split("\\.")[0]; + } + version = Integer.parseInt(group); + } + } + } catch (Exception e) { + CupidLogUtils.e(TAG, "版本解析失败=" + ver, e); + } + } + return version; + } + + /** + * 金旅、开沃小巴乘客端 + */ + public boolean isBusPassenger() { + return IDENTITY_MODE.BUS_PASSENGER_BASE.equalsIgnoreCase(identityMode); + } + + /** + * 开沃小巴司机端 + */ + public boolean isBusDriverVan() { + return IDENTITY_MODE.BUS_DRIVER_VAN.equalsIgnoreCase(identityMode); + } + + /** + * 金旅小巴司机端 + */ + public boolean isBusDriver() { + return IDENTITY_MODE.BUS_DRIVER_BASE.equalsIgnoreCase(identityMode); + } + + /** + * 福田清扫车司机端 + */ + public boolean isSweeperDriverFutian() { + return IDENTITY_MODE.SWEEPER_DRIVER_FT.equalsIgnoreCase(identityMode); + } +} diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/CarConfigRespMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/CarConfigRespMessage.java index 61c6d1b9f4..7a63aed0b6 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/CarConfigRespMessage.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/CarConfigRespMessage.java @@ -7,6 +7,7 @@ import com.zhidao.support.adas.high.AdasChannel; import com.zhidao.support.adas.high.AdasManager; import com.zhidao.support.adas.high.OnAdasListener; import com.zhidao.support.adas.high.common.CupidLogUtils; +import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager; import com.zhidao.support.adas.high.protocol.RawData; import mogo.telematics.pad.MessagePad; @@ -20,6 +21,7 @@ public class CarConfigRespMessage extends MyAbstractMessageHandler { public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException { MessagePad.CarConfigResp carConfigResp = MessagePad.CarConfigResp.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue()); AdasChannel.calculateTimeConsumingOnDispatchRaw("车机基础信息应答", raw.receiveTime); + AutopilotAbilityManager.getInstance().setCarConfig(carConfigResp); AdasManager.getInstance().setCarConfig(carConfigResp); long nowTime = 0; if (CupidLogUtils.isEnableLog()) diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ChassisStatesMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ChassisStatesMessage.java index 081a1a9a58..edb7d6f1a0 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ChassisStatesMessage.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ChassisStatesMessage.java @@ -2,7 +2,7 @@ package com.zhidao.support.adas.high.msg; import com.google.protobuf.InvalidProtocolBufferException; import com.zhidao.support.adas.high.OnAdasListener; -import com.zhidao.support.adas.high.common.AutopilotAbilityManager; +import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager; import com.zhidao.support.adas.high.protocol.RawData; import chassis.ChassisStatesOuterClass; diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/StatusQueryRespMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/StatusQueryRespMessage.java index be81f42258..2d37f3ced7 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/StatusQueryRespMessage.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/StatusQueryRespMessage.java @@ -5,7 +5,7 @@ import android.os.SystemClock; import com.google.protobuf.InvalidProtocolBufferException; import com.zhidao.support.adas.high.AdasChannel; import com.zhidao.support.adas.high.OnAdasListener; -import com.zhidao.support.adas.high.common.AutopilotAbilityManager; +import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager; import com.zhidao.support.adas.high.common.CupidLogUtils; import com.zhidao.support.adas.high.protocol.RawData; diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/VehicleStateMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/VehicleStateMessage.java index 0b3575b12a..567249f372 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/VehicleStateMessage.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/VehicleStateMessage.java @@ -5,7 +5,7 @@ import android.os.SystemClock; import com.google.protobuf.InvalidProtocolBufferException; import com.zhidao.support.adas.high.AdasChannel; import com.zhidao.support.adas.high.OnAdasListener; -import com.zhidao.support.adas.high.common.AutopilotAbilityManager; +import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager; import com.zhidao.support.adas.high.common.CupidLogUtils; import com.zhidao.support.adas.high.protocol.RawData; @@ -141,7 +141,7 @@ public class VehicleStateMessage extends MyAbstractMessageHandler { ChassisStatesOuterClass.GearSystemStates.Builder gearSystemStates = null; if (vehicleState.hasGear()) { gearSystemStates = ChassisStatesOuterClass.GearSystemStates.newBuilder(); - //挂挡档位数据 + //档位数据 gearSystemStates.setGearPosition(vehicleState.getGear());//鹰眼已用 } if (vehicleState.hasGearSwitchInference()) { diff --git a/test/crashreport-apmbyte/src/main/java/com/mogo/test/crashreport/apm/ApmCrashReportProvider.java b/test/crashreport-apmbyte/src/main/java/com/mogo/test/crashreport/apm/ApmCrashReportProvider.java index ac22671363..ac143c2920 100644 --- a/test/crashreport-apmbyte/src/main/java/com/mogo/test/crashreport/apm/ApmCrashReportProvider.java +++ b/test/crashreport-apmbyte/src/main/java/com/mogo/test/crashreport/apm/ApmCrashReportProvider.java @@ -13,6 +13,8 @@ import com.bytedance.apm.insight.ApmInsightInitConfig; import com.mogo.commons.constants.SharedPrefsConstants; import com.mogo.commons.debug.DebugConfig; import com.mogo.eagle.core.data.bindingcar.CarInfo; +import com.mogo.eagle.core.data.config.FunctionBuildConfig; +import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils; 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.CommonUtils; @@ -96,6 +98,7 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider { crash.addTags("CITYCODE", mCityCode); crash.addTags("LATITUDE", mLat); crash.addTags("LONGITUTE", mLogt); + crash.addTags("CAR_TYPE", AppIdentityModeUtils.INSTANCE.getBuildCarType(FunctionBuildConfig.appIdentityMode)); // crash.setReportUrl("www.xxx.com"); // 私有化部署:私有化部署才配置上报地址 // crash.addTags("key", "value"); // 自定义筛选tag, 按需添加、可多次覆盖