Merge remote-tracking branch 'origin/demo/shunyi_vr_map' into demo/shunyi_vr_map
This commit is contained in:
@@ -43,6 +43,7 @@ import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.service.autopilot.AutoPilotRemoteController;
|
||||
import com.mogo.module.service.intent.IntentHandlerFactory;
|
||||
import com.mogo.module.service.launchercard.LauncherCardRefresher;
|
||||
import com.mogo.module.service.location.MogoRTKLocation;
|
||||
import com.mogo.module.service.marker.MapMarkerManager;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
@@ -445,8 +446,10 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
|
||||
AutoPilotRemoteController.getInstance().start();
|
||||
|
||||
mThreadHandler.sendEmptyMessageDelayed( ServiceConst.MSG_SEND_CAR_LOCATION_AND_ADAS_RECOGNIZED_RESULT_2_SERVER, 0 );
|
||||
MogoRTKLocation.getInstance().registerRTKLocationListener( cloudLocationInfos -> {
|
||||
Logger.i(TAG,"cloudLocationInfos size : " + cloudLocationInfos.size());
|
||||
startSendCarLocationAndAdasRecognizedResult2Server(cloudLocationInfos);
|
||||
});
|
||||
}
|
||||
|
||||
private void initLocationServiceProcess( Context context ) {
|
||||
@@ -461,7 +464,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
}
|
||||
|
||||
private void startSendCarLocationAndAdasRecognizedResult2Server() {
|
||||
private void startSendCarLocationAndAdasRecognizedResult2Server(List<CloudLocationInfo> cloudLocationInfo) {
|
||||
Location lastCarLocation = mLastCarLocation;
|
||||
LocationResult locationResult = null;
|
||||
if ( lastCarLocation != null ) {
|
||||
@@ -477,7 +480,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
locationResult.coordinates = new ArrayList<>();
|
||||
locationResult.sn = com.mogo.commons.network.Utils.getSn();
|
||||
locationResult.mortonCode = MortonCode.wrapEncodeMorton( locationResult.lastCoordinate.getLon(), locationResult.lastCoordinate.getLat() );
|
||||
locationResult.coordinates.add( locationResult.lastCoordinate );
|
||||
locationResult.coordinates.addAll( cloudLocationInfo );
|
||||
}
|
||||
List< ADASRecognizedResult > recognizedResults = MarkerServiceHandler.getADASController().getLastADASRecognizedResult();
|
||||
OnePerSecondSendContent content = new OnePerSecondSendContent();
|
||||
@@ -531,9 +534,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mUiController.recoverLockMode();
|
||||
} else if ( msg.what == ServiceConst.MSG_SEND_CAR_LOCATION_AND_ADAS_RECOGNIZED_RESULT_2_SERVER ) {
|
||||
startSendCarLocationAndAdasRecognizedResult2Server();
|
||||
mThreadHandler.sendEmptyMessageDelayed( ServiceConst.MSG_SEND_CAR_LOCATION_AND_ADAS_RECOGNIZED_RESULT_2_SERVER, ServiceConst.INTERVAL_SEND_CAR_LOCATION_AND_ADAS_RECOGNIZED_RESULT_2_SERVER );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,14 +6,27 @@ 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.module.common.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 = 1 * 1_000L;
|
||||
|
||||
private Handler mHandler;
|
||||
private LocationManager locationManager;
|
||||
private RTKLocationListener rtkLocationListener;
|
||||
private List<CloudLocationInfo> cacheList = new ArrayList<>();
|
||||
|
||||
public static MogoRTKLocation getInstance() {
|
||||
return RTKHolder.rtkLoc;
|
||||
@@ -24,7 +37,38 @@ public class MogoRTKLocation {
|
||||
}
|
||||
|
||||
private MogoRTKLocation() {
|
||||
mHandler = new Handler(WorkThreadHandler.getInstance().getLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_DATA_CHANGED) {
|
||||
sendLocationData();
|
||||
mHandler.sendEmptyMessageDelayed(MSG_DATA_CHANGED, MSG_DATA_INTERNAL);
|
||||
}
|
||||
}
|
||||
};
|
||||
mHandler.sendEmptyMessage(MSG_DATA_CHANGED);
|
||||
}
|
||||
|
||||
public interface RTKLocationListener {
|
||||
void onLocationChanged(List<CloudLocationInfo> cloudLocationInfos);
|
||||
}
|
||||
|
||||
private void sendLocationData() {
|
||||
if (rtkLocationListener != null) {
|
||||
Logger.d(TAG, "sendLocationData size : " + cacheList.size());
|
||||
List list = new ArrayList();
|
||||
list.addAll(cacheList);
|
||||
rtkLocationListener.onLocationChanged(list);
|
||||
}
|
||||
if (cacheList != null && cacheList.size() > 0) {
|
||||
cacheList = null;
|
||||
cacheList = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
public void registerRTKLocationListener(RTKLocationListener locationListener) {
|
||||
rtkLocationListener = locationListener;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
@@ -61,6 +105,17 @@ public class MogoRTKLocation {
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
Logger.d(TAG, "onLocationChanged : " + location.toString());
|
||||
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());
|
||||
cacheList.add(cloudLocationInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user