预警模拟数据tts播报

This commit is contained in:
liujing
2021-03-29 11:44:35 +08:00
parent 18767208cc
commit 471c45f68d
3 changed files with 73 additions and 11 deletions

View File

@@ -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 + '\'' +
'}';
}
}