添加对向来车模拟数据
This commit is contained in:
@@ -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<List<V2XSpecialCarRes.V2XMarkerEntity>> 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);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -291,13 +291,47 @@ public class TestOnLineCarUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟 前方障碍物
|
||||
* 模拟 后方VIP
|
||||
*/
|
||||
public static V2XMessageEntity<List<V2XSpecialCarRes.V2XMarkerEntity>> getV2XScenarionVRData() {
|
||||
public static V2XMessageEntity<List<V2XSpecialCarRes.V2XMarkerEntity>> 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<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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 逆向车辆路线预判
|
||||
*/
|
||||
public static V2XMessageEntity<List<V2XSpecialCarRes.V2XMarkerEntity>> 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];
|
||||
|
||||
@@ -337,17 +337,5 @@
|
||||
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>
|
||||
@@ -1,104 +0,0 @@
|
||||
{
|
||||
"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
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"sceneId": "200009",
|
||||
"alarmContent": "发现后方VIP车辆,请注意避让",
|
||||
"expireTime": 30000,
|
||||
"sceneCategory": 0,
|
||||
"sceneDescription": "VIP车辆,请避让",
|
||||
"sceneName": "后方VIP车辆",
|
||||
"sceneLevel": 0,
|
||||
"sceneChannel": "",
|
||||
"sceneSn": "",
|
||||
"tts": "发现后方VIP车辆,注意避让",
|
||||
"zoom": false,
|
||||
"zoomScale": 15,
|
||||
"location": {
|
||||
"lat": 40.968678,
|
||||
"lon": 116.405467
|
||||
},
|
||||
"lat": 40.968678,
|
||||
"lon": 116.405467,
|
||||
"userHead": "",
|
||||
"msgImgUrl": ""
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"sceneId": "200008",
|
||||
"alarmContent": "发现逆向来车,注意减速慢行",
|
||||
"expireTime": 30000,
|
||||
"sceneCategory": 0,
|
||||
"sceneDescription": "逆向车辆对主车行驶影响预判功能",
|
||||
"sceneName": "逆向车辆路线预判",
|
||||
"sceneLevel": 0,
|
||||
"sceneChannel": "",
|
||||
"sceneSn": "",
|
||||
"tts": "对向来车注意减速",
|
||||
"zoom": false,
|
||||
"zoomScale": 15,
|
||||
"location": {
|
||||
"lat": 40.968678,
|
||||
"lon": 116.405467
|
||||
},
|
||||
"lat": 40.968678,
|
||||
"lon": 116.405467,
|
||||
"userHead": "",
|
||||
"msgImgUrl": ""
|
||||
}
|
||||
Reference in New Issue
Block a user