This commit is contained in:
tongchenfei
2020-10-27 17:50:28 +08:00
parent 6339f604b8
commit dad639fe8a
3 changed files with 142 additions and 60 deletions

View File

@@ -21,9 +21,9 @@ public class CloudRoadData implements Parcelable {
private long systemTime;
/**红绿灯状态 1红 2绿 3黄*/
private Integer lightStatus;//
private int lightStatus;//
/**红绿灯剩余时间 读秒*/
private Integer lightLeftTime;
private int lightLeftTime;
/**视频流直播地址*/
private String rtmpUrl;//
@@ -31,22 +31,15 @@ public class CloudRoadData implements Parcelable {
public List<CloudLocationInfo> coordinates;
protected CloudRoadData(Parcel in) {
type = in.readInt();
lat = in.readDouble();
lon = in.readDouble();
speed = in.readDouble();
systemTime = in.readLong();
if (in.readByte() == 0) {
lightStatus = null;
} else {
lightStatus = in.readInt();
}
if (in.readByte() == 0) {
lightLeftTime = null;
} else {
lightLeftTime = in.readInt();
}
lightStatus = in.readInt();
lightLeftTime = in.readInt();
rtmpUrl = in.readString();
distance = in.readDouble();
coordinates = in.createTypedArrayList(CloudLocationInfo.CREATOR);
@@ -59,18 +52,8 @@ public class CloudRoadData implements Parcelable {
dest.writeDouble(lon);
dest.writeDouble(speed);
dest.writeLong(systemTime);
if (lightStatus == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeInt(lightStatus);
}
if (lightLeftTime == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeInt(lightLeftTime);
}
dest.writeInt(lightStatus);
dest.writeInt(lightLeftTime);
dest.writeString(rtmpUrl);
dest.writeDouble(distance);
dest.writeTypedList(coordinates);
@@ -92,4 +75,84 @@ public class CloudRoadData implements Parcelable {
return new CloudRoadData[size];
}
};
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
public double getSpeed() {
return speed;
}
public void setSpeed(double speed) {
this.speed = speed;
}
public long getSystemTime() {
return systemTime;
}
public void setSystemTime(long systemTime) {
this.systemTime = systemTime;
}
public int getLightStatus() {
return lightStatus;
}
public void setLightStatus(int lightStatus) {
this.lightStatus = lightStatus;
}
public int getLightLeftTime() {
return lightLeftTime;
}
public void setLightLeftTime(int lightLeftTime) {
this.lightLeftTime = lightLeftTime;
}
public String getRtmpUrl() {
return rtmpUrl;
}
public void setRtmpUrl(String rtmpUrl) {
this.rtmpUrl = rtmpUrl;
}
public double getDistance() {
return distance;
}
public void setDistance(double distance) {
this.distance = distance;
}
public List<CloudLocationInfo> getCoordinates() {
return coordinates;
}
public void setCoordinates(List<CloudLocationInfo> coordinates) {
this.coordinates = coordinates;
}
}

View File

@@ -16,10 +16,10 @@ class MogoSnapshotSetData implements Parcelable {
private String msgId;
private Long time;
private long time;
//过期时间
private Long expire;
private long expire;
//总数据集合
private List<CloudRoadData> allList;
@@ -30,16 +30,8 @@ class MogoSnapshotSetData implements Parcelable {
protected MogoSnapshotSetData(Parcel in) {
msgId = in.readString();
if (in.readByte() == 0) {
time = null;
} else {
time = in.readLong();
}
if (in.readByte() == 0) {
expire = null;
} else {
expire = in.readLong();
}
time = in.readLong();
expire = in.readLong();
allList = in.createTypedArrayList(CloudRoadData.CREATOR);
trafficLight = in.readParcelable(CloudRoadData.class.getClassLoader());
}
@@ -47,18 +39,8 @@ class MogoSnapshotSetData implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(msgId);
if (time == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeLong(time);
}
if (expire == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeLong(expire);
}
dest.writeLong(time);
dest.writeLong(expire);
dest.writeTypedList(allList);
dest.writeParcelable(trafficLight, flags);
}
@@ -90,4 +72,44 @@ class MogoSnapshotSetData implements Parcelable {
", trafficLight=" + trafficLight +
'}';
}
public String getMsgId() {
return msgId;
}
public void setMsgId(String msgId) {
this.msgId = msgId;
}
public long getTime() {
return time;
}
public void setTime(long time) {
this.time = time;
}
public long getExpire() {
return expire;
}
public void setExpire(long expire) {
this.expire = expire;
}
public List<CloudRoadData> getAllList() {
return allList;
}
public void setAllList(List<CloudRoadData> allList) {
this.allList = allList;
}
public CloudRoadData getTrafficLight() {
return trafficLight;
}
public void setTrafficLight(CloudRoadData trafficLight) {
this.trafficLight = trafficLight;
}
}

View File

@@ -12,6 +12,7 @@ import android.widget.TextView;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.CloudRoadData;
import com.mogo.module.common.entity.MogoSnapshotSetData;
import com.mogo.module.extensions.R;
import com.mogo.service.adas.IMogoAdasWarnMessageCallback;
@@ -94,10 +95,7 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
if (!isVrMode) {
return;
}
// 处理adas识别的时间主要是行人碰撞预警
if (msg.type == MogoADASWarnType.ADAS_WARNING_PERSON) {
MogoApisHandler.getInstance().getApis().getEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_PEOPLE_WARN, R.drawable.module_ext_people_warn, "前方注意行人");
}
if (msg.type == MogoADASWarnType.ADAS_WARNING_LIMIT_SPEED) {
// 收到限速信息,更新界面
if (tvLimitSpeed != null) {
@@ -164,13 +162,6 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
if (!isVrMode) {
return;
}
// todo 处理发给adas的事件, 主要处理逆向超车和obu行人碰撞
String id = intent.getStringExtra("v2x_warning_type");
if (id != null) {
if ("100003".equals(id)) {// 行人碰撞
MogoApisHandler.getInstance().getApis().getEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_PEOPLE_WARN, R.drawable.module_ext_people_warn, "前方注意行人");
}
}
int type = intent.getIntExtra("type", -1);
if (type == 2) {
@@ -204,10 +195,11 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
}
}
private void handleCloudTrafficLight(){
private void handleCloudTrafficLight(CloudRoadData roadData){
if (tvTrafficLight != null && !handler.hasMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_OBU)) {
handler.removeMessages(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD);
// todo drawTrafficLight
handler.sendEmptyMessageDelayed(MSG_HIDE_TRAFFIC_LIGHT_BY_CLOUD,
HIDE_TRAFFIC_LIGHT_DELAY);
}
@@ -243,5 +235,10 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca
@Override
public void onMsgReceived(MogoSnapshotSetData obj) {
Logger.d(TAG, "收到大而全数据: " + obj);
CloudRoadData roadData = obj.getTrafficLight();
if (roadData != null) {
Logger.d(TAG, "收到红绿灯数据");
handleCloudTrafficLight(roadData);
}
}
}