预警模拟数据tts播报
This commit is contained in:
@@ -9,8 +9,8 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class V2XWarningEntity implements Serializable {
|
||||
|
||||
//事件类型 碰撞预警/盲区变道预警...
|
||||
private String type;
|
||||
//事件类型 行人0/自行车1/摩托车2/小汽车3/公交车4
|
||||
private int type;
|
||||
//目标物类型
|
||||
private String targetType;
|
||||
//目标物位置
|
||||
@@ -30,7 +30,49 @@ public class V2XWarningEntity implements Serializable {
|
||||
//速度
|
||||
private float speed;
|
||||
|
||||
public void setType(String type) {
|
||||
private String tipContent;
|
||||
|
||||
private String tts;
|
||||
|
||||
public void setTipContent(int type) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
this.tipContent = "行人碰撞预警";
|
||||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
case 4:
|
||||
this.tipContent = "前车碰撞预警";
|
||||
break;
|
||||
case 2:
|
||||
this.tipContent = "摩托车碰撞预警";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void setTts(int type) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
this.tts = "注意行人";
|
||||
break;
|
||||
case 1:
|
||||
this.tts = "注意自行车";
|
||||
break;
|
||||
case 2:
|
||||
this.tts = "注意摩托车";
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
this.tts = "注意前方车辆";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@@ -74,7 +116,7 @@ public class V2XWarningEntity implements Serializable {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -102,7 +144,6 @@ public class V2XWarningEntity implements Serializable {
|
||||
return distance;
|
||||
}
|
||||
|
||||
|
||||
public int getFrom() {
|
||||
return from;
|
||||
}
|
||||
@@ -119,20 +160,36 @@ public class V2XWarningEntity implements Serializable {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public String getTipContent() {
|
||||
if (this.tipContent == null) {
|
||||
setTipContent(type);
|
||||
}
|
||||
return tipContent;
|
||||
}
|
||||
|
||||
public String getTts() {
|
||||
if (tts == null) {
|
||||
setTts(type);
|
||||
}
|
||||
return tts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "V2XWarningEntity{" +
|
||||
"type='" + type + '\'' +
|
||||
"type=" + type +
|
||||
", targetType='" + targetType + '\'' +
|
||||
", lat=" + lat +
|
||||
", lon=" + lon +
|
||||
", distance=" + distance +
|
||||
", collisionLat=" + collisionLat +
|
||||
", collisionLon=" + collisionLon +
|
||||
", from='" + from + '\'' +
|
||||
", angle='" + angle + '\'' +
|
||||
", direction='" + direction + '\'' +
|
||||
", from=" + from +
|
||||
", angle=" + angle +
|
||||
", direction=" + direction +
|
||||
", speed=" + speed +
|
||||
", tipContent='" + tipContent + '\'' +
|
||||
", tts='" + tts + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,15 @@ import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.VoicePreemptType;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
|
||||
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
@@ -59,7 +62,9 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow {
|
||||
public void show(Object entity) {
|
||||
if (entity != null) {
|
||||
mV2XWarningEntity = (V2XWarningEntity) entity;
|
||||
distance.setText(String.valueOf(mV2XWarningEntity.getDistance())+"米");
|
||||
distance.setText(String.valueOf(mV2XWarningEntity.getDistance()) + "米");
|
||||
warningTextView.setText(mV2XWarningEntity.getTipContent());
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(mV2XWarningEntity.getTts());
|
||||
}
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"type":3,
|
||||
"type":0,
|
||||
"targetType": "1",
|
||||
"lat":39.9760799115428,
|
||||
"lon":116.411360351446,
|
||||
|
||||
Reference in New Issue
Block a user