Merge remote-tracking branch 'origin/master'

This commit is contained in:
董宏宇
2021-01-21 21:12:19 +08:00
6 changed files with 77 additions and 15 deletions

View File

@@ -5,6 +5,7 @@ import android.content.Context;
import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.realtime.Interface.RealTimeProvider;
import com.mogo.realtime.connect.IMogoOnMessageListener;
import com.mogo.realtime.connect.IMogoOnWebSocketMessageListener;
import com.mogo.realtime.connect.MsgBody;
import com.mogo.realtime.constant.SnapshotUploadInTime;
import com.mogo.realtime.entity.ADASRecognizedResult;
@@ -23,11 +24,17 @@ public class RealTimeProviderImp implements RealTimeProvider {
@Override
public List<ADASRecognizedResult> getLastADASRecognizedResult() {
if (mDelegate != null) {
return mDelegate.getLastADASRecognizedResult();
}
return null;
}
@Override
public float getDistanceBetweenTwoPoints() {
if (mDelegate != null) {
return mDelegate.getDistanceBetweenTwoPoints();
}
return 0;
}
@@ -46,9 +53,10 @@ public class RealTimeProviderImp implements RealTimeProvider {
}
@Override
public void sendMsg(MsgBody body, IMogoOnMessageListener listener) {
public void sendMsg(Object body, IMogoOnWebSocketMessageListener listener) {
if (mDelegate != null) {
mDelegate.sendMsg(body, listener);
}
}
}

View File

@@ -18,9 +18,13 @@ public final class RealTimeApisHandler {
return sInstance;
}
public RealTimeServiceApis getApis(){
if (sApis == null){
synchronized (this){
public void initRealTimeEnvironment() {
//socketeinit locationinit rtkinit
}
public RealTimeServiceApis getApis() {
if (sApis == null) {
synchronized (this) {
// sApis = new RealTimeServiceApis();
}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.realtime.Interface;
import android.content.Context;
import com.mogo.realtime.connect.IMogoOnMessageListener;
import com.mogo.realtime.connect.IMogoOnWebSocketMessageListener;
import com.mogo.realtime.connect.MsgBody;
import com.mogo.realtime.entity.ADASRecognizedResult;
@@ -14,7 +15,7 @@ import java.util.Map;
* @description 描述
* @since: 2021/1/21
*/
public interface RealTimeProvider {
public interface RealTimeProvider<T> {
/**
* 获取 adas 识别列表
*
@@ -28,7 +29,7 @@ public interface RealTimeProvider {
float getDistanceBetweenTwoPoints();
/**
* 初始化,各模块不用关心
* 初始化
*
* @param context 上下文
* @param appId 一般为包名,不参与通道的建立,一般用于发消息
@@ -49,5 +50,5 @@ public interface RealTimeProvider {
* @param body 消息体
* @param listener 回执监听
*/
void sendMsg(MsgBody body, IMogoOnMessageListener listener );
void sendMsg(T body, IMogoOnWebSocketMessageListener listener );
}

View File

@@ -0,0 +1,27 @@
package com.mogo.realtime.connect;
/**
* 消息回调
*/
public interface IMogoOnWebSocketMessageListener<T> {
default WebSocketMsgType getDownLinkType() {
return null;
}
default WebSocketMsgType getUpLinkType() {
return null;
}
default Class<T> target() {
return null;
}
default void onMsgReceived(T obj) {
}
default void onError(String errorMsg) {
}
}

View File

@@ -0,0 +1,24 @@
package com.mogo.realtime.connect;
public enum WebSocketMsgType {
MSG_TYPE_UPLINK_CAR_DATA(0,"自车与ADAS数据"),
MSG_TYPE_DOWNLINK_CAR_DATA(1,"服务端下发车辆信息"),
MSG_TYPE_ACK(3, "ACK");
private int msgType;
private String msg;
WebSocketMsgType(int msgType, String msg) {
this.msgType = msgType;
this.msg = msg;
}
public int getMsgType() {
return msgType;
}
public void setMsgType(int msgType) {
this.msgType = msgType;
}
}

View File

@@ -5,6 +5,9 @@ import android.util.Log;
import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.realtime.Interface.RealTimeApisHandler;
import com.mogo.realtime.connect.IMogoOnMessageListener;
import com.mogo.realtime.connect.IMogoOnWebSocketMessageListener;
import com.mogo.realtime.connect.WebSocketMsgType;
import com.mogo.realtime.entity.ADASRecognizedResult;
import com.mogo.realtime.entity.CloudLocationInfo;
import com.mogo.realtime.location.LocationResult;
@@ -105,11 +108,7 @@ public class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener
return;
}
//备注
/*
等钟超SocketManagerSDK
*
MarkerServiceHandler.getApis().getWebSocketManagerApi( mContext ).sendMsg( content, new IMogoOnWebSocketMessageListener() {
RealTimeApisHandler.getInstance().getApis().getRecognizedResultManager().sendMsg(content, new IMogoOnWebSocketMessageListener() {
@Override
public WebSocketMsgType getDownLinkType() {
return null;
@@ -117,10 +116,9 @@ public class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener
@Override
public WebSocketMsgType getUpLinkType() {
return WebSocketMsgType.MSG_TYPE_UPLINK_CAR_DATA;
return null;
}
} );
});
*/
}
}