change upload of socket unc
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -20,6 +20,7 @@
|
||||
<option value="$PROJECT_DIR$/modules" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-realtime" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-tanlu" />
|
||||
<option value="$PROJECT_DIR$/modules/realtime" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
|
||||
@@ -10,7 +10,6 @@ android {
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
@@ -28,10 +27,7 @@ android {
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation project(path: ':foudations:mogo-passport')
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(":foudations:mogo-socket")
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.mogo.realtime;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.mogo.realtime.test", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,11 @@ package com.mogo.realtime.Imp;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
|
||||
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;
|
||||
import com.mogo.realtime.location.MogoRTKLocation;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
@@ -46,14 +40,14 @@ public class RealTimeProviderImp implements RealTimeProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerOnMessageListener(int msgType, IMogoOnMessageListener listener) {
|
||||
public void registerOnMessageListener(int msgType, IMogoCloudSocketOnMessageListener listener) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.registerOnMessageListener(msgType, listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg(Object body, IMogoOnWebSocketMessageListener listener) {
|
||||
public void sendMsg(Object body, IMogoCloudSocketOnMessageListener listener) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.sendMsg(body, listener);
|
||||
}
|
||||
|
||||
@@ -2,13 +2,10 @@ 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.cloud.socket.IMogoCloudSocketOnMessageListener;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
@@ -42,7 +39,7 @@ public interface RealTimeProvider<T> {
|
||||
* @param msgType 消息类型
|
||||
* @param listener 回调
|
||||
*/
|
||||
void registerOnMessageListener(int msgType, IMogoOnMessageListener listener);
|
||||
void registerOnMessageListener(int msgType, IMogoCloudSocketOnMessageListener listener);
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
@@ -50,5 +47,5 @@ public interface RealTimeProvider<T> {
|
||||
* @param body 消息体
|
||||
* @param listener 回执监听
|
||||
*/
|
||||
void sendMsg(T body, IMogoOnWebSocketMessageListener listener );
|
||||
void sendMsg(T body, IMogoCloudSocketOnMessageListener listener );
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.realtime.connect;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-31
|
||||
* <p>
|
||||
* 消息回调
|
||||
*/
|
||||
public interface IMogoOnMessageListener< T > {
|
||||
|
||||
Class< T > target();
|
||||
|
||||
void onMsgReceived(T obj);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.mogo.realtime.connect;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-31
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MsgBody {
|
||||
|
||||
/**
|
||||
* 消息类型
|
||||
*/
|
||||
private int mMsgType;
|
||||
|
||||
// /**
|
||||
// * 服务端分发,业务线
|
||||
// */
|
||||
// private int mProductLine = MogoCommon.Product.mogoBussiness_VALUE;
|
||||
//
|
||||
// /**
|
||||
// *
|
||||
// */
|
||||
// private int mHeaderType = MogoConnsvr.MsgType.mogoMsgTypeDispatchSvrNoRspReq_VALUE;
|
||||
|
||||
/**
|
||||
* 是否回执
|
||||
*/
|
||||
private boolean mAck = false;
|
||||
|
||||
/**
|
||||
* 消息ID
|
||||
*/
|
||||
private final long mMsgId = System.currentTimeMillis();
|
||||
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
private Object mContent;
|
||||
|
||||
public MsgBody msgType( int msgType ) {
|
||||
this.mMsgType = msgType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MsgBody ack( boolean ack ) {
|
||||
this.mAck = ack;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MsgBody content( Object object ) {
|
||||
this.mContent = object;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getMsgType() {
|
||||
return mMsgType;
|
||||
}
|
||||
|
||||
public boolean isAck() {
|
||||
return mAck;
|
||||
}
|
||||
|
||||
public long getMsgId() {
|
||||
return mMsgId;
|
||||
}
|
||||
|
||||
public Object getContent() {
|
||||
return mContent;
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,14 @@ import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.realtime.Interface.RealTimeApisHandler;
|
||||
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;
|
||||
import com.mogo.realtime.location.MogoRTKLocation;
|
||||
import com.mogo.realtime.entity.OnePerSecondSendContent;
|
||||
import com.mogo.realtime.util.MortonCode;
|
||||
import com.mogo.realtime.socket.OnePerSecondSendContent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -72,7 +71,7 @@ public class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener
|
||||
private void startSendCarLocationAndAdasRecognizedResult2Server(List<CloudLocationInfo> cloudLocationInfo) {
|
||||
CloudLocationInfo lastInfo = null;
|
||||
// 如果数组内容不为空,就用数组最后一个值
|
||||
if (cloudLocationInfo != null && !cloudLocationInfo.isEmpty()) {
|
||||
if (!cloudLocationInfo.isEmpty()) {
|
||||
lastInfo = cloudLocationInfo.get(cloudLocationInfo.size() - 1);
|
||||
mLastInfo = lastInfo;
|
||||
}
|
||||
@@ -88,13 +87,9 @@ public class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener
|
||||
locationResult.lastCoordinate = lastInfo;
|
||||
locationResult.mortonCode = MortonCode.wrapEncodeMorton(lastInfo.getLon(), lastInfo.getLat());
|
||||
}
|
||||
// locationResult.coordinates = new ArrayList<>();
|
||||
locationResult.coordinates = new ArrayList<>();
|
||||
locationResult.sn = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
|
||||
// if ( cloudLocationInfo == null ) {
|
||||
// locationResult.coordinates.addAll( new ArrayList<>() );
|
||||
// } else {
|
||||
// locationResult.coordinates.addAll( cloudLocationInfo );
|
||||
// }
|
||||
locationResult.coordinates.addAll(cloudLocationInfo);
|
||||
}
|
||||
List<ADASRecognizedResult> recognizedResults = RealTimeApisHandler.getInstance().getApis().getRecognizedResultManager().getLastADASRecognizedResult();//外显接口返回
|
||||
OnePerSecondSendContent content = new OnePerSecondSendContent();
|
||||
@@ -106,18 +101,7 @@ public class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener
|
||||
Log.d(TAG, "no information 2 sent");
|
||||
return;
|
||||
}
|
||||
|
||||
RealTimeApisHandler.getInstance().getApis().getRecognizedResultManager().sendMsg(content, new IMogoOnWebSocketMessageListener() {
|
||||
@Override
|
||||
public WebSocketMsgType getDownLinkType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebSocketMsgType getUpLinkType() {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
//todo 发送socket msg
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.mogo.realtime.socket;
|
||||
package com.mogo.realtime.entity;
|
||||
|
||||
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.realtime.socket;
|
||||
package com.mogo.realtime.entity;
|
||||
|
||||
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.location.LocationResult;
|
||||
|
||||
import java.util.List;
|
||||
@@ -3,7 +3,6 @@ package com.mogo.realtime.location;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.location.Criteria;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.realtime;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
include ':foudations:mogo-socket'
|
||||
include ':modules:mogo-realtime'
|
||||
include ':modules:realtime'
|
||||
include ':modules:mogo-cloud.realtime'
|
||||
include ':modules:cloud.realtime'
|
||||
include ':modules:mogo-tanlu'
|
||||
include ':foudations:mogo-commons'
|
||||
include ':foudations:mogo-httpdns'
|
||||
|
||||
Reference in New Issue
Block a user