[2.13.0] add test code of vip to xin chao

This commit is contained in:
zhongchao
2022-11-30 11:17:55 +08:00
parent 2f9034a1ac
commit 2ce908ce3f
2 changed files with 75 additions and 76 deletions

View File

@@ -77,6 +77,7 @@ import com.mogo.map.MogoMapUIController
import com.mogo.map.uicontroller.VisualAngleMode import com.mogo.map.uicontroller.VisualAngleMode
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.business.routeoverlay.*
import com.mogo.eagle.core.function.v2x.vip.VipCarManager
import com.zhidao.easysocket.utils.L import com.zhidao.easysocket.utils.L
import com.zhidao.support.adas.high.other.permission.BackgrounderPermission import com.zhidao.support.adas.high.other.permission.BackgrounderPermission
import com.zhjt.mogo_core_function_devatools.env.* import com.zhjt.mogo_core_function_devatools.env.*
@@ -598,12 +599,14 @@ class DebugSettingView @JvmOverloads constructor(
tbIsDemoMode.visibility = View.GONE tbIsDemoMode.visibility = View.GONE
} }
// 雨天模式,上一次勾选的数据 // 雨天模式,上一次勾选的数据
tbIsRainMode.isChecked = FunctionBuildConfig.isRainMode tbIsRainMode.isChecked = FunctionBuildConfig.isRainMode
//雨天模式 //雨天模式
tbIsRainMode.setOnCheckedChangeListener { _, isChecked -> tbIsRainMode.setOnCheckedChangeListener { _, isChecked ->
CallerAutoPilotManager.setRainMode(isChecked) VipCarManager.INSTANCE.turnLight(25)
FunctionBuildConfig.isRainMode = isChecked // CallerAutoPilotManager.setRainMode(isChecked)
// FunctionBuildConfig.isRainMode = isChecked
} }
//雨天模式按钮只在司机屏生效,乘客屏不显示 //雨天模式按钮只在司机屏生效,乘客屏不显示
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {

View File

@@ -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.isGreen
import com.mogo.eagle.core.data.trafficlight.isRed import com.mogo.eagle.core.data.trafficlight.isRed
import com.mogo.eagle.core.data.v2x.VipMessage 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.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager 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.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager
@@ -65,7 +63,13 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
.registerOnMessageListener(401025, this) .registerOnMessageListener(401025, this)
//首次进入应用查询是否为VIP车辆 //首次进入应用查询是否为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 { override fun handleMessage(msg: Message): Boolean {
@@ -104,9 +108,9 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
} }
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) { override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
if (!vip) { // if (!vip) { //todo emArrow test
return // return
} // }
if (exit) { if (exit) {
CallerLogger.d("$M_V2X$TAG", "驶离路口,返回 , then resetConditions") CallerLogger.d("$M_V2X$TAG", "驶离路口,返回 , then resetConditions")
@@ -196,69 +200,70 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
} }
} }
private fun turnLight(controlTime: Int) { fun turnLight(controlTime: Int) {
if (result == null || mContext == null) return // if (result == null || mContext == null) return
val locationClient = CallerMapUIServiceManager.getSingletonLocationClient(mContext!!) // val locationClient = CallerMapUIServiceManager.getSingletonLocationClient(mContext!!)
if (locationClient != null) { // if (locationClient != null) {
val bearing = // val bearing =
locationClient.lastKnowLocation.bearing.toDouble() // locationClient.lastKnowLocation.bearing.toDouble()
CallerLogger.d("$M_V2X$TAG", "-- turnLight -- ") CallerLogger.d("$M_V2X$TAG", "-- turnLight -- ")
MogoTrafficLightManager.INSTANCE.turnLightToGreen( MogoTrafficLightManager.INSTANCE.turnLightToGreen(
result!!.lightId, result!!.crossId, bearing, controlTime, // 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", "变灯请求成功") if (it.sn == MoGoAiCloudClientConfig.getInstance().sn && it.code == 0) {
showWarning( CallerLogger.d("$M_V2X$TAG", "变灯请求成功")
EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType, showWarning(
EventTypeEnum.TYPE_VIP_IDENTIFICATION.content, EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType,
EventTypeEnum.TYPE_VIP_IDENTIFICATION.tts, EventTypeEnum.TYPE_VIP_IDENTIFICATION.content,
EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType EventTypeEnum.TYPE_VIP_IDENTIFICATION.tts,
) EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType
return@turnLightToGreen )
} return@turnLightToGreen
}
// 请求变灯失败,根据灯态来提示。 此处灯态未获取到 // 请求变灯失败,根据灯态来提示。 此处灯态未获取到
if (this.result == null || this.result?.currentRoadTrafficLight() == null) { if (this.result == null || this.result?.currentRoadTrafficLight() == null) {
showWarning( showWarning(
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType, EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType,
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.content + "稍后重试", EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.content + "稍后重试",
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.tts, EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.tts,
EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType
) )
return@turnLightToGreen return@turnLightToGreen
} }
// 如果当前为红灯,则提示 // 如果当前为红灯,则提示
if (this.result!!.currentRoadTrafficLight()!!.isRed()) { if (this.result!!.currentRoadTrafficLight()!!.isRed()) {
val time = if (it.countDown / 60 >= 1) { val time = if (it.countDown / 60 >= 1) {
"${it.countDown / 60}${it.countDown % 60}秒后重试" "${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
)
} else { } else {
CallerLogger.d( val temp = if (it.countDown == 0) {
"$M_V2X$TAG", 1
"变灯请求失败,当前为非红灯不做展示 , light : ${result.toString()} , trafficLightControl : $it" } else {
) it.countDown
}
"${temp}秒后重试"
} }
}, showWarning(
{ errorMsg -> EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.poiType,
CallerLogger.e("$M_V2X$TAG", "变灯请求失败 msg : $errorMsg") EventTypeEnum.TYPE_VIP_ERROR_IDENTIFICATION.content + time,
ToastUtils.showLong("服务异常,请稍后重试") 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( private fun showWarning(
@@ -270,15 +275,6 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
CallerMsgBoxManager.saveMsgBox( CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(MsgBoxType.V2X, V2XMsg(v2xType, alertContent.toString(), ttsContent)) 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() { fun destroy() {