[add] v2x数据改变->更新main状态 接口添加

This commit is contained in:
liujing
2021-03-25 11:00:00 +08:00
parent b60e2803d4
commit 05472a2716
16 changed files with 312 additions and 80 deletions

View File

@@ -1,7 +1,6 @@
package com.mogo.module.v2x.scenario.impl;
import android.content.Intent;
import android.util.Log;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@@ -21,6 +20,7 @@ import com.mogo.module.v2x.scenario.scene.pushVR.V2XPushVREventScenario;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario;
import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpScenario;
import com.mogo.module.v2x.scenario.scene.ugc.V2XEventUgcScenario;
import com.mogo.module.v2x.scenario.scene.warning.V2XFrontWarningScenario;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
@@ -75,8 +75,8 @@ public class V2XScenarioManager implements IV2XScenarioManager {
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
mV2XScenario = new V2XSeekHelpScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING :
case ALERT_RECOMMEND_PARKING :
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING:
case ALERT_RECOMMEND_PARKING:
mV2XScenario = new V2XFatigueDrivingScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING:
@@ -106,6 +106,12 @@ public class V2XScenarioManager implements IV2XScenarioManager {
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW:
mV2XScenario = new V2XPushVREventScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP:
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_LEFT:
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_RIGHT:
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_BOTTOM:
mV2XScenario = new V2XFrontWarningScenario();
break;
default:
mV2XScenario = null;
Logger.e(MODULE_NAME, "当前V2X消息类型未定义。");

View File

@@ -214,8 +214,15 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
v2XMessageEntity.getContent().getNoveltyInfo());
});
mBtnTriggerWarningEvent.setOnClickListener(v->{
//车路云—场景预警-V1.0 碰撞预警
mBtnTriggerWarningEvent.setOnClickListener(v->{
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioPushFrontWarningEventData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
});
mBtnTriggerPushEvent.setOnClickListener(v -> {

View File

@@ -0,0 +1,72 @@
package com.mogo.module.v2x.scenario.scene.warning;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.MogoServices;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.impl.MogoServiceApis;
import com.mogo.service.impl.v2x.V2XManager;
import com.mogo.service.v2x.IV2XListener;
import com.mogo.service.v2x.IV2XProvider;
/**
* @author liujing
* @description 车路云—场景预警-V1.0 前车/行人/摩托车/盲区碰撞预警
* @since: 2021/3/24
*/
public class V2XFrontWarningScenario extends AbsV2XScenario {
private int type;
private IV2XListener mIV2XListener;
@Override
public void init(@Nullable V2XMessageEntity v2XMessageEntity) {
type = v2XMessageEntity.getType();
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedWithType(type, TAG);
show();
}
@Override
public void show() {
Log.d(TAG, "show");
}
@Override
public void showWindow() {
}
@Override
public void closeWindow() {
}
@Override
public void showButton() {
}
@Override
public void closeButton() {
}
@Override
public void drawPOI() {
}
@Override
public void clearPOI() {
}
}

View File

@@ -156,7 +156,7 @@ public class TestOnLineCarUtils {
return null;
}
public static V2XMessageEntity<V2XPushMessageEntity> getV2XScenarioPushWarningEventData() {
public static V2XMessageEntity<V2XPushMessageEntity> getV2XScenarioPushFrontWarningEventData() {
try {
InputStream inputStream = V2XUtils.getApp()
.getResources()
@@ -174,7 +174,7 @@ public class TestOnLineCarUtils {
V2XMessageEntity<V2XPushMessageEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING);
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP);
// 设置数据
v2xMessageEntity.setContent(v2xRoadEventEntity);
// 控制展示状态