From 2ce908ce3fc56d6fa385e86cdab03606bfdb3b02 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Wed, 30 Nov 2022 11:17:55 +0800 Subject: [PATCH] [2.13.0] add test code of vip to xin chao --- .../hmi/ui/setting/DebugSettingView.kt | 7 +- .../core/function/v2x/vip/VipCarManager.kt | 144 +++++++++--------- 2 files changed, 75 insertions(+), 76 deletions(-) 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 7d0d1bd056..b9a62441f8 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 @@ -77,6 +77,7 @@ import com.mogo.map.MogoMapUIController import com.mogo.map.uicontroller.VisualAngleMode import com.mogo.map.uicontroller.VisualAngleMode.* import com.mogo.eagle.core.function.business.routeoverlay.* +import com.mogo.eagle.core.function.v2x.vip.VipCarManager import com.zhidao.easysocket.utils.L import com.zhidao.support.adas.high.other.permission.BackgrounderPermission import com.zhjt.mogo_core_function_devatools.env.* @@ -598,12 +599,14 @@ class DebugSettingView @JvmOverloads constructor( tbIsDemoMode.visibility = View.GONE } + // 雨天模式,上一次勾选的数据 tbIsRainMode.isChecked = FunctionBuildConfig.isRainMode //雨天模式 tbIsRainMode.setOnCheckedChangeListener { _, isChecked -> - CallerAutoPilotManager.setRainMode(isChecked) - FunctionBuildConfig.isRainMode = isChecked + VipCarManager.INSTANCE.turnLight(25) +// CallerAutoPilotManager.setRainMode(isChecked) +// FunctionBuildConfig.isRainMode = isChecked } //雨天模式按钮只在司机屏生效,乘客屏不显示 if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt index 58bdfe1aac..5f33f1af73 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt @@ -18,10 +18,8 @@ import com.mogo.eagle.core.data.trafficlight.currentRoadTrafficLight import com.mogo.eagle.core.data.trafficlight.isGreen import com.mogo.eagle.core.data.trafficlight.isRed import com.mogo.eagle.core.data.v2x.VipMessage -import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener 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.trafficlight.CallerTrafficLightListenerManager import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager @@ -65,7 +63,13 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe .registerOnMessageListener(401025, this) //首次进入应用查询是否为VIP车辆 - requestVip() +// requestVip() + + //todo emArrow test + CallerHmiManager.vipIdentification(true) + CallVipSetListenerManager.invokeVipSetStatus(true) + CallerTrafficLightListenerManager.registerTrafficLightListener(TAG, this) + CallerTrafficLightListenerManager.registerEnterCrossRoadListener(TAG, this) } override fun handleMessage(msg: Message): Boolean { @@ -104,9 +108,9 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe } override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) { - if (!vip) { - return - } +// if (!vip) { //todo emArrow test +// return +// } if (exit) { CallerLogger.d("$M_V2X$TAG", "驶离路口,返回 , then resetConditions") @@ -196,69 +200,70 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe } } - private fun turnLight(controlTime: Int) { - if (result == null || mContext == null) return - val locationClient = CallerMapUIServiceManager.getSingletonLocationClient(mContext!!) - if (locationClient != null) { - val bearing = - locationClient.lastKnowLocation.bearing.toDouble() - CallerLogger.d("$M_V2X$TAG", "-- turnLight -- ") - MogoTrafficLightManager.INSTANCE.turnLightToGreen( - result!!.lightId, result!!.crossId, bearing, controlTime, - { - // 请求变灯成功,直接提示 - if (it.sn == MoGoAiCloudClientConfig.getInstance().sn && it.code == 0) { - CallerLogger.d("$M_V2X$TAG", "变灯请求成功") - showWarning( - EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType, - EventTypeEnum.TYPE_VIP_IDENTIFICATION.content, - EventTypeEnum.TYPE_VIP_IDENTIFICATION.tts, - EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType - ) - return@turnLightToGreen - } + fun turnLight(controlTime: Int) { +// if (result == null || mContext == null) return +// val locationClient = CallerMapUIServiceManager.getSingletonLocationClient(mContext!!) +// if (locationClient != null) { +// val bearing = +// locationClient.lastKnowLocation.bearing.toDouble() + CallerLogger.d("$M_V2X$TAG", "-- turnLight -- ") + MogoTrafficLightManager.INSTANCE.turnLightToGreen( +// result!!.lightId, result!!.crossId, bearing, controlTime, + 100445, "10037", 90.0, controlTime, + { + // 请求变灯成功,直接提示 + if (it.sn == MoGoAiCloudClientConfig.getInstance().sn && it.code == 0) { + CallerLogger.d("$M_V2X$TAG", "变灯请求成功") + showWarning( + EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType, + EventTypeEnum.TYPE_VIP_IDENTIFICATION.content, + EventTypeEnum.TYPE_VIP_IDENTIFICATION.tts, + EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType + ) + return@turnLightToGreen + } - // 请求变灯失败,根据灯态来提示。 此处灯态未获取到 - 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 - ) - return@turnLightToGreen - } + // 请求变灯失败,根据灯态来提示。 此处灯态未获取到 + 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 + ) + return@turnLightToGreen + } - // 如果当前为红灯,则提示 - if (this.result!!.currentRoadTrafficLight()!!.isRed()) { - val time = if (it.countDown / 60 >= 1) { - "${it.countDown / 60}分${it.countDown % 60}秒后重试" - } else { - val temp = if (it.countDown == 0) { - 1 - } else { - it.countDown - } - "${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 - ) + // 如果当前为红灯,则提示 + if (this.result!!.currentRoadTrafficLight()!!.isRed()) { + val time = if (it.countDown / 60 >= 1) { + "${it.countDown / 60}分${it.countDown % 60}秒后重试" } else { - CallerLogger.d( - "$M_V2X$TAG", - "变灯请求失败,当前为非红灯不做展示 , light : ${result.toString()} , trafficLightControl : $it" - ) + val temp = if (it.countDown == 0) { + 1 + } else { + it.countDown + } + "${temp}秒后重试" } - }, - { errorMsg -> - CallerLogger.e("$M_V2X$TAG", "变灯请求失败 msg : $errorMsg") - ToastUtils.showLong("服务异常,请稍后重试") - }) - } + 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 + ) + } else { + CallerLogger.d( + "$M_V2X$TAG", + "变灯请求失败,当前为非红灯不做展示 , light : ${result.toString()} , trafficLightControl : $it" + ) + } + }, + { errorMsg -> + CallerLogger.e("$M_V2X$TAG", "变灯请求失败 msg : $errorMsg") + ToastUtils.showLong("服务异常,请稍后重试") + }) +// } } private fun showWarning( @@ -270,15 +275,6 @@ class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListe CallerMsgBoxManager.saveMsgBox( MsgBoxBean(MsgBoxType.V2X, V2XMsg(v2xType, alertContent.toString(), ttsContent)) ) - CallerHmiManager.warningV2X( - v2xType, alertContent, ttsContent, tag, - object : IMoGoWarningStatusListener { - override fun onShow() {} - override fun onDismiss() {} - }, - true, - 5000L - ) } fun destroy() {