add new module trafficLive and rename class package
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package com.mogo.realtime.Interface;
|
||||
package com.mogo.realtime.api;
|
||||
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.realtime.Interface;
|
||||
package com.mogo.realtime.api;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.mogo.realtime.constant;
|
||||
|
||||
public class RealTimeConstant {
|
||||
|
||||
public static final String TAG = "MoGoAiCloudRealTime";
|
||||
}
|
||||
@@ -12,10 +12,9 @@ import com.mogo.realtime.socket.SocketHandler;
|
||||
*/
|
||||
public class SnapshotUploadInTime implements UploadInTimeHandler.IUploadInTimeListener {
|
||||
|
||||
private static final String TAG = "SnapshotUploadInTime";
|
||||
private static volatile SnapshotUploadInTime sInstance;
|
||||
//是否使用外部定位数据
|
||||
private boolean isUseExternalLocation = false;
|
||||
private final boolean isUseExternalLocation;
|
||||
|
||||
private SnapshotUploadInTime() {
|
||||
isUseExternalLocation = MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getIsUseExternalLocation();
|
||||
|
||||
@@ -7,12 +7,13 @@ import androidx.annotation.Keep;
|
||||
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
import static com.mogo.realtime.constant.RealTimeConstant.TAG;
|
||||
|
||||
/**
|
||||
* AI云 实时上报数据频率处理类
|
||||
*/
|
||||
public class UploadInTimeHandler {
|
||||
|
||||
private static final String TAG = "UploadInTimeHandler";
|
||||
private static final int MSG_DATA_CHANGED = 0x100;
|
||||
private static final long MSG_DATA_INTERNAL = 500L;
|
||||
private final long uploadDelay = MSG_DATA_INTERNAL;
|
||||
|
||||
@@ -14,15 +14,16 @@ import com.mogo.utils.logger.Logger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.realtime.constant.RealTimeConstant.TAG;
|
||||
|
||||
/**
|
||||
* AI云SDK内部定位服务
|
||||
*/
|
||||
public class MogoRTKLocation {
|
||||
|
||||
private static final String TAG = "MogoRTKLocation";
|
||||
|
||||
private LocationManager locationManager;
|
||||
private final List<CloudLocationInfo> cacheList = new ArrayList<>();
|
||||
private CloudLocationInfo locInfo;
|
||||
|
||||
public static MogoRTKLocation getInstance() {
|
||||
return RTKHolder.rtkLoc;
|
||||
@@ -38,7 +39,14 @@ public class MogoRTKLocation {
|
||||
|
||||
public List<CloudLocationInfo> sendLocationData() {
|
||||
List<CloudLocationInfo> list = new ArrayList<>(cacheList);
|
||||
if (cacheList != null && cacheList.size() > 0) {
|
||||
if (cacheList.size() == 0) {
|
||||
if (locInfo != null) {
|
||||
cacheList.add(locInfo);
|
||||
} else {
|
||||
Logger.e(TAG, "暂无定位数据");
|
||||
return list;
|
||||
}
|
||||
}else{
|
||||
cacheList.clear();
|
||||
}
|
||||
return list;
|
||||
@@ -78,7 +86,7 @@ public class MogoRTKLocation {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
private LocationListener locationListener = new LocationListener() {
|
||||
private final LocationListener locationListener = new LocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
if (location != null) {
|
||||
@@ -91,6 +99,7 @@ public class MogoRTKLocation {
|
||||
cloudLocationInfo.setSatelliteTime(location.getTime());
|
||||
cloudLocationInfo.setSystemTime(System.currentTimeMillis());
|
||||
cloudLocationInfo.convertCoor2GCJ02();
|
||||
locInfo = cloudLocationInfo;
|
||||
cacheList.add(cloudLocationInfo);
|
||||
} else {
|
||||
Logger.e(TAG, "location == null");
|
||||
|
||||
@@ -26,13 +26,13 @@ import java.util.List;
|
||||
import static com.mogo.cloud.socket.WebSocketMsgType.MSG_TYPE_ACK;
|
||||
import static com.mogo.cloud.socket.WebSocketMsgType.MSG_TYPE_DOWNLINK_CAR_DATA;
|
||||
import static com.mogo.cloud.socket.WebSocketMsgType.MSG_TYPE_UPLINK_CAR_DATA;
|
||||
import static com.mogo.realtime.constant.RealTimeConstant.TAG;
|
||||
|
||||
/**
|
||||
* Socket长链 业务服务处理类
|
||||
*/
|
||||
public class SocketHandler {
|
||||
|
||||
private static final String TAG = "SocketHandler";
|
||||
private static volatile SocketHandler mInstance;
|
||||
private static final int HEADER_TYPE = MogoConnsvr.MsgType.mogoMsgTypeCollectSvrNoRspReq.getNumber();
|
||||
private static final int HIGH_FREQUENCY_CHANNEL_ID = 0x040002; //高频数据
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.mogo.realtime.spi;
|
||||
|
||||
import com.elegant.spi.AbstractDelegateManager;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.realtime.Interface.IRealTimeProvider;
|
||||
import com.mogo.realtime.api.IRealTimeProvider;
|
||||
|
||||
/**
|
||||
* 提供RealTime SPI接口实例对象管理类
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.realtime.spi;
|
||||
|
||||
import com.mogo.realtime.Interface.IRealTimeProvider;
|
||||
import com.mogo.realtime.api.IRealTimeProvider;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.mogo.realtime.util;
|
||||
|
||||
import android.location.Location;
|
||||
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
|
||||
/**
|
||||
* 定位数据类型转换工具
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class LocationParseUtil {
|
||||
/**
|
||||
* 从Location 转 CloudLocationInfo
|
||||
*
|
||||
* @param info 待转数据
|
||||
* @return 转后数据
|
||||
*/
|
||||
public static CloudLocationInfo locationToCloudLocation(Location info) {
|
||||
if (info == null) {
|
||||
return null;
|
||||
}
|
||||
CloudLocationInfo cloud = new CloudLocationInfo();
|
||||
cloud.setLat(info.getLatitude());
|
||||
cloud.setLon(info.getLongitude());
|
||||
cloud.setAlt(info.getAltitude());
|
||||
cloud.setHeading(info.getBearing());
|
||||
cloud.setSpeed(info.getSpeed());
|
||||
cloud.setSatelliteTime(info.getTime());
|
||||
cloud.setSystemTime(System.currentTimeMillis());
|
||||
return cloud;
|
||||
}
|
||||
|
||||
public static MogoLatLng cloudLocationToMogoLatLng(CloudLocationInfo info) {
|
||||
if (info == null) {
|
||||
return null;
|
||||
}
|
||||
return new MogoLatLng(info.getLat(), info.getLon());
|
||||
}
|
||||
}
|
||||
@@ -33,9 +33,9 @@ public class MortonCode {
|
||||
private static final double RULE_MORTON_TO_LONLAT = 360.0 / Math.pow( 2, 32 );
|
||||
|
||||
/**
|
||||
* @param lon
|
||||
* @param lat
|
||||
* @return
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @return long 莫顿码
|
||||
*/
|
||||
public static long wrapEncodeMorton( Double lon, Double lat ) {
|
||||
DecimalFormat decimalFormat = new DecimalFormat( "#.######" );
|
||||
@@ -46,13 +46,13 @@ public class MortonCode {
|
||||
/**
|
||||
* 编码 morton code
|
||||
*
|
||||
* @param lon
|
||||
* @param lat
|
||||
* @return
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @return long 莫顿码
|
||||
*/
|
||||
public static long encodeMorton( Double lon, Double lat ) {
|
||||
|
||||
Long bit = 1L;
|
||||
long bit = 1L;
|
||||
long mortonCode = 0L;
|
||||
long x = ( long ) ( lon * RULE_MORTON );
|
||||
long y = ( long ) ( lat * RULE_MORTON );
|
||||
@@ -78,8 +78,8 @@ public class MortonCode {
|
||||
/**
|
||||
* 将莫顿码解码为坐标
|
||||
*
|
||||
* @param mortonCode
|
||||
* @return
|
||||
* @param mortonCode 莫顿码
|
||||
* @return 坐标
|
||||
*/
|
||||
public static double[] decodeMorton( long mortonCode ) {
|
||||
long[] midPoint = mortonCodeToCoord( mortonCode );
|
||||
@@ -95,8 +95,8 @@ public class MortonCode {
|
||||
/**
|
||||
* 莫顿码分别拆解为 编码后的经纬度长整数
|
||||
*
|
||||
* @param mortonCode
|
||||
* @return
|
||||
* @param mortonCode 莫顿码
|
||||
* @return 经纬度 长整数
|
||||
*/
|
||||
private static long[] mortonCodeToCoord( long mortonCode ) {
|
||||
long bit = 1L;
|
||||
@@ -114,7 +114,7 @@ public class MortonCode {
|
||||
/**
|
||||
* 对编码后的经纬度长整数进行解码
|
||||
*
|
||||
* @param midPoint
|
||||
* @param midPoint 经纬度 长整数
|
||||
*/
|
||||
private static void normalizeCoord( long[] midPoint ) {
|
||||
// if x > 180 degrees, then subtract 360 degrees
|
||||
@@ -136,7 +136,6 @@ public class MortonCode {
|
||||
midPoint[1] +=
|
||||
NDS_180_DEGREES + 1; // add 1 because 0 must be counted as well
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user