add note
This commit is contained in:
@@ -9,7 +9,7 @@ import android.content.Context;
|
||||
public interface IMogoCloudSocketManager {
|
||||
|
||||
/**
|
||||
* 初始化,各模块不用关心
|
||||
* 初始化
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param appId 一般为包名,不参与通道的建立,一般用于发消息
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.cloud.socket;
|
||||
|
||||
/**
|
||||
* 消息回执监听
|
||||
* AI云平台长链消息回执监听
|
||||
*/
|
||||
public interface IMogoCloudSocketMsgAckListener {
|
||||
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
package com.mogo.cloud.socket;
|
||||
|
||||
/**
|
||||
* 消息回调
|
||||
* AI云平台长链消息回调
|
||||
*/
|
||||
public interface IMogoCloudSocketOnMessageListener<T> {
|
||||
|
||||
/**
|
||||
* 获取解析实例对象
|
||||
* @return class
|
||||
*/
|
||||
Class<T> target();
|
||||
|
||||
/**
|
||||
* 消息接收回调
|
||||
* @param obj T 业务bean数据
|
||||
*/
|
||||
void onMsgReceived(T obj);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.cloud.socket;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
* AI云平台 长链消息数据包装体对象
|
||||
*/
|
||||
public class MsgBody {
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ import static com.mogo.cloud.httpdns.MogoHttpDnsConfig.HTTP_DNS_ENV_DEV;
|
||||
import static com.mogo.cloud.httpdns.MogoHttpDnsConfig.HTTP_DNS_ENV_QA;
|
||||
import static com.mogo.cloud.httpdns.MogoHttpDnsConfig.HTTP_DNS_ENV_RELEASE;
|
||||
|
||||
/**
|
||||
* Socket 长链服务
|
||||
*/
|
||||
public class SocketManager implements IMogoCloudSocketManager, Callback {
|
||||
|
||||
private static final String TAG = "SocketManager";
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.mogo.cloud.socket;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* AI云平台 长链业务数据包装体对象
|
||||
*/
|
||||
public class WebSocketData implements Serializable {
|
||||
|
||||
private long seq;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.mogo.cloud.socket;
|
||||
|
||||
/**
|
||||
* 长链通道上传、下发业务消息类型
|
||||
*/
|
||||
public enum WebSocketMsgType {
|
||||
|
||||
MSG_TYPE_UPLINK_CAR_DATA(0,"自车与ADAS数据"),
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.realtime.Interface.RealTimeProvider;
|
||||
|
||||
/**
|
||||
*
|
||||
* 提供RealTime SPI接口实例对象管理类
|
||||
*/
|
||||
class RealTimeDelegateManager extends AbstractDelegateManager<RealTimeProvider> {
|
||||
private static RealTimeDelegateManager sInstance = null;
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* RealTime Provider SPI 单例对象
|
||||
*/
|
||||
public class RealTimeProviderImp implements RealTimeProvider {
|
||||
|
||||
|
||||
@@ -7,31 +7,31 @@ import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* 蘑菇AI云平台实时定位点上报服务接口
|
||||
*/
|
||||
public interface RealTimeProvider {
|
||||
|
||||
/**
|
||||
* 获取 adas 识别列表
|
||||
* 获取 adas 识别列表,由外部传入
|
||||
*/
|
||||
List<ADASRecognizedResult> getLastADASRecognizedResult();
|
||||
|
||||
/**
|
||||
* 注册消息监听
|
||||
* 云平台数据下发 消息监听
|
||||
*
|
||||
* @param listener 回调
|
||||
*/
|
||||
void registerOnMessageListener(IMogoCloudOnMsgListener listener);
|
||||
|
||||
/**
|
||||
* 取消消息监听
|
||||
* 云平台数据下发 取消消息监听
|
||||
*
|
||||
* @param listener 回调
|
||||
*/
|
||||
void unRegisterOnMessageListener(IMogoCloudOnMsgListener listener);
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
* 发送消息,由外部传入
|
||||
*/
|
||||
List<CloudLocationInfo> getLocationMsg();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.mogo.realtime.constant;
|
||||
package com.mogo.realtime.core;
|
||||
|
||||
import android.os.SystemClock;
|
||||
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.realtime.socket.SocketHandler;
|
||||
import com.mogo.realtime.util.MogoLatLng;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -12,8 +11,6 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 定位预测纠错策略
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class SimpleLocationCorrectStrategy {
|
||||
private static final String TAG = "SimpleLocationCorrectStrategy";
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.realtime.constant;
|
||||
package com.mogo.realtime.core;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.mogo.realtime.socket.SocketHandler;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* 上报坐标服务
|
||||
*/
|
||||
public class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener {
|
||||
|
||||
@@ -2,9 +2,6 @@ package com.mogo.realtime.entity;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/25
|
||||
*
|
||||
* adas 识别物体参数
|
||||
*/
|
||||
class ADASRecognizedResult {
|
||||
@@ -25,7 +22,7 @@ class ADASRecognizedResult {
|
||||
public String color;
|
||||
|
||||
/**
|
||||
*
|
||||
* 车ID
|
||||
*/
|
||||
public String carId;
|
||||
|
||||
@@ -40,7 +37,7 @@ class ADASRecognizedResult {
|
||||
public double lon;
|
||||
|
||||
/**
|
||||
* 朝向
|
||||
* 车头朝向
|
||||
*/
|
||||
public double heading;
|
||||
|
||||
|
||||
@@ -10,17 +10,43 @@ import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 云端定位信息和自车定位信息
|
||||
*
|
||||
* @author tongchenfei
|
||||
* 自车定位信息
|
||||
*/
|
||||
public class CloudLocationInfo implements Parcelable {
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private double lat;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private double lon;
|
||||
|
||||
/**
|
||||
* 车头方向
|
||||
*/
|
||||
private double heading;
|
||||
|
||||
/**
|
||||
* 系统时间
|
||||
*/
|
||||
private long systemTime;
|
||||
|
||||
/**
|
||||
* 卫星时间
|
||||
*/
|
||||
private long satelliteTime;
|
||||
|
||||
/**
|
||||
* 海拔
|
||||
*/
|
||||
private double alt;
|
||||
|
||||
/**
|
||||
* 车速
|
||||
*/
|
||||
private double speed;
|
||||
|
||||
public CloudLocationInfo() {
|
||||
|
||||
@@ -7,9 +7,7 @@ import android.text.TextUtils;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 云端道路数据
|
||||
*
|
||||
* @author tongchenfei
|
||||
* AI云平台下发 道路数据
|
||||
*/
|
||||
public class CloudRoadData implements Parcelable {
|
||||
|
||||
@@ -46,9 +44,9 @@ public class CloudRoadData implements Parcelable {
|
||||
/**
|
||||
* 视频流直播地址
|
||||
*/
|
||||
private String rtmpUrl;//
|
||||
private String rtmpUrl;
|
||||
|
||||
private double distance;//距离
|
||||
private double distance;
|
||||
|
||||
private List< CloudLocationInfo > coordinates;
|
||||
|
||||
|
||||
@@ -3,17 +3,13 @@ package com.mogo.realtime.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/10/25
|
||||
*
|
||||
* 自车定位信息
|
||||
*/
|
||||
class LocationResult {
|
||||
public class LocationResult {
|
||||
|
||||
/**
|
||||
* sn
|
||||
* sn 车辆唯一识别号
|
||||
*/
|
||||
public String sn;
|
||||
|
||||
|
||||
@@ -5,38 +5,51 @@ import android.os.Parcelable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/10/26
|
||||
*
|
||||
* 描述
|
||||
* AI云平台下发 自车周边数据
|
||||
*/
|
||||
class MogoSnapshotSetData implements Parcelable {
|
||||
public class MogoSnapshotSetData implements Parcelable {
|
||||
|
||||
/**
|
||||
* 消息ID
|
||||
*/
|
||||
private String msgId;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
private long time;
|
||||
|
||||
//过期时间
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private long expire;
|
||||
|
||||
//总数据集合
|
||||
/**
|
||||
* 道路数据集合
|
||||
*/
|
||||
private List<CloudRoadData> allList;
|
||||
|
||||
// 近景adas数据
|
||||
/**
|
||||
* 近景adas数据
|
||||
*/
|
||||
private List<CloudRoadData> nearList;
|
||||
|
||||
//红绿灯
|
||||
/**
|
||||
* 红绿灯
|
||||
*/
|
||||
private CloudRoadData trafficLight;
|
||||
|
||||
//路边摄像头
|
||||
/**
|
||||
* 路边摄像头
|
||||
*/
|
||||
private CloudRoadData camera;
|
||||
|
||||
// 自车速度 本地添加
|
||||
/**
|
||||
* 自车速度 本地添加
|
||||
*/
|
||||
public double curSpeed = 0.0;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoSnapshotSetData{" +
|
||||
@@ -98,11 +111,11 @@ class MogoSnapshotSetData implements Parcelable {
|
||||
this.camera = camera;
|
||||
}
|
||||
|
||||
public List< CloudRoadData > getNearList() {
|
||||
public List<CloudRoadData> getNearList() {
|
||||
return nearList;
|
||||
}
|
||||
|
||||
public void setNearList( List< CloudRoadData > nearList ) {
|
||||
public void setNearList(List<CloudRoadData> nearList) {
|
||||
this.nearList = nearList;
|
||||
}
|
||||
|
||||
@@ -115,36 +128,36 @@ class MogoSnapshotSetData implements Parcelable {
|
||||
}
|
||||
|
||||
@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 );
|
||||
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 ) {
|
||||
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.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 );
|
||||
public MogoSnapshotSetData createFromParcel(Parcel source) {
|
||||
return new MogoSnapshotSetData(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoSnapshotSetData[] newArray(int size ) {
|
||||
public MogoSnapshotSetData[] newArray(int size) {
|
||||
return new MogoSnapshotSetData[size];
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3,14 +3,10 @@ package com.mogo.realtime.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/25
|
||||
*
|
||||
* 一秒一次的上行数据
|
||||
* 自车上报数据 1s内一次
|
||||
*/
|
||||
class OnePerSecondSendContent {
|
||||
public class OnePerSecondSendContent {
|
||||
|
||||
/**
|
||||
* 自车定位点
|
||||
|
||||
@@ -4,7 +4,5 @@ import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
|
||||
public interface IMogoCloudOnMsgListener {
|
||||
|
||||
void onAck(int msgId);
|
||||
|
||||
void onMsgReceived(MogoSnapshotSetData mogoSnapshotSetData);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.mogo.cloud.socket.MsgBody;
|
||||
import com.mogo.cloud.socket.SocketManager;
|
||||
import com.mogo.cloud.socket.WebSocketData;
|
||||
import com.mogo.realtime.Imp.RealTimeProviderImp;
|
||||
import com.mogo.realtime.constant.SimpleLocationCorrectStrategy;
|
||||
import com.mogo.realtime.core.SimpleLocationCorrectStrategy;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.realtime.entity.LocationResult;
|
||||
@@ -27,7 +27,7 @@ import static com.mogo.cloud.socket.WebSocketMsgType.MSG_TYPE_DOWNLINK_CAR_DATA;
|
||||
import static com.mogo.cloud.socket.WebSocketMsgType.MSG_TYPE_UPLINK_CAR_DATA;
|
||||
|
||||
/**
|
||||
*
|
||||
* Socket长链 业务服务处理类
|
||||
*/
|
||||
public class SocketHandler {
|
||||
|
||||
|
||||
@@ -9,21 +9,15 @@ import androidx.annotation.RequiresApi;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 经纬度
|
||||
*/
|
||||
public class MogoLatLng implements Parcelable {
|
||||
|
||||
public final double lat;
|
||||
@Deprecated
|
||||
public final double lng;
|
||||
public final double lon;
|
||||
|
||||
public MogoLatLng(double lat, double lon ) {
|
||||
public MogoLatLng(double lat, double lon) {
|
||||
this.lat = lat;
|
||||
this.lng = lon;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@@ -31,34 +25,23 @@ public class MogoLatLng implements Parcelable {
|
||||
return lat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated, use {@link #getLon()} instead.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public double getLng() {
|
||||
return lng;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o ) {
|
||||
if ( this == o ) return true;
|
||||
if ( o == null || getClass() != o.getClass() ) return false;
|
||||
MogoLatLng latLng = ( MogoLatLng ) o;
|
||||
return Double.compare( latLng.lat, lat ) == 0 &&
|
||||
Double.compare( latLng.lon, lon ) == 0;
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
MogoLatLng latLng = (MogoLatLng) o;
|
||||
return Double.compare(latLng.lat, lat) == 0 &&
|
||||
Double.compare(latLng.lon, lon) == 0;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash( lat, lng, lon );
|
||||
return Objects.hash(lat, lon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,26 +58,24 @@ public class MogoLatLng implements Parcelable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel( Parcel dest, int flags ) {
|
||||
dest.writeDouble( this.lat );
|
||||
dest.writeDouble( this.lng );
|
||||
dest.writeDouble( this.lon );
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeDouble(this.lat);
|
||||
dest.writeDouble(this.lon);
|
||||
}
|
||||
|
||||
protected MogoLatLng(Parcel in ) {
|
||||
protected MogoLatLng(Parcel in) {
|
||||
this.lat = in.readDouble();
|
||||
this.lng = in.readDouble();
|
||||
this.lon = in.readDouble();
|
||||
}
|
||||
|
||||
public static final Creator< MogoLatLng > CREATOR = new Creator< MogoLatLng >() {
|
||||
public static final Creator<MogoLatLng> CREATOR = new Creator<MogoLatLng>() {
|
||||
@Override
|
||||
public MogoLatLng createFromParcel( Parcel source ) {
|
||||
return new MogoLatLng( source );
|
||||
public MogoLatLng createFromParcel(Parcel source) {
|
||||
return new MogoLatLng(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng[] newArray( int size ) {
|
||||
public MogoLatLng[] newArray(int size) {
|
||||
return new MogoLatLng[size];
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,9 +4,6 @@ import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* 莫顿编码
|
||||
*
|
||||
* @author linyang
|
||||
* @since 2020.07.09
|
||||
*/
|
||||
public class MortonCode {
|
||||
|
||||
@@ -142,8 +139,4 @@ public class MortonCode {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public static void main( String[] args ) {
|
||||
System.out.println( encodeMorton( 116.39584, 39.98152 ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user