socketManager and socketHandler fix

This commit is contained in:
zhongchao
2021-01-25 17:21:26 +08:00
parent ff1a533447
commit cad4280d3c
10 changed files with 525 additions and 178 deletions

View File

@@ -0,0 +1,240 @@
package com.mogo.realtime.entity;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import java.util.List;
/**
* 云端道路数据
*
* @author tongchenfei
*/
public class CloudRoadData implements Parcelable {
public static final int FROM_MY_LOCATION = 1;
public static final int FROM_ADAS = 2;
public static final int FROM_ROAD_UNIT = 3;
/**
* 物体类型
*/
private int type = -1;
private int fromType;
private double lat;
private double lon;
private String uuid;
private String sn;
private double speed;
private double heading;
private long systemTime;
/**
* 红绿灯状态 1红 2绿 3黄
*/
private int lightStatus;//
/**
* 红绿灯剩余时间 读秒
*/
private int lightLeftTime;
/**
* 视频流直播地址
*/
private String rtmpUrl;//
private double distance;//距离
private List< CloudLocationInfo > coordinates;
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 * 1000;
}
public void setDistance( double distance ) {
this.distance = distance;
}
public List< CloudLocationInfo > getCoordinates() {
return coordinates;
}
public void setCoordinates( List< CloudLocationInfo > coordinates ) {
this.coordinates = coordinates;
}
public void setUuid( String uuid ) {
this.uuid = uuid;
}
public String getUuid() {
return uuid;
}
public String getSn() {
return sn;
}
public double getHeading() {
return heading;
}
public void setHeading( double heading ) {
this.heading = heading;
}
public String getUniqueKey() {
if ( !TextUtils.isEmpty( uuid ) ) {
return uuid;
}
return sn;
}
public int getFromType() {
return fromType;
}
public void setFromType( int fromType ) {
this.fromType = fromType;
}
public CloudRoadData() {
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeInt( this.type );
dest.writeInt( this.fromType );
dest.writeDouble( this.lat );
dest.writeDouble( this.lon );
dest.writeString( this.uuid );
dest.writeString( this.sn );
dest.writeDouble( this.speed );
dest.writeDouble( this.heading );
dest.writeLong( this.systemTime );
dest.writeInt( this.lightStatus );
dest.writeInt( this.lightLeftTime );
dest.writeString( this.rtmpUrl );
dest.writeDouble( this.distance );
dest.writeTypedList( this.coordinates );
}
protected CloudRoadData(Parcel in ) {
this.type = in.readInt();
this.fromType = in.readInt();
this.lat = in.readDouble();
this.lon = in.readDouble();
this.uuid = in.readString();
this.sn = in.readString();
this.speed = in.readDouble();
this.heading = in.readDouble();
this.systemTime = in.readLong();
this.lightStatus = in.readInt();
this.lightLeftTime = in.readInt();
this.rtmpUrl = in.readString();
this.distance = in.readDouble();
this.coordinates = in.createTypedArrayList( CloudLocationInfo.CREATOR );
}
public static final Creator<CloudRoadData> CREATOR = new Creator<CloudRoadData>() {
@Override
public CloudRoadData createFromParcel(Parcel source ) {
return new CloudRoadData( source );
}
@Override
public CloudRoadData[] newArray(int size ) {
return new CloudRoadData[size];
}
};
@Override
public boolean equals( Object o ) {
if ( this == o ) {
return true;
}
if ( o == null || getClass() != o.getClass() ) {
return false;
}
CloudRoadData that = (CloudRoadData) o;
return Double.compare( that.lat, lat ) == 0 &&
Double.compare( that.lon, lon ) == 0;
}
}

View File

@@ -0,0 +1,151 @@
package com.mogo.realtime.entity;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.List;
public
/*
* @author congtaowang
* @since 2020/10/26
*
* 描述
*/
class MogoSnapshotSetData implements Parcelable {
private String msgId;
private long time;
//过期时间
private long expire;
//总数据集合
private List<CloudRoadData> allList;
// 近景adas数据
private List<CloudRoadData> nearList;
//红绿灯
private CloudRoadData trafficLight;
//路边摄像头
private CloudRoadData camera;
// 自车速度 本地添加
public double curSpeed = 0.0;
@Override
public String toString() {
return "MogoSnapshotSetData{" +
"msgId='" + msgId + '\'' +
", time=" + time +
", expire=" + expire +
", allList=" + allList +
", nearList=" + nearList +
", camera=" + camera +
", curSpeed=" + curSpeed +
'}';
}
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;
}
public CloudRoadData getCamera() {
return camera;
}
public void setCamera(CloudRoadData camera) {
this.camera = camera;
}
public List< CloudRoadData > getNearList() {
return nearList;
}
public void setNearList( List< CloudRoadData > nearList ) {
this.nearList = nearList;
}
public MogoSnapshotSetData() {
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.msgId );
dest.writeLong( this.time );
dest.writeLong( this.expire );
dest.writeTypedList( this.allList );
dest.writeTypedList( this.nearList );
dest.writeParcelable( this.trafficLight, flags );
dest.writeParcelable( this.camera, flags );
dest.writeDouble( this.curSpeed );
}
protected MogoSnapshotSetData(Parcel in ) {
this.msgId = in.readString();
this.time = in.readLong();
this.expire = in.readLong();
this.allList = in.createTypedArrayList( CloudRoadData.CREATOR );
this.nearList = in.createTypedArrayList( CloudRoadData.CREATOR );
this.trafficLight = in.readParcelable( CloudRoadData.class.getClassLoader() );
this.camera = in.readParcelable( CloudRoadData.class.getClassLoader() );
this.curSpeed = in.readDouble();
}
public static final Creator<MogoSnapshotSetData> CREATOR = new Creator<MogoSnapshotSetData>() {
@Override
public MogoSnapshotSetData createFromParcel(Parcel source ) {
return new MogoSnapshotSetData( source );
}
@Override
public MogoSnapshotSetData[] newArray(int size ) {
return new MogoSnapshotSetData[size];
}
};
}

View File

@@ -1,8 +1,6 @@
package com.mogo.realtime.entity;
import com.mogo.realtime.location.LocationResult;
import java.util.List;
public