This commit is contained in:
tongchenfei
2020-10-29 19:16:07 +08:00
parent 0b4c78fe09
commit 90c8e9f07a

View File

@@ -242,21 +242,28 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
}else {
int type = intent.getIntExtra("type", -1);
if (type == 2) {
// 红绿灯处理
String data = intent.getStringExtra("data");
if (data != null && !data.isEmpty()) {
try {
JSONObject jsonObject = new JSONObject(data);
String lightStatus = jsonObject.optString("lightStatus");
String surplusTime = jsonObject.optString("surplusTime");
if (!lightStatus.isEmpty() && !surplusTime.isEmpty()) {
handleObuTrafficLightInfo(lightStatus, surplusTime);
} else {
Logger.d(TAG, "红绿灯必要信息都为空,不做展示");
String obuLightAction = intent.getStringExtra("action");
if("1".equals(obuLightAction)){
// 隐藏红绿灯
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
handler.sendEmptyMessage(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU);
}else {
// 红绿灯处理
String data = intent.getStringExtra("data");
if (data != null && !data.isEmpty()) {
try {
JSONObject jsonObject = new JSONObject(data);
String lightStatus = jsonObject.optString("lightStatus");
String surplusTime = jsonObject.optString("surplusTime");
if (!lightStatus.isEmpty() && !surplusTime.isEmpty()) {
handleObuTrafficLightInfo(lightStatus, surplusTime);
} else {
Logger.d(TAG, "红绿灯必要信息都为空,不做展示");
}
} catch (Exception e) {
Logger.e(TAG, e, "解析adas数据异常");
e.printStackTrace();
}
} catch (Exception e) {
Logger.e(TAG, e, "解析adas数据异常");
e.printStackTrace();
}
}
}
@@ -303,6 +310,8 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
if (leftTime < 0) {
leftTime = 0;
}
Logger.d("CloudTrafficLight",
"lightStatus: " + lightStatus + " current: " + System.currentTimeMillis() + " cloudType: " + roadData.getSystemTime() + " diff: " + diff + " cloudLeftTime: " + roadData.getLightLeftTime() + " leftTime: " + leftTime);
drawTrafficLight(lightStatus, "" + leftTime);
handler.sendEmptyMessageDelayed(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD,
HIDE_TRAFFIC_LIGHT_DELAY);