Merge remote-tracking branch 'origin/dev_hengyang_base' into dev_hengyang_base
This commit is contained in:
@@ -20,6 +20,8 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XObuEventEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.module.v2x.listener.V2XLocationListener;
|
||||
import com.mogo.module.v2x.scenario.scene.obu.V2XObuEventScenario;
|
||||
import com.mogo.module.v2x.utils.ADASUtils;
|
||||
@@ -96,6 +98,13 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
NebulaObuClient.getInstance().registerObu(100);
|
||||
NebulaObuClient.getInstance().registerObuListener(listener);
|
||||
|
||||
// UiThreadHandler.postDelayed( () -> {
|
||||
// //TODO 测试
|
||||
// MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(3, MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
||||
// handleSdkObu(1);
|
||||
//
|
||||
// }, 5_000L );
|
||||
|
||||
IntentFilter filter = new IntentFilter("com.mogo.launcher.v2x.action.EXCHANGE_OBU_TYPE");
|
||||
context.registerReceiver(obuTypeExchangeReceiver, filter);
|
||||
}
|
||||
@@ -137,7 +146,7 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
Logger.d("liyz", "onWarningInfo type ------> " + info.getWarningtype() + "--size = " + infoList.size());
|
||||
if (info.getWarningtype() == 3) {
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
handleSdkObu();
|
||||
handleSdkObu(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,14 +154,23 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
}
|
||||
};
|
||||
|
||||
private void handleSdkObu() {
|
||||
|
||||
private void handleSdkObu(int type) {
|
||||
V2XMessageEntity<V2XObuEventEntity> messageEntity = new V2XMessageEntity<>();
|
||||
messageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_OBU_EVENT);
|
||||
|
||||
// 前车紧急制动预警
|
||||
V2XObuEventEntity urgencyEvent = new V2XObuEventEntity();
|
||||
urgencyEvent.setType(ObuConstant.TYPE_URGENCY_COLLISION_WARNING);
|
||||
urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_COLLISION_WARN_TEXT);
|
||||
if (type == 1) { //交叉路口碰撞预警 TODO
|
||||
urgencyEvent.setType(ObuConstant.TYPE_CROSS_COLLISION_WARNING);
|
||||
urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_CROING_WARN_TEXT);
|
||||
} else if (type == 2) { // 前车紧急制动预警
|
||||
urgencyEvent.setType(ObuConstant.TYPE_URGENCY_COLLISION_WARNING);
|
||||
urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_COLLISION_WARN_TEXT);
|
||||
} else {
|
||||
urgencyEvent.setType(ObuConstant.TYPE_URGENCY_COLLISION_WARNING);
|
||||
urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_COLLISION_WARN_TEXT);
|
||||
}
|
||||
|
||||
messageEntity.setContent(urgencyEvent);
|
||||
V2XObuEventScenario.getInstance().init(messageEntity);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@ public class V2XObuEventScenario extends AbsV2XScenario<V2XObuEventEntity> imple
|
||||
|
||||
public static final String URGENCY_COLLISION_WARN_TEXT_ONE = "前车急刹,注意保持安全距离!";
|
||||
public static final String URGENCY_COLLISION_WARN_TEXT = "前车急刹";
|
||||
public static final String URGENCY_CROING_WARN_TEXT = "交叉路口碰撞预警";
|
||||
|
||||
private static final int MSG_CLOSE_OBU_WINDOW = 1001;
|
||||
private static final int DEFAULT_EXPIRE_TIME = 20_000;
|
||||
|
||||
@@ -110,7 +112,12 @@ public class V2XObuEventScenario extends AbsV2XScenario<V2XObuEventEntity> imple
|
||||
} else {
|
||||
optimalSpeedMarker.clearPOI();
|
||||
}
|
||||
} else if (v2XMessageEntity.getContent().getType() == ObuConstant.TYPE_CROSS_COLLISION_WARNING) {
|
||||
AIAssist.getInstance(V2XServiceManager.getContext()).speakTTSVoice(URGENCY_CROING_WARN_TEXT);
|
||||
} else if (v2XMessageEntity.getContent().getType() == ObuConstant.TYPE_URGENCY_COLLISION_WARNING) {
|
||||
AIAssist.getInstance(V2XServiceManager.getContext()).speakTTSVoice(URGENCY_COLLISION_WARN_TEXT_ONE);
|
||||
}
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
@@ -121,7 +128,7 @@ public class V2XObuEventScenario extends AbsV2XScenario<V2XObuEventEntity> imple
|
||||
*/
|
||||
@Override
|
||||
public void show() {
|
||||
AIAssist.getInstance(V2XServiceManager.getContext()).speakTTSVoice(URGENCY_COLLISION_WARN_TEXT_ONE);
|
||||
// AIAssist.getInstance(V2XServiceManager.getContext()).speakTTSVoice(URGENCY_COLLISION_WARN_TEXT_ONE);
|
||||
showWindow();
|
||||
if (handler.hasMessages(MSG_CLOSE_OBU_WINDOW)) {
|
||||
handler.removeMessages(MSG_CLOSE_OBU_WINDOW);
|
||||
|
||||
@@ -66,7 +66,7 @@ public class V2XObuEventWindow extends FrameLayout implements IV2XWindow<V2XObuE
|
||||
@Override
|
||||
public void show(V2XObuEventEntity entity) {
|
||||
Logger.d(MODULE_NAME, "ObuEventWindow show " + entity);
|
||||
Logger.d("liyz", "ObuEventWindow show " + entity + "--type = " + entity.getType());
|
||||
Logger.d("liyz", "ObuEventWindow show " + entity);
|
||||
switch (entity.getType()) {
|
||||
case ObuConstant
|
||||
.TYPE_OPTIMAL_SPEED_ADVISORY:
|
||||
@@ -83,6 +83,13 @@ public class V2XObuEventWindow extends FrameLayout implements IV2XWindow<V2XObuE
|
||||
tvType.setText("前车急刹");
|
||||
tvType.setBackgroundResource(R.drawable.bg_v2x_event_type_read);
|
||||
break;
|
||||
case ObuConstant.TYPE_CROSS_COLLISION_WARNING:
|
||||
// 交叉路口碰撞预警
|
||||
ivTypeIcon.setImageResource(R.drawable.v2x_icon_ahead_car_brake);
|
||||
tvDesc.setText(entity.getDesc());
|
||||
tvType.setText("交叉路口碰撞预警");
|
||||
tvType.setBackgroundResource(R.drawable.bg_v2x_event_type_read);
|
||||
break;
|
||||
case ObuConstant.TYPE_CHANGE_LIGHT_FOR_VIP:
|
||||
// vip变灯提醒
|
||||
ivTypeIcon.setImageResource(R.drawable.v2x_icon_obu_traffic_light);
|
||||
|
||||
Reference in New Issue
Block a user