[2.13.0] add test code of vip to xin chao
This commit is contained in:
@@ -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<VipMessage>, 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<VipMessage>, 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<VipMessage>, 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<VipMessage>, 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() {
|
||||
|
||||
Reference in New Issue
Block a user