fix bug of handle sendmsg

This commit is contained in:
zhongchao
2021-11-24 01:01:02 +08:00
parent 9bce99607d
commit 5113a0a893
2 changed files with 15 additions and 10 deletions

View File

@@ -14,6 +14,7 @@ import com.mogo.eagle.core.function.v2x.trafficlight.TrafficLightHMIManager
import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_LOOP_SEARCH_CROSS_ROAD
import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_LOOP_SEARCH_TRAFFIC_LIGHT
import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_CROSS_ROAD
import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT
import com.mogo.eagle.core.function.v2x.trafficlight.network.TrafficLightNetWorkModel
import com.mogo.map.navi.IMogoCarLocationChangedListener2
import com.mogo.module.common.MogoApisHandler
@@ -87,13 +88,16 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 {
trafficLightNetWorkModel.cancelRequestTrafficLight()
//未查到红绿灯加入2秒延时请求路口ID
mThreadHandler?.let { handler ->
if (handler.hasMessages(MSG_WHAT_LOOP_SEARCH_TRAFFIC_LIGHT)) {
handler.removeMessages(MSG_WHAT_LOOP_SEARCH_TRAFFIC_LIGHT)
}
if (handler.hasMessages(MSG_WHAT_LOOP_SEARCH_CROSS_ROAD)) {
handler.removeMessages(MSG_WHAT_LOOP_SEARCH_CROSS_ROAD)
mThreadHandler?.sendEmptyMessageDelayed(
MSG_WHAT_LOOP_SEARCH_CROSS_ROAD,
2_000L
)
}
handler.sendEmptyMessageDelayed(
MSG_WHAT_LOOP_SEARCH_CROSS_ROAD,
2_000L
)
}
})
}
@@ -104,11 +108,8 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 {
mThreadHandler?.let {
if (it.hasMessages(MSG_WHAT_LOOP_SEARCH_CROSS_ROAD)) {
it.removeMessages(MSG_WHAT_LOOP_SEARCH_CROSS_ROAD)
mThreadHandler?.sendEmptyMessageDelayed(
MSG_WHAT_LOOP_SEARCH_CROSS_ROAD,
3_000L
)
}
it.sendEmptyMessageDelayed(MSG_WHAT_LOOP_SEARCH_CROSS_ROAD, 2_000L)
}
})
mThreadHandler?.sendEmptyMessageDelayed(MSG_WHAT_LOOP_SEARCH_CROSS_ROAD, 5_000L)
@@ -128,9 +129,9 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 {
Logger.d("arrowtest", "离开路口")
inRange = false
trafficLightResult = null
mThreadHandler?.sendEmptyMessage(MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT)
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
CallTrafficLightListenerManager.resetTrafficLightData()
mThreadHandler?.sendEmptyMessage(TrafficLightThreadHandler.MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT)
}
}
}

View File

@@ -85,7 +85,11 @@ class TrafficLightNetWorkModel {
}
}
onSuccess {
onSuccess.invoke(it.result)
if(it.result!=null){
onSuccess.invoke(it.result)
}else{
onError.invoke(it.msg?:"返回result数据为null")
}
}
onError {
if (it.message != null) {