fix vip cancel bug and add new interface of trafficCrossRoad event
This commit is contained in:
@@ -119,10 +119,10 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 {
|
||||
mLocation?.let { loc ->
|
||||
roadIDResult?.let {
|
||||
// 检测是否开过路口,开过路口则停止读灯。并重置 trafficLightResult 值为 null
|
||||
// trafficLightResult != null &&
|
||||
if (it.isInRange(loc.latitude, loc.longitude)) {
|
||||
if (trafficLightResult != null && it.isInRange(loc.latitude, loc.longitude)) {
|
||||
inRange = true
|
||||
Logger.d("arrowtest", "进入路口")
|
||||
CallTrafficLightListenerManager.invokeEnterCrossRoad()
|
||||
return
|
||||
}
|
||||
if (inRange) {
|
||||
|
||||
@@ -88,11 +88,7 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
|
||||
TAG,
|
||||
"设置handler超时时间 " + ", time : ${System.currentTimeMillis() - vipMessage.timeOut}"
|
||||
)
|
||||
handler.sendEmptyMessageDelayed(
|
||||
MSG_WHAT_VIP_CANCEL,
|
||||
System.currentTimeMillis() - vipMessage.timeOut
|
||||
)
|
||||
setVip()
|
||||
setVip(vipMessage.timeOut)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,8 +146,12 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
|
||||
// }
|
||||
}
|
||||
|
||||
private fun setVip() {
|
||||
private fun setVip(cancelDelayTime: Long) {
|
||||
vip = true
|
||||
handler.sendEmptyMessageDelayed(
|
||||
MSG_WHAT_VIP_CANCEL,
|
||||
cancelDelayTime - System.currentTimeMillis()
|
||||
)
|
||||
CallerHmiManager.vipIdentification(true)
|
||||
CallVipSetListenerManager.invokeVipSetStatus(true)
|
||||
CallTrafficLightListenerManager.registerTrafficLightListener(TAG, this)
|
||||
@@ -159,6 +159,9 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
|
||||
|
||||
private fun cancelVip() {
|
||||
vip = false
|
||||
if(handler.hasMessages(MSG_WHAT_VIP_CANCEL)){
|
||||
handler.removeMessages(MSG_WHAT_VIP_CANCEL)
|
||||
}
|
||||
CallerHmiManager.vipIdentification(false)
|
||||
CallVipSetListenerManager.invokeVipSetStatus(false)
|
||||
CallTrafficLightListenerManager.unRegisterTrafficLightListener(TAG)
|
||||
@@ -189,8 +192,8 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
|
||||
if (handler.hasMessages(MSG_WHAT_VIP_SEARCH)) {
|
||||
handler.removeMessages(MSG_WHAT_VIP_SEARCH)
|
||||
}
|
||||
if (it) {
|
||||
setVip()
|
||||
if (it.vipStatus) {
|
||||
setVip(it.cancelDelayTime)
|
||||
} else {
|
||||
cancelVip()
|
||||
}
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package com.mogo.eagle.core.function.v2x.vip.network
|
||||
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.eagle.core.data.trafficlight.RoadIDResult
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.data.v2x.VipRequest
|
||||
import retrofit2.http.*
|
||||
|
||||
interface VipApiService {
|
||||
|
||||
//查询是否为VIP车辆
|
||||
@GET("/dataService/carUser/getVipStatusBySn")
|
||||
suspend fun requestVip(@Query("sn") sn: String): BaseResponse<Boolean>
|
||||
suspend fun requestVip(@Query("sn") sn: String): BaseResponse<VipRequest>
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.v2x.vip.network
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.mogo.eagle.core.data.v2x.VipRequest
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.common.constants.HostConst.DATA_SERVICE_HOST
|
||||
import com.mogo.utils.network.apiCall
|
||||
@@ -15,8 +16,8 @@ class VipNetWorkModel {
|
||||
)
|
||||
}
|
||||
|
||||
fun requestVip(onSuccess: ((Boolean) -> Unit), onError: ((String) -> Unit)) {
|
||||
request<BaseResponse<Boolean>> {
|
||||
fun requestVip(onSuccess: ((VipRequest) -> Unit), onError: ((String) -> Unit)) {
|
||||
request<BaseResponse<VipRequest>> {
|
||||
loader {
|
||||
apiCall {
|
||||
getNetWorkApi().requestVip(MoGoAiCloudClientConfig.getInstance().sn)
|
||||
@@ -24,11 +25,7 @@ class VipNetWorkModel {
|
||||
}
|
||||
onSuccess {
|
||||
if (it.result != null) {
|
||||
if (it.result) {
|
||||
onSuccess.invoke(true)
|
||||
} else {
|
||||
onSuccess.invoke(false)
|
||||
}
|
||||
onSuccess.invoke(it.result)
|
||||
} else {
|
||||
onError.invoke("requestRoadID result is null")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user