add mock data upload

This commit is contained in:
zhongchao
2021-06-15 11:55:05 +08:00
parent 9b4277ec99
commit 38da4123f8
9 changed files with 28 additions and 34 deletions

2
.idea/misc.xml generated
View File

@@ -13,7 +13,7 @@
<option name="HEAP_SIZE" value="1024" />
<option name="LOCALE" value="zh_CN" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="12" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="12" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@@ -3,7 +3,6 @@
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />

View File

@@ -3,13 +3,16 @@ package com.mogo.cloud;
import android.support.annotation.Nullable;
import android.support.multidex.MultiDexApplication;
import android.util.Log;
import com.auto.zhidao.logsdk.CrashSystem;
import com.mogo.cloud.httpdns.MogoHttpDnsConfig;
import com.mogo.cloud.httpdns.bean.HttpDnsSimpleLocation;
import com.mogo.cloud.httpdns.listener.IHttpDnsCurrentLocation;
import com.mogo.cloud.passport.IMoGoTokenCallback;
import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.cloud.util.Devices;
import java.util.Random;
@@ -18,6 +21,7 @@ import java.util.Random;
*/
public class MoGoApplication extends MultiDexApplication {
private static final String TAG = "MoGoApplication";
@Override
public void onCreate() {
@@ -53,7 +57,7 @@ public class MoGoApplication extends MultiDexApplication {
// 设置AI云平台分配给三方应用的签名密钥需要从AI云平台申请
// 设置车机设备的唯一标识(这些表识必须是通过后台录入的设备)
// TODO 这里使用的是测试的sn
clientConfig.setThirdPartyDeviceId("1234567892");
clientConfig.setThirdPartyDeviceId("123123test123123");
// 设置应用服务AppId 长链、鉴权 //todo 需要卸载智慧驾驶、行车记录仪
clientConfig.setServiceAppId("com.mogo.launcher");
// 设置循环检测间隔时间
@@ -72,6 +76,5 @@ public class MoGoApplication extends MultiDexApplication {
// 初始化SDK可以设置状态回调来监听
MoGoAiCloudClient.getInstance().init(this, clientConfig);
}
}

View File

@@ -3,8 +3,6 @@ package com.mogo.cloud;
import com.elegant.spi.annotations.Service;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.realtime.api.IRealTimeProvider;
import com.mogo.realtime.entity.DataCollectMsgDataProto;
import com.mogo.realtime.entity.DataCollectWrapper;
import com.mogo.realtime.entity.SocketReceiveDataProto3;
import com.mogo.realtime.util.MortonCode;
@@ -20,7 +18,7 @@ import static com.mogo.cloud.socket.SocketMsgType.MSG_TYPE_UPLINK_CAR_DATA;
class SPIRealTimeTestClass implements IRealTimeProvider {
@Override
public DataCollectWrapper.DataCollectMsg getLocationMsg() {
public SocketReceiveDataProto3.SocketReceiveDataProto getLocationMsg() {
long mortonCode = MortonCode.encodeMorton(116.410871, 39.968309);
@@ -43,7 +41,7 @@ class SPIRealTimeTestClass implements IRealTimeProvider {
.setLastCoordinate(locationInfoProto)
.setDataAccuracy(1)
.setMortonCode(mortonCode)
.setFromType(1)
.setFromType(0)
.setSn(MoGoAiCloudClientConfig.getInstance().getSn())
.build();
@@ -51,15 +49,12 @@ class SPIRealTimeTestClass implements IRealTimeProvider {
SocketReceiveDataProto3.OnePerSecondSendReqProto.newBuilder()
.setSelf(myLocationReq)
.build();
return SocketReceiveDataProto3.SocketReceiveDataProto.newBuilder()
.setIPCSn(MoGoAiCloudClientConfig.getInstance().getSn() + "xavier")
.setSn(MoGoAiCloudClientConfig.getInstance().getSn())
.setData(self)
.setMsgType(MSG_TYPE_UPLINK_CAR_DATA.getMsgType())
.setSeq(System.currentTimeMillis()).build();
DataCollectMsgDataProto.DataCollectMsgData msgData =
DataCollectMsgDataProto.DataCollectMsgData.newBuilder()
.setPayload(self.toByteString())
.setMsgType(MSG_TYPE_UPLINK_CAR_DATA.getMsgType())
.build();
return DataCollectWrapper.DataCollectMsg.newBuilder()
.setData(msgData.toByteString())
.setTimestamp(System.currentTimeMillis()).build();
}
}

View File

@@ -108,10 +108,11 @@ public class SocketManager implements IMogoCloudSocketManager {
@Override
public void sendMsg(String appId, int headerType, MsgBody body, IMogoCloudSocketMsgAckListener listener) {
Logger.d(TAG, "sendMsg msgId : " + body.getMsgId());
final byte[] pb = convertToPBBytes(body.getMsgType(), body.getContent());
if (cloudClientConfig.isThirdLogin()) {
ThirdSocketManager.getInstance().sendMsg(appId, body.getContent(), headerType, true, body.getMsgId());
ThirdSocketManager.getInstance().sendMsg(appId, pb, headerType, true, body.getMsgId());
} else {
InternalSocketManager.getInstance().sendMsg(body.getContent(), headerType, true, body.getMsgId());
InternalSocketManager.getInstance().sendMsg(pb, headerType, true, body.getMsgId());
}
mAckListeners.put(body.getMsgId(), listener);
}

View File

@@ -15,6 +15,7 @@ import com.zhidao.socket.CallbackManager;
import com.zhidao.socket.SocketClient;
import com.zhidao.socket.SocketConfig;
import static com.mogo.cloud.socket.SocketServicesConstants.SOCKET_CHANNEL_ID;
import static com.mogo.cloud.socket.SocketServicesConstants.TAG;
import static com.mogo.cloud.socket.SocketServicesConstants.getEnvironment;
@@ -71,7 +72,7 @@ public class ThirdSocketManager implements Callback {
int headerType,
boolean ack,
long msgId) {
SocketClient.getInstance().sendData(appId, MogoCommon.Product.mogoBussiness.getNumber(), payload, headerType, ack, msgId);
SocketClient.getInstance().sendData(SOCKET_CHANNEL_ID, MogoCommon.Product.mogoBussiness.getNumber(), payload, headerType, ack, msgId);
}

View File

@@ -1,7 +1,6 @@
package com.mogo.realtime.api;
import com.mogo.realtime.entity.DataCollectWrapper;
import com.mogo.realtime.entity.SocketReceiveDataProto3;
/**
* 蘑菇AI云平台实时定位点上报服务接口
@@ -9,13 +8,8 @@ import com.mogo.realtime.entity.DataCollectWrapper;
public interface IRealTimeProvider {
/**
* 获取 adas 识别列表,由外部传入
* 发送消息,由外部传入
*/
// List<ADASRecognizedResult> getLastADASRecognizedResult(); // todo 数据实体替换成PB
/**
* 发送消息,由外部传入ø
*/
DataCollectWrapper.DataCollectMsg getLocationMsg(); // todo 数据实体替换成PB
SocketReceiveDataProto3.SocketReceiveDataProto getLocationMsg();
}

View File

@@ -4,7 +4,7 @@ import android.content.Context;
import com.mogo.cloud.socket.entity.MsgBody;
import com.mogo.realtime.constant.RealTimeConstant;
import com.mogo.realtime.entity.DataCollectWrapper;
import com.mogo.realtime.entity.SocketReceiveDataProto3;
import com.mogo.realtime.socket.SocketHandler;
import com.mogo.realtime.spi.RealTimeProviderImp;
@@ -57,12 +57,12 @@ public class SnapshotUploadInTime implements UploadInTimeHandler.IUploadInTimeLi
@Override
public void sendLocationData() {
DataCollectWrapper.DataCollectMsg dataCollectMsg =
SocketReceiveDataProto3.SocketReceiveDataProto socketReceiveDataProto =
RealTimeProviderImp.getInstance().getLocationMsg();//SPI接口返回
if (dataCollectMsg != null) {
if (socketReceiveDataProto != null) {
MsgBody msgBody = new MsgBody();
msgBody.msgType(RealTimeConstant.HIGH_FREQUENCY_CHANNEL_ID);
msgBody.content(dataCollectMsg.toByteArray());
msgBody.content(socketReceiveDataProto.toByteArray());
SocketHandler.getInstance().sendMsg(msgBody);
}
}

View File

@@ -2,6 +2,7 @@ package com.mogo.realtime.spi;
import com.mogo.realtime.api.IRealTimeProvider;
import com.mogo.realtime.entity.DataCollectWrapper;
import com.mogo.realtime.entity.SocketReceiveDataProto3;
import java.util.List;
@@ -29,7 +30,7 @@ public class RealTimeProviderImp implements IRealTimeProvider {
}
@Override
public DataCollectWrapper.DataCollectMsg getLocationMsg() {
public SocketReceiveDataProto3.SocketReceiveDataProto getLocationMsg() {
if (mDelegate != null) {
return mDelegate.getLocationMsg();
}