This commit is contained in:
liujing
2020-10-28 10:55:59 +08:00
parent 9da8c1fdee
commit fba470c98c
5 changed files with 169 additions and 0 deletions

View File

@@ -101,6 +101,12 @@ public class V2XMessageListener_401003 implements IMogoOnMessageListener<V2XPush
showTip(alarmMessage.getTts());
ADASUtils.broadcastToADAS_TTS(V2XServiceManager.getContext(), alarmMessage);
break;
case "100019":
v2XMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING);
v2XMessageEntity.setContent(alarmMessage);
v2XMessageEntity.setShowState(true);
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity);
break;
default:
ADASUtils.broadcastToADAS_TTS(V2XServiceManager.getContext(), alarmMessage);
break;

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import androidx.constraintlayout.widget.ConstraintLayout;
@@ -49,6 +50,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
private Button mBtnTriggerSeekHelpEvent;
private Button mBtnTriggerParkEvent;
private Button mBtnTriggerCallUserInfo;
private Button mBtnTriggerCallVRMsg;
private Button btnTriggerRearVIPCarTip,
btnTriggerVehicleBrakes,
@@ -98,6 +100,7 @@ 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);
@@ -195,6 +198,16 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
});
mBtnTriggerCallVRMsg.setOnClickListener(v -> {
V2XMessageEntity<List<MarkerExploreWay>> v2XMessageEntity =
TestOnLineCarUtils.getV2XIllegalParkData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
});
}
}

View File

@@ -289,4 +289,38 @@ public class TestOnLineCarUtils {
}
return null;
}
/**
* 模拟 前方障碍物
*/
public static V2XMessageEntity<List<V2XSpecialCarRes.V2XMarkerEntity>> getV2XScenarionVRData() {
try {
InputStream inputStream = V2XUtils.getApp()
.getResources()
.openRawResource(R.raw.scenario_push_vr_event_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<List<V2XSpecialCarRes.V2XMarkerEntity>> 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;
}
}

View File

@@ -337,5 +337,17 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/btnTriggerCallVRMsg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#E91451"
android:padding="@dimen/dp_10"
android:text="测试VR推送消息"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_22"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</com.google.android.flexbox.FlexboxLayout>
</RelativeLayout>

View File

@@ -0,0 +1,104 @@
{
"result":{
"dataType":[
"CARD_TYPE_ROAD_CONDITION"
],
"exploreWay":[
{
"addr":"北三环麻家什字",
"type":"CARD_TYPE_ROAD_CONDITION",
"poiType":"10016",
"infoId":"100243059",
"items":[
{
"content":"违法停车",
"illegalCount":2
}
],
"location":{
"address":"北三环麻家什字",
"angle":0,
"lat":40.203659,
"lon":116.742392
},
"generateTime":0,
"distance":0,
"fileType":3,
"direction":0,
"canLive":false
},
{
"addr":"北三环全段",
"type":"CARD_TYPE_ROAD_CONDITION",
"poiType":"10016",
"infoId":"100911795",
"items":[
{
"content":"违法停车",
"illegalCount":13
}
],
"location":{
"address":"北三环全段",
"angle":0,
"lat":40.200468,
"lon":116.744447
},
"generateTime":0,
"distance":0,
"fileType":3,
"direction":0,
"canLive":false
},
{
"addr":"北三环",
"type":"CARD_TYPE_ROAD_CONDITION",
"poiType":"10016",
"infoId":"101844924",
"items":[
{
"content":"违法停车",
"illegalCount":4
}
],
"location":{
"address":"北三环",
"angle":0,
"lat":40.202885,
"lon":116.745691
},
"generateTime":0,
"distance":0,
"fileType":3,
"direction":0,
"canLive":false
},
{
"addr":"北三环(经开段)吕小寨立交-店子立交",
"type":"CARD_TYPE_ROAD_CONDITION",
"poiType":"10016",
"infoId":"102265470",
"items":[
{
"content":"违法停车",
"illegalCount":1
}
],
"location":{
"address":"北三环(经开段)吕小寨立交-店子立交",
"angle":0,
"lat":40.201902,
"lon":116.73552
},
"generateTime":0,
"distance":0,
"fileType":3,
"direction":0,
"canLive":false
}
],
"code":-1
},
"msg":"success",
"code":0
}