add MoGoAiCloud sdk --> socket passport replace origin logic

This commit is contained in:
zhongchao
2021-02-23 11:20:39 +08:00
parent 024988b241
commit 632ececb99
45 changed files with 1285 additions and 873 deletions

View File

@@ -15,9 +15,9 @@ import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.api.CallChatApi;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.module.common.entity.CloudLocationInfo;
import com.mogo.module.common.entity.CloudRoadData;
import com.mogo.module.common.entity.MogoSnapshotSetData;
import com.mogo.realtime.entity.CloudLocationInfo;
import com.mogo.realtime.entity.CloudRoadData;
import com.mogo.realtime.entity.MogoSnapshotSetData;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.ThreadPoolService;
@@ -34,7 +34,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public
/**
/*
* @author congtaowang
* @since 2020/10/28
*
@@ -76,9 +76,9 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
}
// 云端 marker 缓存
private Map< String, IMogoMarker > mCloudSnapshotMarkersCaches = new ConcurrentHashMap<>();
private final Map< String, IMogoMarker > mCloudSnapshotMarkersCaches = new ConcurrentHashMap<>();
private Map< String, CloudRoadData > mLastPositions = new ConcurrentHashMap<>();
private final Map< String, CloudRoadData > mLastPositions = new ConcurrentHashMap<>();
private boolean mIsVrMode = false;
@@ -89,9 +89,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
Logger.d( TAG, "%s - %s", descriptor, isTrue );
mChangeCarModeStatus = true;
ThreadPoolService.execute( () -> {
clearOldStyleMarkers();
} );
ThreadPoolService.execute(this::clearOldStyleMarkers);
}
private void clearOldStyleMarkers() {
@@ -118,7 +116,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
/**
* 其他车辆、rsu 车辆数据
*
* @param data
* @param data 自车周边数据
*/
public void renderSnapshotData( MogoSnapshotSetData data,
boolean machineVision ) {
@@ -237,24 +235,24 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
/**
* vr 模式下显示合并数据,否则只显示上报位置的车辆
*
* @param dataList
* @param data 道路数据集合
*/
private void filterData( List< CloudRoadData > dataList ) {
if ( dataList == null || dataList.isEmpty() ) {
private void filterData( List<CloudRoadData> data ) {
if ( data == null || data.isEmpty() ) {
return;
}
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
return;
}
List< CloudRoadData > newList = new ArrayList<>();
for ( CloudRoadData cloudRoadData : dataList ) {
for ( CloudRoadData cloudRoadData : data ) {
if ( cloudRoadData.getFromType() != CloudRoadData.FROM_MY_LOCATION ) {
continue;
}
newList.add( cloudRoadData );
}
dataList.clear();
dataList.addAll( newList );
data.clear();
data.addAll( newList );
}
private void bindClickListener( IMogoMarker marker ) {
@@ -267,7 +265,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
/**
* 过滤本次数据中,不存在的 marker
*
* @param data
* @param data 道路数据集合
*/
private void purgeCloudSnapshotData( List< CloudRoadData > data ) {
if ( data == null || data.isEmpty() ) {

View File

@@ -1,250 +0,0 @@
package com.mogo.module.common.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;
private long satelliteTime;
/**
* 红绿灯状态 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 long getSatelliteTime() {
return satelliteTime;
}
public void setSatelliteTime( long satelliteTime ) {
this.satelliteTime = satelliteTime;
}
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 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;
}
@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.writeLong( this.satelliteTime );
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.satelliteTime = 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];
}
};
}

View File

@@ -1,151 +0,0 @@
package com.mogo.module.common.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];
}
};
}