diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/test/V2XTestConsoleWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/test/V2XTestConsoleWindow.java index a7b03d721c..047e3b886d 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/test/V2XTestConsoleWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/test/V2XTestConsoleWindow.java @@ -100,7 +100,6 @@ public class V2XTestConsoleWindow extends ConstraintLayout { mBtnTriggerSeekHelpEvent = findViewById(R.id.btnTriggerSeekHelpEvent); mBtnTriggerParkEvent = findViewById(R.id.btnTriggerParkEvent); mBtnTriggerCallUserInfo = findViewById(R.id.btnTriggerCallUserInfo); - mBtnTriggerCallVRMsg = findViewById(R.id.btnTriggerCallVRMsg); btnTriggerRearVIPCarTip = findViewById(R.id.btnTriggerRearVIPCarTip); btnTriggerVehicleBrakes = findViewById(R.id.btnTriggerVehicleBrakes); @@ -208,6 +207,15 @@ public class V2XTestConsoleWindow extends ConstraintLayout { LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent); }); + btnTriggerReverseVehicleRoutePrediction.setOnClickListener(v -> { + V2XMessageEntity> v2XMessageEntity = + TestOnLineCarUtils.getV2XScenarionVRReverseCarData(); + + Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); + intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); + LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent); + }); + } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java index 3e2f276418..350b76c6d6 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/TestOnLineCarUtils.java @@ -291,13 +291,47 @@ public class TestOnLineCarUtils { } /** - * 模拟 前方障碍物 + * 模拟 后方VIP */ - public static V2XMessageEntity> getV2XScenarionVRData() { + public static V2XMessageEntity> getV2XScenarionVRBehindVIPData() { try { InputStream inputStream = V2XUtils.getApp() .getResources() - .openRawResource(R.raw.scenario_push_vr_event_data); + .openRawResource(R.raw.scenario_push_vr_hehind_vip_data); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + int len = -1; + byte[] buffer = new byte[1024]; + while ((len = inputStream.read(buffer)) != -1) { + baos.write(buffer, 0, len); + } + inputStream.close(); + + // 加载数据源 + V2XSpecialCarRes v2xRoadEventEntity = + GsonUtil.objectFromJson(baos.toString(), V2XSpecialCarRes.class); + + V2XMessageEntity> v2xMessageEntity = new V2XMessageEntity<>(); + // 控制类型 + v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING); + // 设置数据 + v2xMessageEntity.setContent(v2xRoadEventEntity.getCoordinates()); + // 控制展示状态 + v2xMessageEntity.setShowState(true); + return v2xMessageEntity; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * 逆向车辆路线预判 + */ + public static V2XMessageEntity> getV2XScenarionVRReverseCarData() { + try { + InputStream inputStream = V2XUtils.getApp() + .getResources() + .openRawResource(R.raw.scenario_push_vr_reverse_car_data); ByteArrayOutputStream baos = new ByteArrayOutputStream(); int len = -1; byte[] buffer = new byte[1024]; diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml b/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml index be3a11a952..7b52dcf96f 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml @@ -337,17 +337,5 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" /> -