diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 4ff10f68a5..83405b8de1 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -91,7 +91,6 @@
-
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java
index fd8276d2da..baa8ddec73 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java
@@ -99,9 +99,9 @@ public class MogoServiceProvider implements IMogoModuleProvider {
public void init( Context context ) {
Logger.d( TAG, "init" );
MarkerServiceHandler.init( context );
- if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {
- MogoRTKLocation.getInstance().init();
- }
+// if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {
+// }
+ MogoRTKLocation.getInstance().init();
MogoServices.getInstance().preInit( context );
MogoServices.getInstance().init( AbsMogoApplication.getApp() );
UiThreadHandler.postDelayed( () -> {
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java
index 6438bf0b5a..98272ec65f 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java
@@ -47,7 +47,7 @@ import com.mogo.module.service.refresh.CustomRefreshStrategy;
import com.mogo.module.service.refresh.RefreshObject;
import com.mogo.module.service.strategy.CarIconDisplayStrategy;
import com.mogo.module.service.ttsConfig.TtsConfigModleData;
-import com.mogo.module.service.uploadintime.SnapshotUploadInTime;
+import com.mogo.module.service.uploadintime.SnapshotLocationController;
import com.mogo.realtime.api.MoGoAiCloudRealTime;
import com.mogo.service.adas.IMogoADASController;
import com.mogo.service.adas.IMogoAdasCarDataCallback;
@@ -982,7 +982,7 @@ public class MogoServices implements IMogoMapListener,
e.printStackTrace();
}
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( data );
- SnapshotUploadInTime.getInstance().syncAdasLocationInfo( data );
+ SnapshotLocationController.getInstance().syncAdasLocationInfo( data );
} catch ( Exception e ) {
e.printStackTrace();
}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/ADASStatusIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/ADASStatusIntentHandler.java
index 6d335d0afd..08feacc8f9 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/ADASStatusIntentHandler.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/ADASStatusIntentHandler.java
@@ -8,7 +8,7 @@ import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.service.carinfo.CarStateInfo;
import com.mogo.module.service.receiver.MogoReceiver;
-import com.mogo.module.service.uploadintime.SnapshotUploadInTime;
+import com.mogo.module.service.uploadintime.SnapshotLocationController;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
@@ -73,7 +73,7 @@ class ADASStatusIntentHandler implements IntentHandler {
data.putOpt( "acceleration", stateInfo.getValues().getAcceleration() );
data.putOpt( "yawRate", stateInfo.getValues().getYaw_rate() );
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( data );
- SnapshotUploadInTime.getInstance().syncAdasLocationInfo( data );
+ SnapshotLocationController.getInstance().syncAdasLocationInfo( data );
} catch ( Exception e ) {
e.printStackTrace();
}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java
index afdf3b93a1..3bbe6d2ed6 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java
@@ -1,37 +1,21 @@
package com.mogo.module.service.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;
import android.location.LocationManager;
import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
import com.mogo.commons.AbsMogoApplication;
-import com.mogo.commons.debug.DebugConfig;
-import com.mogo.module.service.uploadintime.SnapshotUploadInTime;
+import com.mogo.module.service.uploadintime.SnapshotLocationController;
import com.mogo.realtime.entity.CloudLocationInfo;
-import com.mogo.utils.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
-import java.util.ArrayList;
-import java.util.List;
-
public class MogoRTKLocation {
private static final String TAG = "MogoRTKLocation";
- private static final int MSG_DATA_CHANGED = 0x100;
- private static final long MSG_DATA_INTERNAL = 500L;
-
- private Handler mHandler;
private LocationManager locationManager;
- private RTKLocationListener rtkLocationListener;
- private List cacheList = new ArrayList<>();
public static MogoRTKLocation getInstance() {
return RTKHolder.rtkLoc;
@@ -42,151 +26,79 @@ public class MogoRTKLocation {
}
private MogoRTKLocation() {
- mHandler = new Handler(WorkThreadHandler.newInstance( TAG ).getLooper() ) {
- @Override
- public void handleMessage(Message msg) {
- super.handleMessage(msg);
- if (msg.what == MSG_DATA_CHANGED) {
- mHandler.sendEmptyMessageDelayed(MSG_DATA_CHANGED, uploadDelay);
- sendLocationData();
-
-// Logger.d(TAG,"handleMessage开始发送消息");
- }
- }
- };
- mHandler.sendEmptyMessage(MSG_DATA_CHANGED);
- Logger.d(TAG,"构造方法开始发送消息");
- }
-
- public interface RTKLocationListener {
- void onLocationChanged(int dataAccuracy, List cloudLocationInfos);
- }
-
- private void sendLocationData() {
-
- List list = null;
- int dataAccuracy = 0;
- if ( DebugConfig.isUseAdasRtkLocationInfo() ) {
- dataAccuracy = 1;
- list = new ArrayList<>(SnapshotUploadInTime.getInstance().getSendLocationData());
- }
- if ( list == null || list.isEmpty() ) {
- dataAccuracy = 0;
- list = new ArrayList<>(cacheList);
- }
- if (cacheList != null && cacheList.size() > 0) {
- cacheList.clear();
- }
- if (rtkLocationListener != null) {
- rtkLocationListener.onLocationChanged(dataAccuracy, list);
- }
- }
-
- public void registerRTKLocationListener(RTKLocationListener locationListener) {
- rtkLocationListener = locationListener;
- }
-
- public void unregisterRTKLocationListener(){
- rtkLocationListener = null;
}
public void init() {
- locationManager = (LocationManager) AbsMogoApplication.getApp().getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
- String provider = locationManager.getBestProvider(getCriteria(), true);
- Logger.d(TAG, "init provider : " + provider);
- if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
+ locationManager = ( LocationManager ) AbsMogoApplication.getApp().getApplicationContext().getSystemService( Context.LOCATION_SERVICE );
+ String provider = locationManager.getBestProvider( getCriteria(), true );
+ Logger.d( TAG, "init provider : " + provider );
+ if ( locationManager.isProviderEnabled( LocationManager.GPS_PROVIDER ) ) {
try {
- locationManager.requestLocationUpdates(provider, 0, 0, locationListener);
- Location location = locationManager.getLastKnownLocation(provider);
- if (location != null) {
- Logger.i(TAG, "location : " + location.toString());
+ locationManager.requestLocationUpdates( provider, 0, 0, locationListener );
+ Location location = locationManager.getLastKnownLocation( provider );
+ if ( location != null ) {
+ Logger.i( TAG, "location : " + location.toString() );
}
- } catch (Exception e) {
+ } catch ( Exception e ) {
e.printStackTrace();
- Logger.d(TAG, "RTK LocationManager requestLocationUpdates has Exception : " + e.getMessage());
+ Logger.d( TAG, "RTK LocationManager requestLocationUpdates has Exception : " + e.getMessage() );
}
} else {
- Logger.d(TAG, "RTK LocationManager Provider GPS_PROVIDER unable");
+ Logger.d( TAG, "RTK LocationManager Provider GPS_PROVIDER unable" );
}
-
- // 注册修改上报间隔的广播, 临时使用,后面可直接干掉,发送广播的地方在EntranceFragment
- IntentFilter filter = new IntentFilter("com.mogo.launcher.action.FIX_UPLOAT_DELAY");
- AbsMogoApplication.getApp().registerReceiver(fixUploadDelayReceiver, filter);
}
private Criteria getCriteria() {
Criteria criteria = new Criteria();
- criteria.setAccuracy(Criteria.ACCURACY_FINE); //高精
- criteria.setAltitudeRequired(false);
- criteria.setBearingRequired(true);
- criteria.setSpeedRequired(true);
- criteria.setPowerRequirement(Criteria.POWER_LOW);
+ criteria.setAccuracy( Criteria.ACCURACY_FINE ); //高精
+ criteria.setAltitudeRequired( false );
+ criteria.setBearingRequired( true );
+ criteria.setSpeedRequired( true );
+ criteria.setPowerRequirement( Criteria.POWER_LOW );
return criteria;
}
private LocationListener locationListener = new LocationListener() {
@Override
- public void onLocationChanged(Location location) {
- if (location != null) {
+ public void onLocationChanged( Location location ) {
+ if ( location != null ) {
CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
- cloudLocationInfo.setAlt(location.getAltitude());
- cloudLocationInfo.setHeading(location.getBearing());
- cloudLocationInfo.setLat(location.getLatitude());
- cloudLocationInfo.setLon(location.getLongitude());
- cloudLocationInfo.setSpeed(location.getSpeed());
- cloudLocationInfo.setSatelliteTime(location.getTime());
- cloudLocationInfo.setSystemTime(System.currentTimeMillis());
+ cloudLocationInfo.setAlt( location.getAltitude() );
+ cloudLocationInfo.setHeading( location.getBearing() );
+ cloudLocationInfo.setLat( location.getLatitude() );
+ cloudLocationInfo.setLon( location.getLongitude() );
+ cloudLocationInfo.setSpeed( location.getSpeed() );
+ cloudLocationInfo.setSatelliteTime( location.getTime() );
+ cloudLocationInfo.setSystemTime( System.currentTimeMillis() );
cloudLocationInfo.convertCoor2GCJ02();
- cacheList.add(cloudLocationInfo);
+ SnapshotLocationController.getInstance().syncLocationInfo( cloudLocationInfo );
} else {
- Logger.e(TAG, "location == null");
+ Logger.e( TAG, "location == null" );
}
}
@Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- Logger.d(TAG, "onStatusChanged status: " + status);
+ public void onStatusChanged( String provider, int status, Bundle extras ) {
+ Logger.d( TAG, "onStatusChanged status: " + status );
}
@Override
- public void onProviderEnabled(String provider) {
- Logger.d(TAG, "onProviderEnabled");
+ public void onProviderEnabled( String provider ) {
+ Logger.d( TAG, "onProviderEnabled" );
}
@Override
- public void onProviderDisabled(String provider) {
- Logger.d(TAG, "onProviderEnabled");
+ public void onProviderDisabled( String provider ) {
+ Logger.d( TAG, "onProviderEnabled" );
}
};
public void stop() {
- Logger.d(TAG, "stop RTK Location");
- if (locationManager != null && locationListener != null) {
- locationManager.removeUpdates(locationListener);
+ Logger.d( TAG, "stop RTK Location" );
+ if ( locationManager != null && locationListener != null ) {
+ locationManager.removeUpdates( locationListener );
} else {
- Logger.d(TAG, "stop failed , reason : loc" + locationManager + " , or loc listener: " + locationListener + " is null");
- }
- }
-
- private long uploadDelay = MSG_DATA_INTERNAL;
-
- private FixUploadDelayReceiver fixUploadDelayReceiver = new FixUploadDelayReceiver();
-
- private class FixUploadDelayReceiver extends BroadcastReceiver{
- @Override
- public void onReceive(Context context, Intent intent) {
- uploadDelay = intent.getIntExtra("fixTime", 0);
- }
- }
-
- /**
- * 默认保持{@link #uploadDelay}间隔进行位置上报,如遇服务端控制,进行上报间隔修改
- * @param delay 上报间隔
- */
- public void resetUploadDelay(long delay) {
- if (mHandler != null && mHandler.hasMessages(MSG_DATA_CHANGED)) {
- mHandler.removeMessages(MSG_DATA_CHANGED);
- mHandler.sendEmptyMessageDelayed(MSG_DATA_CHANGED, delay);
+ Logger.d( TAG, "stop failed , reason : loc" + locationManager + " , or loc listener: " + locationListener + " is null" );
}
}
}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/spi/SPIRealTimeUpload.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/spi/SPIRealTimeUpload.java
index 6d8be6e2fa..94150778a4 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/spi/SPIRealTimeUpload.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/spi/SPIRealTimeUpload.java
@@ -1,7 +1,7 @@
package com.mogo.module.service.spi;
import com.elegant.spi.annotations.Service;
-import com.mogo.module.service.MarkerServiceHandler;
+import com.mogo.module.service.uploadintime.SnapshotLocationController;
import com.mogo.realtime.api.IRealTimeProvider;
import com.mogo.realtime.entity.ADASRecognizedResult;
import com.mogo.realtime.entity.CloudLocationInfo;
@@ -20,6 +20,6 @@ public class SPIRealTimeUpload implements IRealTimeProvider {
@Override
public List getLocationMsg() {
- return null;
+ return SnapshotLocationController.getInstance().getSendLocationData();
}
}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/strategy/MogoRefreshStrategyController.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/strategy/MogoRefreshStrategyController.java
index cf1fd09e11..505564565c 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/strategy/MogoRefreshStrategyController.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/strategy/MogoRefreshStrategyController.java
@@ -38,7 +38,7 @@ public class MogoRefreshStrategyController implements IMogoRefreshStrategyContro
@Override
public void resetLocationUpDelay(long delay) {
- MogoRTKLocation.getInstance().resetUploadDelay(delay);
+// MogoRTKLocation.getInstance().resetUploadDelay(delay);
}
@Override
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/uploadintime/SnapshotLocationController.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/uploadintime/SnapshotLocationController.java
new file mode 100644
index 0000000000..6963a99047
--- /dev/null
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/uploadintime/SnapshotLocationController.java
@@ -0,0 +1,123 @@
+package com.mogo.module.service.uploadintime;
+
+import com.mogo.realtime.entity.CloudLocationInfo;
+import com.mogo.utils.logger.Logger;
+
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public
+/**
+ * @author congtaowang
+ * @since 2020/12/14
+ *
+ * 实时坐标
+ */
+class SnapshotLocationController {
+
+ private static final String TAG = "SnapshotLocationController";
+
+ private static volatile SnapshotLocationController sInstance;
+
+ private SnapshotLocationController() {
+ }
+
+ public static SnapshotLocationController getInstance() {
+ if ( sInstance == null ) {
+ synchronized ( SnapshotLocationController.class ) {
+ if ( sInstance == null ) {
+ sInstance = new SnapshotLocationController();
+ }
+ }
+ }
+ return sInstance;
+ }
+
+ public synchronized void release() {
+ sInstance = null;
+ }
+
+ private Object readResolve() {
+ // 阻止反序列化,必须实现 Serializable 接口
+ return sInstance;
+ }
+
+ private List< CloudLocationInfo > mLocationList = new ArrayList<>();
+
+ /**
+ * 同步从定位来的数据(也可能是rtk)
+ *
+ * @param cli
+ */
+ public void syncLocationInfo( CloudLocationInfo cli ) {
+ if ( cli == null ) {
+ return;
+ }
+ mLocationList.add( cli );
+ }
+
+ // adda 工控机数据缓存
+ private List< CloudLocationInfo > mMachineCacheList = new ArrayList<>();
+
+ /**
+ * 同步从工控机来的数据
+ *
+ * @param data
+ */
+ public void syncAdasLocationInfo( JSONObject data ) {
+ if ( data == null ) {
+ return;
+ }
+ Logger.d( TAG, "同步到rtk数据" );
+ double lon = data.optDouble( "lon", -1 );
+ double lat = data.optDouble( "lat", -1 );
+ double alt = data.optDouble( "alt", -1 );
+ double heading = data.optDouble( "heading", -1 );
+ double acceleration = data.optDouble( "acceleration", -1 );
+ double yawRate = data.optDouble( "yawRate", -1 );
+ double speed = data.optDouble( "speed", -1 );
+ long satelliteTime = 0L;
+ try {
+ satelliteTime = Long.valueOf( data.optString( "satelliteTime" ) );
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ }
+
+ CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
+ cloudLocationInfo.setAlt( alt );
+ cloudLocationInfo.setHeading( heading );
+ cloudLocationInfo.setLat( lat );
+ cloudLocationInfo.setLon( lon );
+ cloudLocationInfo.setSpeed( speed );
+ cloudLocationInfo.setSatelliteTime( satelliteTime );
+ cloudLocationInfo.setSystemTime( System.currentTimeMillis() );
+ cloudLocationInfo.convertCoor2GCJ02();
+ mMachineCacheList.add( cloudLocationInfo );
+ }
+
+ /**
+ * 获取某一段时间内的坐标集合
+ *
+ * @return
+ */
+ public List< CloudLocationInfo > getSendLocationData() {
+
+ List< CloudLocationInfo > list = null;
+ int dataAccuracy = 0;
+ if ( mMachineCacheList != null ) {
+ dataAccuracy = 1;
+ list = new ArrayList<>( mMachineCacheList );
+ mMachineCacheList.clear();
+ }
+ if ( list == null || list.isEmpty() ) {
+ dataAccuracy = 0;
+ if ( mLocationList != null ) {
+ list = new ArrayList<>( mLocationList );
+ mLocationList.clear();
+ }
+ }
+ return list;
+ }
+}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/uploadintime/SnapshotUploadInTime.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/uploadintime/SnapshotUploadInTime.java
deleted file mode 100644
index b24e2d4111..0000000000
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/uploadintime/SnapshotUploadInTime.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package com.mogo.module.service.uploadintime;
-
-import android.content.Context;
-
-import com.mogo.commons.utils.MortonCode;
-import com.mogo.module.service.MarkerServiceHandler;
-import com.mogo.module.service.location.MogoRTKLocation;
-import com.mogo.module.service.utils.SimpleLocationCorrectStrategy;
-import com.mogo.module.service.websocket.LocationResult;
-import com.mogo.module.service.websocket.OnePerSecondSendContent;
-import com.mogo.realtime.entity.CloudLocationInfo;
-import com.mogo.service.adas.entity.ADASRecognizedResult;
-import com.mogo.service.connection.IMogoOnWebSocketMessageListener;
-import com.mogo.service.connection.WebSocketMsgType;
-import com.mogo.utils.logger.Logger;
-
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public
-/*
- * @author congtaowang
- * @since 2020/12/14
- *
- * 实时上报坐标、识别物体
- */
-class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener {
-
- private static final String TAG = "SnapshotUploadInTime";
-
- private static volatile SnapshotUploadInTime sInstance;
- private Context mContext;
-
- private SnapshotUploadInTime() {
- }
-
- public static SnapshotUploadInTime getInstance() {
- if ( sInstance == null ) {
- synchronized ( SnapshotUploadInTime.class ) {
- if ( sInstance == null ) {
- sInstance = new SnapshotUploadInTime();
- }
- }
- }
- return sInstance;
- }
-
- public synchronized void release() {
- sInstance = null;
- }
-
- private Object readResolve() {
- // 阻止反序列化,必须实现 Serializable 接口
- return sInstance;
- }
-
- public void start( Context context ) {
- mContext = context.getApplicationContext();
- MogoRTKLocation.getInstance().registerRTKLocationListener( this );
- }
-
- public void stop() {
- MogoRTKLocation.getInstance().unregisterRTKLocationListener();
- MogoRTKLocation.getInstance().stop();
- }
-
- @Override
- public void onLocationChanged( int dataAccuracy, List cloudLocationInfos ) {
- startSendCarLocationAndAdasRecognizedResult2Server( dataAccuracy, cloudLocationInfos );
- }
-
- private CloudLocationInfo mLastInfo;
-
- private void startSendCarLocationAndAdasRecognizedResult2Server( int dataAccuracy, List< CloudLocationInfo > cloudLocationInfo ) {
- CloudLocationInfo lastInfo = null;
- // 如果数组内容不为空,就用数组最后一个值
- if ( cloudLocationInfo != null && !cloudLocationInfo.isEmpty() ) {
- lastInfo = cloudLocationInfo.get( cloudLocationInfo.size() - 1 );
- mLastInfo = lastInfo;
- }
- if ( lastInfo == null ) {
- lastInfo = mLastInfo;
- }
- LocationResult locationResult = null;
- if ( lastInfo != null ) {
- // 定位点预测纠偏
- lastInfo = SimpleLocationCorrectStrategy.getInstance().correct( lastInfo );
- locationResult = new LocationResult();
- locationResult.dataAccuracy = dataAccuracy;
- if ( lastInfo != null ) {
- locationResult.lastCoordinate = lastInfo;
- locationResult.mortonCode = MortonCode.wrapEncodeMorton( lastInfo.getLon(), lastInfo.getLat() );
- }
- locationResult.coordinates = new ArrayList<>();
- locationResult.sn = com.mogo.commons.network.Utils.getSn();
- if ( cloudLocationInfo == null || cloudLocationInfo.isEmpty() ) {
- locationResult.coordinates.addAll( new ArrayList<>() );
- } else {
- locationResult.coordinates.addAll( cloudLocationInfo );
- }
- }
- List< ADASRecognizedResult > recognizedResults = MarkerServiceHandler.getADASController().getLastADASRecognizedResult();
- Logger.d( TAG, "发送的adas识别数量 = %s", recognizedResults == null ? 0 : recognizedResults.size() );
- OnePerSecondSendContent content = new OnePerSecondSendContent();
- content.self = locationResult;
- content.adas = recognizedResults;
-
- if ( content.self == null &&
- ( content.adas == null || content.adas.isEmpty() ) ) {
- Logger.d( TAG, "no information 2 sent" );
- return;
- }
-
-
- MarkerServiceHandler.getApis().getWebSocketManagerApi( mContext ).sendMsg( content, new IMogoOnWebSocketMessageListener() {
- @Override
- public WebSocketMsgType getDownLinkType() {
- return null;
- }
-
- @Override
- public WebSocketMsgType getUpLinkType() {
- return WebSocketMsgType.MSG_TYPE_UPLINK_CAR_DATA;
- }
- } );
- }
-
- // adda 工控机数据缓存
- private List< CloudLocationInfo > cacheList = new ArrayList<>();
-
- public void syncAdasLocationInfo( JSONObject data ) {
- if ( data == null ) {
- return;
- }
- Logger.d( TAG, "同步到rtk数据" );
- double lon = data.optDouble( "lon", -1 );
- double lat = data.optDouble( "lat", -1 );
- double alt = data.optDouble( "alt", -1 );
- double heading = data.optDouble( "heading", -1 );
- double acceleration = data.optDouble( "acceleration", -1 );
- double yawRate = data.optDouble( "yawRate", -1 );
- double speed = data.optDouble( "speed", -1 );
- long satelliteTime = 0L;
- try {
- satelliteTime = Long.valueOf( data.optString( "satelliteTime" ) );
- } catch ( Exception e ) {
- e.printStackTrace();
- }
-
- CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
- cloudLocationInfo.setAlt( alt );
- cloudLocationInfo.setHeading( heading );
- cloudLocationInfo.setLat( lat );
- cloudLocationInfo.setLon( lon );
- cloudLocationInfo.setSpeed( speed );
- cloudLocationInfo.setSatelliteTime( satelliteTime );
- cloudLocationInfo.setSystemTime( System.currentTimeMillis() );
- cloudLocationInfo.convertCoor2GCJ02();
- cacheList.add( cloudLocationInfo );
- }
-
- public List< CloudLocationInfo > getSendLocationData() {
- List< CloudLocationInfo > list = new ArrayList<>( cacheList );
- if ( cacheList != null && cacheList.size() > 0 ) {
- cacheList.clear();
- }
- return list;
- }
-}