extends realTimeProvider

This commit is contained in:
zhongchao
2021-02-23 17:56:23 +08:00
parent 03e8c6cf3f
commit 3cedba9649
4 changed files with 22 additions and 10 deletions

View File

@@ -46,4 +46,9 @@ class SPIRealTimeTestClass implements IRealTimeProvider {
list.add(info);
return list;
}
@Override
public int getLocationAccuracy() {
return 0;
}
}

View File

@@ -16,8 +16,13 @@ public interface IRealTimeProvider {
List<ADASRecognizedResult> getLastADASRecognizedResult();
/**
* 发送息,由外部传入
* 发送自车定位信息,由外部传入
*/
List<CloudLocationInfo> getLocationMsg();
/**
* 自车定位信息 精度
* @see com.mogo.realtime.entity.LocationResult dataAccuracy 字段
*/
int getLocationAccuracy();
}

View File

@@ -154,15 +154,8 @@ public class SocketHandler {
}
locationResult.coordinates = new ArrayList<>();
locationResult.sn = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn();
boolean isAccuracyDevice = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getIsAccuracyDevice();
locationResult.coordinates.addAll(cloudLocationInfo);
if (isAccuracyDevice) {
if (cloudLocationInfo.size() > 2) {
locationResult.dataAccuracy = 1;
} else {
Logger.w(TAG, "MoGoAiCloudClient setAccuracyDevice is true , but the amount of data does not meet the requirements");
}
}
locationResult.dataAccuracy = RealTimeProviderImp.getInstance().getLocationAccuracy();//SPI接口返回
}
List<ADASRecognizedResult> recognizedResults = RealTimeProviderImp.getInstance().getLastADASRecognizedResult();//SPI接口返回
OnePerSecondSendContent content = new OnePerSecondSendContent();
@@ -182,8 +175,9 @@ public class SocketHandler {
webSocketData.setData(GsonUtil.jsonFromObject(content));
String msg = GsonUtil.jsonFromObject(webSocketData);
boolean isAccuracyDevice = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getIsAccuracyDevice();
int msgType = LOW_FREQUENCY_CHANNEL_ID;
if (cloudLocationInfo.size() > 2) {
if (isAccuracyDevice && cloudLocationInfo.size() > 2) {
msgType = HIGH_FREQUENCY_CHANNEL_ID;
}
MsgBody msgBody = new MsgBody();

View File

@@ -45,4 +45,12 @@ public class RealTimeProviderImp implements IRealTimeProvider {
return null;
}
@Override
public int getLocationAccuracy() {
if (mDelegate != null) {
return mDelegate.getLocationAccuracy();
}
return 0;
}
}