merge 17
This commit is contained in:
@@ -3,12 +3,16 @@ package com.mogo.module.service;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.service.marker.MapMarkerManager;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
@@ -39,7 +43,6 @@ public class MarkerServiceHandler {
|
||||
|
||||
private static IMogoMapService sMapService;
|
||||
private static IMogoMarkerManager sMarkerManager;
|
||||
private static IMogoNavi sNavi;
|
||||
private static IMogoMapUIController sMapUIController;
|
||||
private static IMogoLocationClient sLocationClient;
|
||||
private static IMogoStatusManager sMogoStatusManager;
|
||||
@@ -55,7 +58,6 @@ public class MarkerServiceHandler {
|
||||
private static ICarsChattingProvider sCarChatting;
|
||||
private static IMogoOverlayManager sIMogoOverlayManager;
|
||||
|
||||
|
||||
public static synchronized void init( final Context context ) {
|
||||
|
||||
if ( sCarChatting != null ) {
|
||||
@@ -70,7 +72,6 @@ public class MarkerServiceHandler {
|
||||
sMogoAnalytics = sApis.getAnalyticsApi();
|
||||
sMarkerManager = sMapService.getMarkerManager( context );
|
||||
sIMogoOverlayManager = sMapService.getOverlayManager(context);
|
||||
sNavi = sMapService.getNavi( context );
|
||||
sMapUIController = sMapService.getMapUIController();
|
||||
sLocationClient = sMapService.getSingletonLocationClient( context );
|
||||
sRegisterCenter = sApis.getRegisterCenterApi();
|
||||
@@ -96,10 +97,6 @@ public class MarkerServiceHandler {
|
||||
return sMarkerManager;
|
||||
}
|
||||
|
||||
public static IMogoNavi getNavi() {
|
||||
return sNavi;
|
||||
}
|
||||
|
||||
public static IMogoMapUIController getMapUIController() {
|
||||
return sMapUIController;
|
||||
}
|
||||
@@ -159,4 +156,41 @@ public class MarkerServiceHandler {
|
||||
public static IMogoOverlayManager getsIMogoOverlayManager() {
|
||||
return sIMogoOverlayManager;
|
||||
}
|
||||
|
||||
public static void setsIMogoOverlayManager(IMogoOverlayManager sIMogoOverlayManager) {
|
||||
MarkerServiceHandler.sIMogoOverlayManager = sIMogoOverlayManager;
|
||||
}
|
||||
|
||||
//TODO -------------以下方法是临时过度使用的,后面统一使用,getMapMarkerManager进行调用
|
||||
|
||||
/**
|
||||
* 绘制Marker
|
||||
* 建议使用
|
||||
*
|
||||
* @see MapMarkerManager#drawMapMarker(MarkerResponse)
|
||||
*/
|
||||
@Deprecated
|
||||
public static void drawMapMarker( MarkerResponse response ) {
|
||||
getMapMarkerManager().drawMapMarker( response );
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制Marker
|
||||
* 建议使用
|
||||
*
|
||||
* @see MapMarkerManager#drawMapMarker(MarkerShowEntity, int)
|
||||
*/
|
||||
@Deprecated
|
||||
public static IMogoMarker drawMapMarker( MarkerShowEntity markerShowEntity ) {
|
||||
return getMapMarkerManager().drawMapMarker( markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH );
|
||||
}
|
||||
|
||||
/**
|
||||
* 对指定类型高亮处理
|
||||
* 建议使用
|
||||
*/
|
||||
@Deprecated
|
||||
public static void highlightedMarker( String typeTag ) {
|
||||
Logger.w( TAG, "do not invoke this method any more." );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
@@ -37,8 +36,6 @@ import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.service.autopilot.AutoPilotRemoteController;
|
||||
import com.mogo.module.service.handler.MainLooperHandler;
|
||||
import com.mogo.module.service.handler.RefreshWorkThreadHandler;
|
||||
@@ -50,9 +47,7 @@ import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.module.service.refresh.AutoRefreshStrategy;
|
||||
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.timedelay.TimeDelayUploadManager;
|
||||
import com.mogo.module.service.ttsConfig.TtsConfigModleData;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.adas.IMogoAdasCarDataCallback;
|
||||
@@ -139,7 +134,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
private RefreshModel mRefreshModel;
|
||||
|
||||
private float mLastZoomLevel = 0;
|
||||
private TtsConfigModleData mTtsModle;
|
||||
private long mRefreshRemainingTime = Long.MAX_VALUE;
|
||||
// 上次手动操作的中心点坐标
|
||||
private MogoLatLng mLastCustomRefreshCenterLocation;
|
||||
@@ -150,7 +144,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
private IMogoActionManager mActionManager;
|
||||
private IMogoADASController mADASController;
|
||||
private IMogoFragmentManager mFragmentManager;
|
||||
private IMogoNavi mNavi;
|
||||
private IMogoRegisterCenter mRegisterCenter;
|
||||
|
||||
|
||||
@@ -213,6 +206,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, false );
|
||||
mUiController.changeZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL );
|
||||
// mUiController.setLockZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL );
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mUiController.recoverLockMode();
|
||||
notifyRefreshData( mLastAutoRefreshLocation, ServiceConst.DEFAULT_AUTO_REFRESH_DATA_RADIUS, mAutoRefreshCallback );
|
||||
@@ -297,25 +291,13 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 每次onResume的时候 在独立app里面播放系统配置的tts语音
|
||||
*/
|
||||
public void playAppTts() {
|
||||
if ( DebugConfig.isLauncher() ) {
|
||||
return;
|
||||
}
|
||||
mTtsModle.playTts();
|
||||
}
|
||||
|
||||
|
||||
public void preInit( Context context ) {
|
||||
mContext = context;
|
||||
|
||||
mRefreshModel = new RefreshModel( context );
|
||||
mTtsModle = new TtsConfigModleData();
|
||||
mMogoMapService = MarkerServiceHandler.getMapService();
|
||||
mUiController = mMogoMapService.getMapUIController();
|
||||
mNavi = mMogoMapService.getNavi( context );
|
||||
|
||||
mStatusManager = MarkerServiceHandler.getMogoStatusManager();
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.USER_INTERACTED, statusChangedListener );
|
||||
@@ -332,7 +314,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
public void init( Context context ) {
|
||||
|
||||
|
||||
initWorkThread();
|
||||
|
||||
registerMogoReceiver( context );
|
||||
@@ -355,19 +336,12 @@ public class MogoServices implements IMogoMapListener,
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_SWITCH_CARD, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_MY_LOCATION, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_ADAS_STATUS, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_OPERATION, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_VOICE_READY, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_MOCK, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_ZHIDAO_NEARBY_CAR_ONLINE, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND_ONLINE, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_ZHIDAO_NEARBY_USER_ONLINE, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND_BYLOCATION, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_BACK, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_AUTO_NAVI_RECEIVER, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_AUTO_NAVI_SEND, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_MOGO, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_ONLINE_CAR_PANEL, this );
|
||||
mIntentManager.registerIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, this );
|
||||
|
||||
mADASController = MarkerServiceHandler.getADASController();
|
||||
@@ -376,8 +350,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
mFragmentManager.addMainFragmentStackTransactionListener( this );
|
||||
|
||||
CarIconDisplayStrategy.getInstance().changeCarIconStatus( mStatusManager.isSeekHelping() );
|
||||
|
||||
AutoPilotRemoteController.getInstance().start();
|
||||
|
||||
Intent intent = new Intent( "com.freedom.ser.ACTION" );
|
||||
@@ -414,11 +386,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
//请求大而全数据,刷新地图POI
|
||||
mRefreshModel.refreshExplorerWayData( ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback );
|
||||
//请求在线车辆数据,刷新地图在线车辆
|
||||
if (!mLastStatusIsVr){
|
||||
MapMarkerManager.getInstance().getOnlineCarDataByAutoRefreshStrategy( ro.mLonLat );
|
||||
}
|
||||
|
||||
Logger.i( TAG, "刷新半径 = %s, 点 = %s, zoomLevel = %s, amount = %s", ro.mRadius, ro.mLonLat, mLastZoomLevel, ro.mAmount );
|
||||
}
|
||||
}
|
||||
@@ -860,11 +827,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
mStatusManager.setSearchUIShow( TAG, false );
|
||||
}
|
||||
if ( mNavi.isNaviing() ) {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene( mUiController, Scene.NAVI );
|
||||
} else {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene( mUiController, Scene.AIMLESS );
|
||||
}
|
||||
mUiController.recoverLockMode();
|
||||
mADASController.showADAS();
|
||||
} else {
|
||||
@@ -927,10 +889,9 @@ public class MogoServices implements IMogoMapListener,
|
||||
if ( ui == EnumMapUI.Type_VR ) {
|
||||
if ( !mLastStatusIsVr ) {
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
|
||||
MapCenterPointStrategy.resetByChangeMode();
|
||||
MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
|
||||
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO ) {
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( "已开启鹰眼模式" );
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( "已开启鹰眼模式" );
|
||||
}
|
||||
mLastStatusIsVr = true;
|
||||
}
|
||||
@@ -938,10 +899,9 @@ public class MogoServices implements IMogoMapListener,
|
||||
if ( mLastStatusIsVr ) {
|
||||
mLastStatusIsVr = false;
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, false );
|
||||
MapCenterPointStrategy.resetByChangeMode();
|
||||
MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
|
||||
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO ) {
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( "已退出鹰眼模式" );
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( "已退出鹰眼模式" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,6 @@ public class ServiceConst {
|
||||
*/
|
||||
public static final String PATH_REFRESH_STRATEGY = "/strategy/refresh";
|
||||
|
||||
/**
|
||||
* tts语音配置
|
||||
*/
|
||||
public static final String PATH_TTS_CONFIG = "/ttsserver/tts";
|
||||
|
||||
/**
|
||||
* 倒计时消息
|
||||
@@ -42,20 +38,11 @@ public class ServiceConst {
|
||||
*/
|
||||
public static final int LOOP_INTERVAL = 10_000;
|
||||
|
||||
/**
|
||||
* 卡片 车聊聊
|
||||
*/
|
||||
public static final String CARD_TYPE_CARS_CHATTING = "CARD_TYPE_CARS_CHATTING";
|
||||
|
||||
/**
|
||||
* 卡片 探路数据
|
||||
*/
|
||||
public static final String CARD_TYPE_ROAD_CONDITION = "CARD_TYPE_ROAD_CONDITION";
|
||||
|
||||
/**
|
||||
* 卡片 分享音乐
|
||||
*/
|
||||
public static final String CARD_TYPE_SHARE_MUSIC = "CARD_TYPE_SHARE_MUSIC";
|
||||
|
||||
/**
|
||||
* 卡片 用户数据
|
||||
@@ -67,11 +54,6 @@ public class ServiceConst {
|
||||
*/
|
||||
public static final String CARD_TYPE_NOVELTY = "CARD_TYPE_NOVELTY";
|
||||
|
||||
/**
|
||||
* 运营位
|
||||
*/
|
||||
public static final String CARD_TYPE_BUSINESS_OPERATION = "CARD_TYPE_BUSINESS_OPERATION";
|
||||
|
||||
/**
|
||||
* 默认地图缩放比例
|
||||
*/
|
||||
@@ -97,10 +79,6 @@ public class ServiceConst {
|
||||
*/
|
||||
public static final int MAX_AMOUNT_ALL = Integer.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* 单个卡片显示时的最大数据量
|
||||
*/
|
||||
public static final int MAX_AMOUNT_SINGLE_CARD = 10;
|
||||
|
||||
/**
|
||||
* 地图变化消息
|
||||
@@ -141,10 +119,6 @@ public class ServiceConst {
|
||||
*/
|
||||
public static final String COMMAND_SWITCH_CARD = "com.zhidao.desk.switchCard";
|
||||
|
||||
/**
|
||||
* 打开/关闭车聊聊
|
||||
*/
|
||||
public static final String COMMAND_OPERATION = "system.application.operation";
|
||||
|
||||
/**
|
||||
* 回到自车
|
||||
@@ -161,41 +135,6 @@ public class ServiceConst {
|
||||
public static final String CMD_BACK = "back";
|
||||
public static final String[] CMD_BACK_WORDS = new String[]{"关闭", "返回"};
|
||||
|
||||
|
||||
/**
|
||||
* 查询附近的人
|
||||
* "data"="{"op":"查询","location":"附近","obj":"人"}"
|
||||
*/
|
||||
public static final String COMMAND_ZHIDAO_NEARBY_CAR_ONLINE = "com.zhidao.nearby.car.online";
|
||||
|
||||
/**
|
||||
* 查询附近的好友
|
||||
* 搜索当前车机所在位置同城市本人有好友关系
|
||||
* (如果一期做不了根据车机所在位置同城查询,则根据车机激活城市查询)
|
||||
* "data"="{"op":"查询","status":"","location":"","obj":"好友"}"
|
||||
*/
|
||||
public static final String COMMAND_ZHIDAO_NEARBY_FRIEND_ONLINE = "com.zhidao.nearby.friend.online";
|
||||
|
||||
/**
|
||||
* 查询在线的好友
|
||||
* "data"="{"op":"查询","status":"在线","obj":"好友"}"
|
||||
*/
|
||||
public static final String COMMAND_ZHIDAO_NEARBY_FRIEND = "com.zhidao.nearby.friend";
|
||||
|
||||
/**
|
||||
* 查询在线的人
|
||||
* <p>
|
||||
* "data"="{"op":"查询","status":"在线","obj":"车主"}"
|
||||
*/
|
||||
public static final String COMMAND_ZHIDAO_NEARBY_USER_ONLINE = "com.zhidao.nearby.user.online";
|
||||
|
||||
/**
|
||||
* 查询指定位置的好友
|
||||
* <p>
|
||||
* "data"="{"op":"看看","obj":"好友","location":"中关村"}"
|
||||
*/
|
||||
public static final String COMMAND_ZHIDAO_NEARBY_FRIEND_BYLOCATION = "com.zhidao.nearby.friend.bylocation";
|
||||
|
||||
/**
|
||||
* 返回桌面
|
||||
*/
|
||||
@@ -204,11 +143,6 @@ public class ServiceConst {
|
||||
public static final int ONLINE_SEARCH_LIMIT = 20;
|
||||
public static final int ONLINE_SEARCH_RADIUS = 2_000;
|
||||
|
||||
/**
|
||||
* 查找目的地车友
|
||||
*/
|
||||
public static final String COMMAND_ONLINE_CAR_PANEL = "com.zhidao.search.riders";
|
||||
|
||||
/**
|
||||
* 导航开始后,延时1分钟开启推送策略
|
||||
*/
|
||||
@@ -219,24 +153,5 @@ public class ServiceConst {
|
||||
*/
|
||||
public static final long INTERVAL_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH = 60 * 1_000L;
|
||||
|
||||
/**
|
||||
* 发送自车位置和adas识别结果给服务端
|
||||
*/
|
||||
public static final int MSG_SEND_CAR_LOCATION_AND_ADAS_RECOGNIZED_RESULT_2_SERVER = 0x401;
|
||||
|
||||
/**
|
||||
* 间隔 1s 发送一次
|
||||
*/
|
||||
public static final long INTERVAL_SEND_CAR_LOCATION_AND_ADAS_RECOGNIZED_RESULT_2_SERVER = 1 * 1_000L;
|
||||
|
||||
/**
|
||||
* adas识别数据
|
||||
*/
|
||||
public static final String TYPE_MARKER_ADAS = "TYPE_MARKER_ADAS";
|
||||
|
||||
/**
|
||||
* 云端下发数据
|
||||
*/
|
||||
public static final String TYPE_MARKER_CLOUD_DATA = "TYPE_MARKER_CLOUD_DATA";
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.service.launchercard.LauncherCardRefresher;
|
||||
import com.mogo.module.service.marker.MapMarkerManager;
|
||||
import com.mogo.module.service.strategy.CarIconDisplayStrategy;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
|
||||
@@ -84,7 +83,6 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
}
|
||||
mIsMainPageFirstResume = false;
|
||||
LauncherCardRefresher.getInstance(AbsMogoApplication.getApp()).stop();
|
||||
MogoServices.getInstance().playAppTts();
|
||||
} else {
|
||||
MogoServices.getInstance().unregisterInternalUnWakeupWords();
|
||||
MogoServices.getInstance().stopAutoRefreshStrategy();
|
||||
@@ -109,7 +107,7 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
}
|
||||
};
|
||||
}
|
||||
MogoApisHandler.getInstance().getApis().getShareManager().dismissShareDialog();
|
||||
//MogoApisHandler.getInstance().getApis().getShareManager().dismissShareDialog();
|
||||
MogoApisHandler.getInstance().getApis().getOnlineCarPanelApi().hidePanel();
|
||||
MogoApisHandler.getInstance().getApis().getEventPanelManager().hidePanel();
|
||||
if (mCarsChattingProvider == null) {
|
||||
@@ -121,7 +119,6 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
}
|
||||
|
||||
public void onSeekHelpingStatusChanged(boolean isSeekingHelping) {
|
||||
CarIconDisplayStrategy.getInstance().changeCarIconStatus(isSeekingHelping);
|
||||
notifySeekHelpingStatusChanged(isSeekingHelping);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,8 @@ public class MogoDataHandler implements IMogoDataManager {
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
public synchronized void registerDataListener( String tag, IMogoDataChangedListener listener ) {
|
||||
@Override
|
||||
public synchronized void registerDataListener(String tag, IMogoDataChangedListener listener ) {
|
||||
if ( listener == null || TextUtils.isEmpty( tag ) ) {
|
||||
return;
|
||||
}
|
||||
@@ -48,7 +49,8 @@ public class MogoDataHandler implements IMogoDataManager {
|
||||
mListeners.get( tag ).add( listener );
|
||||
}
|
||||
|
||||
public synchronized void unregisterListener( String tag, IMogoDataChangedListener listener ) {
|
||||
@Override
|
||||
public synchronized void unregisterListener(String tag, IMogoDataChangedListener listener ) {
|
||||
if ( listener == null || TextUtils.isEmpty( tag ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class DispatchAirportDialog extends DispatchBaseDialog {
|
||||
tvTaskTime = findViewById(R.id.module_services_dispatch_dialog_task_time);
|
||||
tvFlightInfo = findViewById(R.id.module_services_dispatch_dialog_flight_time);
|
||||
tvTaskContent = findViewById(R.id.module_services_dispatch_dialog_task_content);
|
||||
Button btnAffirm = (Button) findViewById(R.id.module_services_dispatch_dialog_confirm);
|
||||
Button btnAffirm = findViewById(R.id.module_services_dispatch_dialog_confirm);
|
||||
btnAffirm.setOnClickListener(v -> {
|
||||
if (mListener != null) {
|
||||
mListener.affirm();
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
public class StartLatLon {
|
||||
|
||||
private double lat;
|
||||
private double lon;
|
||||
|
||||
public StartLatLon(double lat, double lon) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StartLatLon{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,14 @@ import android.content.Intent;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
|
||||
public
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/5
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class AIAssistIntentHandler implements IntentHandler {
|
||||
public class AIAssistIntentHandler implements IntentHandler {
|
||||
|
||||
private static final String TAG = "AIAssistIntentHandler";
|
||||
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.LaunchUtils;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AppOperationIntentHandler implements IntentHandler {
|
||||
|
||||
public final Map< String, String > sAppPackages = new HashMap<>();
|
||||
|
||||
public AppOperationIntentHandler() {
|
||||
// sAppPackages.put( "车聊聊", "com.zhidao.imdemo" );
|
||||
// sAppPackages.put( "VR模式", "" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
try {
|
||||
JSONObject object = new JSONObject( intent.getStringExtra( "data" ) );
|
||||
String app = object.optString( "object" );
|
||||
String operation = object.optString( "operation" );
|
||||
if ( TextUtils.equals( "打开", operation ) ) {
|
||||
if ( TextUtils.equals( "VR模式", app ) ) {
|
||||
if ( MarkerServiceHandler.getApis().getStatusManagerApi().isMainPageOnResume() ) {
|
||||
MarkerServiceHandler.getApis().getMapFrameControllerApi().changeToVRMode();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ( TextUtils.isEmpty( sAppPackages.get( app ) ) ) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
LaunchUtils.launchByPkg( context, sAppPackages.get( app ) );
|
||||
} catch ( Exception e ) {
|
||||
TipToast.shortTip( "应用程序未安装" );
|
||||
}
|
||||
} else if ( TextUtils.equals( "关闭", operation ) ) {
|
||||
if ( TextUtils.equals( "VR模式", app ) ) {
|
||||
if ( MarkerServiceHandler.getApis().getStatusManagerApi().isMainPageOnResume() ) {
|
||||
MarkerServiceHandler.getApis().getMapFrameControllerApi().changeTo2dMode();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,13 +22,7 @@ public class IntentHandlerFactory {
|
||||
private IntentHandlerFactory() {
|
||||
// private constructor
|
||||
mHandlers.put( MogoReceiver.ACTION_MOCK, new MockIntentHandler() );
|
||||
mHandlers.put( ServiceConst.COMMAND_OPERATION, new AppOperationIntentHandler() );
|
||||
mHandlers.put( ServiceConst.COMMAND_MY_LOCATION, new MyLocationHandler() );
|
||||
mHandlers.put( ServiceConst.COMMAND_ZHIDAO_NEARBY_CAR_ONLINE, OnlineCarSearchIntentHandler.getInstance() );
|
||||
mHandlers.put( ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND_ONLINE, OnlineCarSearchIntentHandler.getInstance() );
|
||||
mHandlers.put( ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND, OnlineCarSearchIntentHandler.getInstance() );
|
||||
mHandlers.put( ServiceConst.COMMAND_ZHIDAO_NEARBY_USER_ONLINE, OnlineCarSearchIntentHandler.getInstance() );
|
||||
mHandlers.put( ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND_BYLOCATION, OnlineCarSearchIntentHandler.getInstance() );
|
||||
mHandlers.put( MogoReceiver.ACTION_VOICE_UI, new VoiceUiIntentHandler() );
|
||||
mHandlers.put( Intent.ACTION_POWER_CONNECTED, AccStatusIntentHandler.getInstance() );
|
||||
mHandlers.put( Intent.ACTION_POWER_DISCONNECTED, AccStatusIntentHandler.getInstance() );
|
||||
@@ -38,7 +32,6 @@ public class IntentHandlerFactory {
|
||||
mHandlers.put( MogoReceiver.ACTION_VOICE_READY, new AIAssistIntentHandler() );
|
||||
mHandlers.put( ServiceConst.COMMAND_BACK, WholeVoiceCommandIntentHandler.getInstance() );
|
||||
mHandlers.put( MogoReceiver.ACTION_MOGO, new MogoControllerIntentHandler() );
|
||||
mHandlers.put( ServiceConst.COMMAND_ONLINE_CAR_PANEL, new OnlineCarPanelIntentHandler() );
|
||||
mHandlers.put( ConnectivityManager.CONNECTIVITY_ACTION, new NetworkChangedIntentHandler() );
|
||||
}
|
||||
|
||||
|
||||
@@ -3,14 +3,10 @@ package com.mogo.module.service.intent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
@@ -26,6 +22,8 @@ import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
@@ -46,11 +44,7 @@ import com.mogo.module.common.drawer.IdentifyDataDrawer;
|
||||
import com.mogo.module.common.drawer.SnapshotSetDataDrawer;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.status.EnvStatusManager;
|
||||
import com.mogo.module.service.timedelay.TimeDelayUploadManager;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -95,46 +89,10 @@ public class MockIntentHandler implements IntentHandler {
|
||||
TipToast.shortTip(msg);
|
||||
}
|
||||
break;
|
||||
case 4:// 测试左侧按钮1
|
||||
TextView button1 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton(ButtonIndex.BUTTON1);
|
||||
if (button1 != null) {
|
||||
button1.setVisibility(View.VISIBLE);
|
||||
button1.setBackgroundColor(Color.RED);
|
||||
button1.setOnClickListener(view -> {
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 5:// 测试左侧按钮2
|
||||
TextView button2 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton(ButtonIndex.BUTTON2);
|
||||
if (button2 != null) {
|
||||
button2.setOnClickListener(null);
|
||||
button2.setVisibility(View.GONE);
|
||||
}
|
||||
break;
|
||||
case 6://
|
||||
boolean status1 = intent.getBooleanExtra("status", false);
|
||||
MarkerServiceHandler.getMogoStatusManager().setUploadingStatus(TAG, status1);
|
||||
break;
|
||||
case 7:// 打开微信
|
||||
TextView button11 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton(ButtonIndex.BUTTON1);
|
||||
if (button11 != null) {
|
||||
button11.setVisibility(View.VISIBLE);
|
||||
button11.setBackgroundColor(Color.RED);
|
||||
button11.setOnClickListener(view -> {
|
||||
Intent intent1 = new Intent();
|
||||
intent1.setAction(Intent.ACTION_VIEW);
|
||||
intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent1.setData(Uri.parse("wechathelper://com.zhidao.wechathelper/main/transform?type=navi&lon=116.327007&lat=39.977639&from=os2.0"));
|
||||
try {
|
||||
view.setOnClickListener(null);
|
||||
view.getContext().startActivity(intent1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
view.setVisibility(View.GONE);
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 8:// 测试修改车头角度
|
||||
float bearing = intent.getFloatExtra("bearing", 0);
|
||||
MarkerServiceHandler.getMapUIController().changeBearing(bearing);
|
||||
@@ -175,55 +133,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 13: {// 唤起高德地图
|
||||
double lat = intent.getFloatExtra("lat", 0.0f);
|
||||
double lon = intent.getFloatExtra("lon", 0.0f);
|
||||
boolean real = intent.getBooleanExtra("real", false);
|
||||
MarkerServiceHandler.getRegisterCenter().registerMogoNaviListener(TAG, new IMogoNaviListener() {
|
||||
@Override
|
||||
public void onInitNaviFailure() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculateSuccess() {
|
||||
MarkerServiceHandler.getRegisterCenter().unregisterMogoNaviListener(TAG);
|
||||
MarkerServiceHandler.getNavi().startNavi(real);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onoCalculateFailed() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic(MogoTraffic traffic) {
|
||||
|
||||
}
|
||||
});
|
||||
MarkerServiceHandler.getNavi().naviTo(new MogoLatLng(lat, lon));
|
||||
break;
|
||||
}
|
||||
case 14: {//测试点的动画移动,模拟周边车辆移动
|
||||
List<MogoLatLng> mogoLatLngs = new ArrayList<>();
|
||||
mogoLatLngs.add(new MogoLatLng(39.615986, 116.396716));
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/21
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class OnlineCarPanelIntentHandler implements IntentHandler {
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
String json = SpStorage.getNavigationTarget();
|
||||
if ( TextUtils.isEmpty( json ) ) {
|
||||
AIAssist.getInstance( context ).speakTTSVoice( "没有导航目的地" );
|
||||
return;
|
||||
}
|
||||
AIAssist.getInstance( context ).speakTTSVoice( "正在查询" );
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume() ) {
|
||||
MarkerServiceHandler.getApis().getOnlineCarPanelApi().showPanel();
|
||||
} else {
|
||||
Intent start = new Intent( Intent.ACTION_VIEW );
|
||||
start.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
start.setData( Uri.parse( "mogo://launcher/main/switch2?type=showOnlineCarPanel" ) );
|
||||
context.startActivity( start );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearchListener;
|
||||
import com.mogo.map.search.geo.MogoGeocodeAddress;
|
||||
import com.mogo.map.search.geo.MogoGeocodeResult;
|
||||
import com.mogo.map.search.geo.query.MogoGeocodeQuery;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.marker.MapMarkerManager;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/5
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class OnlineCarSearchIntentHandler implements IntentHandler {
|
||||
|
||||
private static final String TAG = "OnlineCarSearchIntentHandler";
|
||||
|
||||
private static volatile OnlineCarSearchIntentHandler sInstance;
|
||||
|
||||
private OnlineCarSearchIntentHandler() {
|
||||
}
|
||||
|
||||
public static OnlineCarSearchIntentHandler getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( OnlineCarSearchIntentHandler.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new OnlineCarSearchIntentHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
|
||||
if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
String command = intent.getStringExtra( MogoReceiver.PARAM_COMMAND );
|
||||
if ( TextUtils.isEmpty( command ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
MogoLocation location = MarkerServiceHandler.getMogoLocationClient().getLastKnowLocation();
|
||||
MogoLatLng target = null;
|
||||
if ( location != null ) {
|
||||
target = new MogoLatLng( location.getLatitude(), location.getLongitude() );
|
||||
}
|
||||
boolean isFocus = false;
|
||||
boolean isSameCity = false;
|
||||
switch ( command ) {
|
||||
case ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND:
|
||||
case ServiceConst.COMMAND_ZHIDAO_NEARBY_USER_ONLINE:
|
||||
isFocus = true;
|
||||
isSameCity = true;
|
||||
case ServiceConst.COMMAND_ZHIDAO_NEARBY_CAR_ONLINE:
|
||||
case ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND_ONLINE:
|
||||
Logger.d( TAG, "搜索附近的好友/在线车辆" );
|
||||
doDataRequest(
|
||||
target,
|
||||
isFocus,
|
||||
isSameCity,
|
||||
ServiceConst.ONLINE_SEARCH_LIMIT,
|
||||
ServiceConst.ONLINE_SEARCH_RADIUS );
|
||||
break;
|
||||
case ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND_BYLOCATION:
|
||||
handleAreaSearch( intent, context, target );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void handleAreaSearch( Intent intent, Context context, MogoLatLng target ) {
|
||||
String data = intent.getStringExtra( "data" );
|
||||
if ( TextUtils.isEmpty( data ) ) {
|
||||
Logger.e( TAG, "语音没有携带数据!!!!!" );
|
||||
return;
|
||||
}
|
||||
String keyword = null;
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject( data );
|
||||
keyword = jsonObject.get( "location" ).toString();
|
||||
Logger.d( TAG, "location 查询指定位置的好友 keyword = " + keyword );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, "语音携带数据异常!!!!!" );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( TextUtils.isEmpty( keyword ) ) {
|
||||
Logger.e( TAG, "语音携带数据为空!!!!!" );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( TextUtils.equals( "附近", keyword ) ) {
|
||||
doDataRequest(
|
||||
target,
|
||||
false,
|
||||
false,
|
||||
ServiceConst.ONLINE_SEARCH_LIMIT,
|
||||
ServiceConst.ONLINE_SEARCH_RADIUS );
|
||||
} else {
|
||||
String cityCode = MarkerServiceHandler.getMogoLocationClient().getLastKnowLocation().getCityCode();
|
||||
IMogoGeoSearch search = MarkerServiceHandler.getMapService().getGeoSearch( context );
|
||||
search.setGeoSearchListener( new IMogoGeoSearchListener() {
|
||||
@Override
|
||||
public void onGeocodeSearched( MogoGeocodeResult geocodeResult ) {
|
||||
MogoLatLng target = getGeoTargetAddress( geocodeResult );
|
||||
if ( target == null ) {
|
||||
Logger.e( TAG, "geo 检索位置错误" );
|
||||
return;
|
||||
}
|
||||
doDataRequest(
|
||||
target,
|
||||
false,
|
||||
false,
|
||||
ServiceConst.ONLINE_SEARCH_LIMIT,
|
||||
ServiceConst.ONLINE_SEARCH_RADIUS );
|
||||
}
|
||||
} );
|
||||
MogoGeocodeQuery mogoGeocodeQuery = new MogoGeocodeQuery();
|
||||
mogoGeocodeQuery.setCity( cityCode );
|
||||
mogoGeocodeQuery.setLocationName( keyword );
|
||||
search.getFromLocationNameAsyn( mogoGeocodeQuery );
|
||||
}
|
||||
}
|
||||
|
||||
private MogoLatLng getGeoTargetAddress( MogoGeocodeResult geocodeResult ) {
|
||||
if ( geocodeResult == null
|
||||
|| geocodeResult.getAddresses() == null
|
||||
|| geocodeResult.getAddresses().isEmpty() ) {
|
||||
return null;
|
||||
}
|
||||
for ( MogoGeocodeAddress address : geocodeResult.getAddresses() ) {
|
||||
if ( address == null ) {
|
||||
continue;
|
||||
}
|
||||
if ( address.getLatlng() == null ) {
|
||||
continue;
|
||||
}
|
||||
return address.getLatlng();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void doDataRequest( MogoLatLng target,
|
||||
boolean onlyFocus,
|
||||
boolean onlySameCity,
|
||||
int limit,
|
||||
int radius ) {
|
||||
MarkerServiceHandler.getApis().getRefreshStrategyControllerApi().restartAutoRefreshAtTime( 30_000 );
|
||||
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false );
|
||||
if(!MarkerServiceHandler.getApis().getStatusManagerApi().isVrMode()){
|
||||
MarkerServiceHandler.getMapUIController().moveToCenter( target );
|
||||
}
|
||||
MapMarkerManager.getInstance().getOnlineCarDataByVoiceControl(
|
||||
target,
|
||||
onlyFocus,
|
||||
onlySameCity,
|
||||
limit,
|
||||
radius );
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||
import com.mogo.module.common.drawer.OnlineCarDrawer;
|
||||
import com.mogo.module.common.drawer.RoadConditionDrawer;
|
||||
import com.mogo.module.common.drawer.marker.IMarkerView;
|
||||
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
|
||||
@@ -492,32 +491,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
mCarLatLng = new MogoLatLng(lat, lon);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据经纬度请求数据
|
||||
*
|
||||
* @param latlng
|
||||
*/
|
||||
public void getOnlineCarDataByAutoRefreshStrategy(MogoLatLng latlng) {
|
||||
UiThreadHandler.removeCallbacks(runnable);
|
||||
getOnlineCarDataImpl(latlng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param latLng
|
||||
* @param onlyFocus
|
||||
* @param onlySameCity
|
||||
* @param limit
|
||||
* @param radius
|
||||
*/
|
||||
public void getOnlineCarDataByVoiceControl(MogoLatLng latLng,
|
||||
boolean onlyFocus,
|
||||
boolean onlySameCity,
|
||||
int limit,
|
||||
int radius) {
|
||||
UiThreadHandler.removeCallbacks(runnable);
|
||||
getOnlineCarDataImpl(latLng, onlyFocus, onlySameCity, limit, radius, true);
|
||||
}
|
||||
|
||||
private final Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -595,7 +568,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
|
||||
runOnTargetThread(() -> {
|
||||
trackData(size);
|
||||
OnlineCarDrawer.getInstance().drawOnlineCarMarkers(onlineCarList, Integer.MAX_VALUE, fitBounds, fitBounds, mMarkerDisplayBounds, latLng, MapMarkerManager.this);
|
||||
UiThreadHandler.postDelayed(runnable, SMOOTH_DURATION * 1000);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.mogo.module.service.mocktools;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class DataCollectionHandler {
|
||||
|
||||
private static volatile DataCollectionHandler handler;
|
||||
private static final byte[] obj = new byte[0];
|
||||
private volatile boolean openDataCollect = false;
|
||||
|
||||
private Handler mLocationDataCollectHandler;
|
||||
private Handler mRecognizeDataCollectHandler;
|
||||
|
||||
private static final String WRITE_FILE_PATH = Environment.getExternalStorageDirectory().getPath() + File.separator + "mockWrite";
|
||||
|
||||
private DataCollectionHandler() {
|
||||
|
||||
}
|
||||
|
||||
public static DataCollectionHandler getInstance() {
|
||||
if (handler == null) {
|
||||
synchronized (obj) {
|
||||
if (handler == null) {
|
||||
handler = new DataCollectionHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
|
||||
public void start() {
|
||||
openDataCollect = true;
|
||||
}
|
||||
|
||||
public boolean canCollectData() {
|
||||
return openDataCollect;
|
||||
}
|
||||
|
||||
public void collectLocationDataToFile(String locationData) {
|
||||
if (mLocationDataCollectHandler == null) {
|
||||
mLocationDataCollectHandler = new Handler(WorkThreadHandler.newInstance("data-collect-thread").getLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public void collectRecogniseDataToFile() {
|
||||
if (mRecognizeDataCollectHandler == null) {
|
||||
mRecognizeDataCollectHandler = new Handler(WorkThreadHandler.newInstance("recognize-collect-thread").getLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
openDataCollect = false;
|
||||
mLocationDataCollectHandler = null;
|
||||
mRecognizeDataCollectHandler = null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,16 +26,16 @@ public interface RefreshApiService {
|
||||
@POST( "/yycp-launcherSnapshot/launcherSnapshot/querySnapshotAsync" )
|
||||
Observable< BaseData > refreshData( @FieldMap Map< String, Object > parameters );
|
||||
|
||||
/*
|
||||
/**
|
||||
* 大而全
|
||||
* */
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST( "/yycp-launcherSnapshot/launcherSnapshot/querySnapshotSync" )
|
||||
Observable< MarkerResponse > refreshDataSync( @FieldMap Map< String, Object > parameters );
|
||||
|
||||
/*
|
||||
/**
|
||||
* 周边在线车辆
|
||||
* */
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST( "/yycp-launcherSnapshot/user/queryOnLineCarWithRoute" )
|
||||
Observable< MarkerResponse > queryOnLineCarWithRoute( @FieldMap Map< String, Object > parameters );
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
package com.mogo.module.service.polyline;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 前车碰撞的画线
|
||||
* @since 2021/4/25
|
||||
*/
|
||||
public class LimberCollisionPolyline {
|
||||
|
||||
private volatile static LimberCollisionPolyline mInstance = null;
|
||||
|
||||
private IMogoPolyline mMoGoPolyline;
|
||||
// 连接线参数
|
||||
private MogoPolylineOptions mPolylineOptions;
|
||||
// 线路径集合
|
||||
private List<MogoLatLng> mPolylinePointList;
|
||||
|
||||
|
||||
public static LimberCollisionPolyline getInstance() {
|
||||
if (mInstance == null) {
|
||||
synchronized (LimberCollisionPolyline.class) {
|
||||
if (mInstance == null) {
|
||||
mInstance = new LimberCollisionPolyline();
|
||||
}
|
||||
}
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
protected LimberCollisionPolyline() {
|
||||
mPolylineOptions = new MogoPolylineOptions();
|
||||
// 绘制路径集合
|
||||
mPolylinePointList = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
public IMogoPolyline draw(float width, List<MogoLatLng> polylinePoint) {
|
||||
try {
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mPolylinePointList.clear();
|
||||
}
|
||||
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
// colors.add(0x0DE32F46);
|
||||
colors.add(0xD9E32F46);
|
||||
colors.add(0x0DE32F46);
|
||||
|
||||
// 线条粗细,渐变,渐变色值 TODO liyz 宽度需要传过来
|
||||
options.width(60).useGradient(true).colorValues(colors);
|
||||
for (int i = 0; i < polylinePoint.size(); i++) {
|
||||
options.add(polylinePoint.get(i));
|
||||
}
|
||||
// 绘制线的对象
|
||||
mMoGoPolyline = MarkerServiceHandler.getsIMogoOverlayManager().addPolyline(options);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return mMoGoPolyline;
|
||||
}
|
||||
|
||||
|
||||
public IMogoPolyline getPolyLine() {
|
||||
return mMoGoPolyline;
|
||||
}
|
||||
|
||||
public void clearLine() {
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mMoGoPolyline = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
package com.mogo.module.service.status;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.wm.WindowManagerView;
|
||||
import com.mogo.module.service.R;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.util.CommonUtils.getVersionName;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/17
|
||||
*
|
||||
* 环境状态
|
||||
*/
|
||||
public class EnvStatusManager {
|
||||
|
||||
private static volatile EnvStatusManager sInstance;
|
||||
|
||||
private EnvStatusManager() {
|
||||
}
|
||||
|
||||
public static EnvStatusManager getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (EnvStatusManager.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new EnvStatusManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private WindowManagerView mPanelView;
|
||||
private TextView mStatusTv;
|
||||
private final Handler mMainHandler = new Handler(Looper.getMainLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (mPanelView.isShowing()) {
|
||||
renderStatus();
|
||||
mMainHandler.sendEmptyMessageDelayed(MSG, 5_000L);
|
||||
}
|
||||
}
|
||||
};
|
||||
public static final int MSG = 10000;
|
||||
|
||||
private void renderStatus() {
|
||||
String[] sStatusName = {
|
||||
"工控机定位",
|
||||
"ADAS近景感知",
|
||||
"云端远景感知",
|
||||
"自动驾驶状态",
|
||||
"socket长链",
|
||||
"经度",
|
||||
"纬度",
|
||||
"网络状态",
|
||||
"App版本",
|
||||
"Map版本",
|
||||
"SN",
|
||||
"OBU状态",
|
||||
"HV状态",
|
||||
"RV状态"
|
||||
};
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int i = 0; i < sStatusName.length; i++) {
|
||||
stringBuilder.append(sStatusName[i]).append(":");
|
||||
if (i == 3) {
|
||||
stringBuilder.append(DebugConfig.getAutoPilotStatus()).append("\n");
|
||||
} else if (i == 4) {
|
||||
stringBuilder.append(DebugConfig.isDownloadSnapshot() ? "正常" : "异常").append("\n");
|
||||
} else if (i == 5 || i == 6) {
|
||||
stringBuilder.append(DebugConfig.getStatusData(i)).append("\n");
|
||||
} else if (i == 7) {
|
||||
stringBuilder.append(NetworkUtils.isConnected(mContext)).append("\n");
|
||||
} else if (i == 8) {
|
||||
stringBuilder.append(getVersionName(mContext, "com.mogo.launcher.f")).append("\n");
|
||||
} else if (i == 9) {
|
||||
String mapVersion = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapVersion();
|
||||
if (!TextUtils.isEmpty(mapVersion)) {
|
||||
stringBuilder.append(mapVersion).append("\n");
|
||||
}
|
||||
} else if(i == 10){
|
||||
stringBuilder.append(MoGoAiCloudClientConfig.getInstance().getSn()).append("\n");
|
||||
} else if (i == 11) {
|
||||
boolean isObuConnect = SharedPrefsMgr.getInstance(mContext).getBoolean("OBU", false);
|
||||
stringBuilder.append(isObuConnect == true ? "已连接" : "未连接").append("\n");
|
||||
} else if (i == 12) {
|
||||
boolean isHv = SharedPrefsMgr.getInstance( mContext ).getBoolean("OBU_HV", false );
|
||||
stringBuilder.append(isHv == true ? "已连接" : "未连接").append("\n");
|
||||
} else if (i == 13) {
|
||||
boolean isRv = SharedPrefsMgr.getInstance( mContext ).getBoolean("OBU_RV", false );
|
||||
stringBuilder.append(isRv == true ? "已连接" : "未连接").append("\n");
|
||||
} else {
|
||||
stringBuilder.append("true".equals(DebugConfig.getStatus(i, true)) ? "正常" : "异常").append("\n");
|
||||
}
|
||||
}
|
||||
mStatusTv.setText(stringBuilder);
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
mStatusTv.setTextColor(Color.WHITE);
|
||||
} else {
|
||||
if (MogoApisHandler.getInstance().getApis().getAdasControllerApi()
|
||||
.getCurrentSkinMode() == EnumMapUI.Type_Light) {
|
||||
mStatusTv.setTextColor(Color.BLACK);
|
||||
} else {
|
||||
mStatusTv.setTextColor(Color.WHITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Context mContext;
|
||||
|
||||
public void showPanel(Context context) {
|
||||
mContext = context;
|
||||
if (mPanelView == null) {
|
||||
mPanelView = new WindowManagerView.Builder(context)
|
||||
.contentView(R.layout.module_services_status_panel)
|
||||
.position(0, 100)
|
||||
.size(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
.gravity(Gravity.TOP)
|
||||
.showInWindowManager();
|
||||
mPanelView.attachTouchEvent(((view, xPos, yPos) -> closePanel()));
|
||||
mPanelView.findViewById(R.id.module_services_status_iv).setOnClickListener(view -> closePanel());
|
||||
mStatusTv = mPanelView.findViewById(R.id.module_services_status_tv);
|
||||
}
|
||||
mPanelView.show();
|
||||
mMainHandler.sendEmptyMessageDelayed(MSG, 0L);
|
||||
}
|
||||
|
||||
public void closePanel() {
|
||||
if (mPanelView != null) {
|
||||
mPanelView.dismiss();
|
||||
mMainHandler.removeMessages(MSG);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,282 +0,0 @@
|
||||
package com.mogo.module.service.strategy;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.module.common.utils.CarSeries;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-16
|
||||
* <p>
|
||||
* 上报故障求助之后自车的图标显示策略
|
||||
*/
|
||||
public class CarIconDisplayStrategy {
|
||||
|
||||
private static final String TAG = "CarIconDisplayStrategy";
|
||||
|
||||
public static final int MSG_SEEK_HELPING_ANIM = 2000;
|
||||
public static final int MSG_STOP_SEEK_HELPING_ANIM = 2001;
|
||||
|
||||
// F 系列才有这个帧动画
|
||||
public static final int[] sFrame = {
|
||||
R.drawable.module_service_ic_warning_circle_orange_00000,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00001,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00002,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00003,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00004,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00005,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00006,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00007,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00008,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00009,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00010,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00011,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00012,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00013,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00014,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00015,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00016,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00017,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00018,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00019,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00020,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00021,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00022,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00023,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00024,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00025,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00026,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00027,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00028,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00029,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00030,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00031,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00032,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00033,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00034,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00035,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00036,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00037,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00038,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00039,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00040,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00041,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00042,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00043,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00044,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00045,
|
||||
R.drawable.module_service_ic_warning_circle_orange_00046
|
||||
};
|
||||
|
||||
// F 系列才有这个帧动画
|
||||
public static final int[] sFrameVr = {
|
||||
R.drawable.module_service_ic_car_for_help_0000,
|
||||
R.drawable.module_service_ic_car_for_help_0001,
|
||||
R.drawable.module_service_ic_car_for_help_0002,
|
||||
R.drawable.module_service_ic_car_for_help_0003,
|
||||
R.drawable.module_service_ic_car_for_help_0004,
|
||||
R.drawable.module_service_ic_car_for_help_0005,
|
||||
R.drawable.module_service_ic_car_for_help_0006,
|
||||
R.drawable.module_service_ic_car_for_help_0007,
|
||||
R.drawable.module_service_ic_car_for_help_0008,
|
||||
R.drawable.module_service_ic_car_for_help_0009,
|
||||
R.drawable.module_service_ic_car_for_help_0010,
|
||||
R.drawable.module_service_ic_car_for_help_0011,
|
||||
R.drawable.module_service_ic_car_for_help_0012,
|
||||
R.drawable.module_service_ic_car_for_help_0013,
|
||||
R.drawable.module_service_ic_car_for_help_0014,
|
||||
R.drawable.module_service_ic_car_for_help_0015,
|
||||
R.drawable.module_service_ic_car_for_help_0016,
|
||||
R.drawable.module_service_ic_car_for_help_0017,
|
||||
R.drawable.module_service_ic_car_for_help_0018,
|
||||
R.drawable.module_service_ic_car_for_help_0019,
|
||||
R.drawable.module_service_ic_car_for_help_0020,
|
||||
R.drawable.module_service_ic_car_for_help_0021,
|
||||
R.drawable.module_service_ic_car_for_help_0022,
|
||||
R.drawable.module_service_ic_car_for_help_0023,
|
||||
R.drawable.module_service_ic_car_for_help_0024
|
||||
};
|
||||
|
||||
private static volatile CarIconDisplayStrategy sInstance;
|
||||
|
||||
private IMogoMarker mSeekHelpingMarker;
|
||||
private ArrayList<Bitmap> mBitmapFrames = new ArrayList<>();
|
||||
|
||||
private CarIconDisplayStrategy() {
|
||||
mOption =
|
||||
new CarCursorOption.Builder().carCursorRes(R.drawable.module_service_ic_seek_helping).build();
|
||||
}
|
||||
|
||||
public static CarIconDisplayStrategy getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (CarIconDisplayStrategy.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new CarIconDisplayStrategy();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Handler mSeekHelpingHandler;
|
||||
private CarCursorOption mOption;
|
||||
private MogoMarkerOptions seekHelpMarkerOptions;
|
||||
// private IMogoMarker seekHelpMarker;
|
||||
|
||||
|
||||
public void changeCarIconStatus(boolean seekHelpingStatus) {
|
||||
if (CarSeries.isF8xxSeries()) {
|
||||
if (seekHelpingStatus) {
|
||||
playSeekHelpingAnim();
|
||||
} else {
|
||||
stopSeekHelpingAnim();
|
||||
}
|
||||
} else {
|
||||
if (seekHelpingStatus) {
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(false);
|
||||
mSeekHelpingMarker = MarkerServiceHandler.getMarkerManager().addMarker(
|
||||
TAG,
|
||||
new MogoMarkerOptions()
|
||||
.icon(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), R.drawable.module_service_ic_seek_helping))
|
||||
.period(1)
|
||||
.zIndex(1000)
|
||||
.autoManager(false)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.position(MarkerServiceHandler.getMapService().getNavi(AbsMogoApplication.getApp()).getCarLocation2()));
|
||||
// MarkerServiceHandler.getMapUIController().setCarCursorOption( mOption );
|
||||
} else {
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(true);
|
||||
try {
|
||||
if (mSeekHelpingMarker != null) {
|
||||
mSeekHelpingMarker.destroy();
|
||||
mSeekHelpingMarker = null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// MarkerServiceHandler.getMapUIController().setCarCursorOption(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void playSeekHelpingAnim() {
|
||||
initHandler();
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MSG_SEEK_HELPING_ANIM;
|
||||
mSeekHelpingHandler.sendMessageDelayed(msg, 0);
|
||||
}
|
||||
|
||||
private void initHandler() {
|
||||
if (mSeekHelpingHandler != null) {
|
||||
return;
|
||||
}
|
||||
mSeekHelpingHandler = new Handler(WorkThreadHandler.getInstance().getLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
switch (msg.what) {
|
||||
case MSG_SEEK_HELPING_ANIM:
|
||||
try {
|
||||
stopAnim();
|
||||
playAnim();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case MSG_STOP_SEEK_HELPING_ANIM:
|
||||
try {
|
||||
stopAnim();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void stopSeekHelpingAnim() {
|
||||
initHandler();
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MSG_STOP_SEEK_HELPING_ANIM;
|
||||
mSeekHelpingHandler.sendMessageDelayed(msg, 0);
|
||||
}
|
||||
|
||||
private void playAnim() {
|
||||
try {
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isVrMode()) {
|
||||
for (int i : sFrameVr) {
|
||||
mBitmapFrames.add(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), i));
|
||||
}
|
||||
} else {
|
||||
for (int i : sFrame) {
|
||||
mBitmapFrames.add(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), i));
|
||||
}
|
||||
}
|
||||
|
||||
mSeekHelpingMarker = MarkerServiceHandler.getMarkerManager().addMarker(TAG,
|
||||
new MogoMarkerOptions()
|
||||
.icons(mBitmapFrames)
|
||||
.period(20)
|
||||
.zIndex(0)
|
||||
.scale(MarkerServiceHandler.getMogoStatusManager().isVrMode() ? 0.4f : 1.0f)
|
||||
.autoManager(false)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.position(MarkerServiceHandler.getMapService().getMapUIController().getWindowCenterLocation()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
mSeekHelpingMarker = MarkerServiceHandler.getMarkerManager().addMarker(
|
||||
TAG,
|
||||
new MogoMarkerOptions()
|
||||
.icon(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), R.drawable.module_service_ic_seek_helping))
|
||||
.period(1)
|
||||
.zIndex(1000)
|
||||
.autoManager(false)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.position(MarkerServiceHandler.getMapService().getNavi(AbsMogoApplication.getApp()).getCarLocation2()));
|
||||
// MarkerServiceHandler.getMapUIController().setCarCursorOption(new CarCursorOption.Builder().carCursorRes(R.drawable.module_service_ic_seek_helping_00036).build());
|
||||
}
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(false);
|
||||
}
|
||||
|
||||
private void stopAnim() {
|
||||
try {
|
||||
if (mSeekHelpingMarker != null) {
|
||||
mSeekHelpingMarker.destroy();
|
||||
mSeekHelpingMarker = null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
try {
|
||||
if (!mBitmapFrames.isEmpty()) {
|
||||
for (Bitmap bitmapFrame : mBitmapFrames) {
|
||||
if (bitmapFrame != null && !bitmapFrame.isRecycled()) {
|
||||
bitmapFrame.recycle();
|
||||
}
|
||||
}
|
||||
mBitmapFrames.clear();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(true);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.module.service.ttsConfig;
|
||||
|
||||
import com.mogo.module.service.network.bean.TtsConfigEntity;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
|
||||
/**
|
||||
* @author :zhuangyan
|
||||
* @date : 2020/11/16 15:09
|
||||
* @desc :
|
||||
*/
|
||||
public interface TtsConfigApiService {
|
||||
/**
|
||||
* 查询语音Tts 的
|
||||
*
|
||||
*/
|
||||
@GET("/dataService/car/ttsWord/no/getTTSWord/v1")
|
||||
Observable<TtsConfigEntity> inquireForTts();
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package com.mogo.module.service.ttsConfig;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.module.service.network.bean.TtsConfigEntity;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static com.mogo.commons.AbsMogoApplication.getApp;
|
||||
|
||||
/**
|
||||
* @author :zhuangyan
|
||||
* @date : 2020/11/16 15:04
|
||||
* @desc :
|
||||
*/
|
||||
public class TtsConfigModleData {
|
||||
private static final String TAG = "TrafficModelData";
|
||||
private final TtsConfigApiService mTtsConfigApiService;
|
||||
|
||||
|
||||
public TtsConfigModleData() {
|
||||
mTtsConfigApiService = MogoApisHandler.getInstance().getApis().getNetworkApi().create(TtsConfigApiService.class, HostConst.DATA_SERVICE_HOST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 独立app根据后台配置 播放tts
|
||||
*
|
||||
* @param
|
||||
* @param
|
||||
* @param
|
||||
*/
|
||||
public void playTts() {
|
||||
|
||||
if (DebugConfig.isLauncher()) {
|
||||
return;
|
||||
}
|
||||
mTtsConfigApiService.inquireForTts()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<TtsConfigEntity>(RequestOptions.create(getApp().getApplicationContext())) {
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Log.e("zytest", e.toString());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(TtsConfigEntity o) {
|
||||
super.onSuccess(o);
|
||||
Log.e("zytest", "播放语音了====" + o.getResult().getWord());
|
||||
if (!TextUtils.isEmpty(o.getResult().getWord())) {
|
||||
AIAssist.getInstance(getApp().getApplicationContext()).speakTTSVoice(o.getResult().getWord());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.mogo.module.service.ttsConfig;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.bean.TtsConfigEntity;
|
||||
|
||||
/**
|
||||
* @author :zhuangyan
|
||||
* @date : 2020/11/16 15:01
|
||||
* @desc :进入页面的时候 根据配置 播放tts语音
|
||||
*/
|
||||
@Route(path = ServiceConst.PATH_TTS_CONFIG)
|
||||
public class TtsConfigProvider implements IProvider {
|
||||
private final String TAG = "TtsConfigProvider";
|
||||
private Context mContext;
|
||||
private TtsConfigModleData mTtsModleData;
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
mContext = context;
|
||||
Log.d(TAG, "TtsConfigProvider provider init……");
|
||||
if (mTtsModleData == null) {
|
||||
mTtsModleData = new TtsConfigModleData();
|
||||
}
|
||||
|
||||
mTtsModleData.playTts();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,5 @@
|
||||
package com.mogo.module.service.unwake;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.UNWAKE_UPLOAD_REAL_TIME_TRAFFIC;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.UNWAKE_UPLOAD_ROAD_CONDITION;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.UPLOAD_REAL_TIME_TRAFFIC;
|
||||
@@ -27,6 +12,21 @@ import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_QUERY_HEART
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_QUERY_HISTORY_INDEX;
|
||||
import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_QUERY_SURROUNDING_INDEX;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
|
||||
/**
|
||||
* 全局免唤醒管理
|
||||
* 包括唤醒词指令和全局免唤醒词指令
|
||||
@@ -71,7 +71,8 @@ public class GlobalUnwakeManager implements IProvider, IMogoIntentListener, IMog
|
||||
case VOICE_CMD_SHARE_DIALOG_CLOSE:
|
||||
case VOICE_CMD_NO_REPLY_SHARE_DIALOG_CLOSE:
|
||||
case UNWAKE_UPLOAD_ROAD_CONDITION:
|
||||
MogoApisHandler.getInstance().getApis().getShareManager().onGlobalUnwake(intentStr, intent);
|
||||
//TODO
|
||||
// MogoApisHandler.getInstance().getApis().getShareManager().onGlobalUnwake(intentStr, intent);
|
||||
break;
|
||||
case VOICE_QUERY_HISTORY_INDEX:
|
||||
Log.d("语音指令","VOICE_QUERY_HISTORY_INDEX");
|
||||
@@ -110,7 +111,8 @@ public class GlobalUnwakeManager implements IProvider, IMogoIntentListener, IMog
|
||||
public void onCmdSelected(String cmd) {
|
||||
Logger.d(TAG, "收到免唤醒词指令: " + cmd);
|
||||
if (UNWAKE_UPLOAD_REAL_TIME_TRAFFIC.equals(cmd)) {
|
||||
MogoApisHandler.getInstance().getApis().getShareManager().onGlobalUnwake(cmd, null);
|
||||
//TODO
|
||||
// MogoApisHandler.getInstance().getApis().getShareManager().onGlobalUnwake(cmd, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.mogo.module.service.utils;
|
||||
|
||||
import android.location.Location;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.service.cloud.location.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());
|
||||
}
|
||||
}
|
||||
@@ -1,256 +0,0 @@
|
||||
package com.mogo.module.service.utils;
|
||||
|
||||
import android.os.SystemClock;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.cloud.location.CloudLocationInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 定位预测纠错策略
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class SimpleLocationCorrectStrategy {
|
||||
private static final String TAG = "SimpleLocationCorrectStrategy";
|
||||
private static final int ERR_COUNT_THRESHOLD = 3;
|
||||
/**
|
||||
* 目标距离误差是10米,就是在原目标距离基础上增加10米
|
||||
*/
|
||||
private static final float TARGET_DISTANCE_DEVIATION = 10;
|
||||
|
||||
private CloudLocationInfo lastLocation = null;
|
||||
private long anchorTime;
|
||||
private int errCount;
|
||||
|
||||
private static final SimpleLocationCorrectStrategy instance = new SimpleLocationCorrectStrategy();
|
||||
|
||||
public static SimpleLocationCorrectStrategy getInstance(){
|
||||
return instance;
|
||||
}
|
||||
|
||||
private final List<CloudLocationInfo> historyList = new ArrayList<>();
|
||||
private final List<CloudLocationInfo> validList = new ArrayList<>();
|
||||
private final List<CloudLocationInfo> correctList = new ArrayList<>();
|
||||
private final List<CloudLocationInfo> errList = new ArrayList<>();
|
||||
|
||||
public CloudLocationInfo correct(CloudLocationInfo info) {
|
||||
Logger.d(TAG, "info: " + info.print());
|
||||
if(isLocationValid(info)) {
|
||||
if(recordLocation()) {
|
||||
historyList.add(info);
|
||||
}
|
||||
|
||||
if (lastLocation == null) {
|
||||
lastLocation = info;
|
||||
anchorTime = SystemClock.elapsedRealtime();
|
||||
Logger.d(TAG, "第一条数据");
|
||||
if(recordLocation()) {
|
||||
validList.add(lastLocation);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
if (lastLocation.equals(info)) {
|
||||
Logger.d(TAG, "相同坐标点==");
|
||||
return info;
|
||||
}
|
||||
try {
|
||||
float targetDistance =
|
||||
(float) (lastLocation.getSpeed() * (SystemClock.elapsedRealtime() - anchorTime) / 1000) + TARGET_DISTANCE_DEVIATION;
|
||||
float distance = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().calculateLineDistance(LocationParseUtil.cloudLocationToMogoLatLng(lastLocation), LocationParseUtil.cloudLocationToMogoLatLng(info));
|
||||
Logger.d(TAG,
|
||||
"准备计算{ lastInfo: " + lastLocation.print() + " info: " + info.print() + " targetDistance: " + targetDistance + " distance : " + distance + "}");
|
||||
if (distance <= targetDistance) {
|
||||
// 新的定位点在目标距离范围内,认为此数据有效
|
||||
lastLocation = info;
|
||||
anchorTime = SystemClock.elapsedRealtime();
|
||||
errCount = 0;
|
||||
Logger.d(TAG, "在范围内,为有效点");
|
||||
if(recordLocation()) {
|
||||
validList.add(lastLocation);
|
||||
}
|
||||
return info;
|
||||
} else {
|
||||
// 出现异常点
|
||||
if (errCount >= ERR_COUNT_THRESHOLD) {
|
||||
// 出错次数超过阈值,认为本次出错点为正确点
|
||||
if(recordLocation()) {
|
||||
errList.add(new CloudLocationInfo(lastLocation));
|
||||
correctList.add(info);
|
||||
}
|
||||
lastLocation = info;
|
||||
anchorTime = SystemClock.elapsedRealtime();
|
||||
errCount = 0;
|
||||
Logger.d(TAG, "出错次数超限,异常点变有效点");
|
||||
return info;
|
||||
} else {
|
||||
// 按照上一个点的方向和速度,计算下一个点的位置,下一个点除坐标点外,其余数据与上一个点相同
|
||||
CloudLocationInfo nextInfo = new CloudLocationInfo(lastLocation);
|
||||
MogoLatLng nextLatLon = computerThatLonLat(lastLocation.getLon(),
|
||||
lastLocation.getLat(), lastLocation.getHeading(), targetDistance);
|
||||
nextInfo.setLon(nextLatLon.lon);
|
||||
nextInfo.setLat(nextLatLon.lat);
|
||||
if(recordLocation()) {
|
||||
errList.add(info);
|
||||
correctList.add(nextInfo);
|
||||
}
|
||||
lastLocation = nextInfo;
|
||||
anchorTime = SystemClock.elapsedRealtime();
|
||||
errCount++;
|
||||
Logger.d(TAG, "异常点纠偏 info: " + lastLocation);
|
||||
// return lastLocation;
|
||||
if(recordLocation()) {
|
||||
correctList.add(nextInfo);
|
||||
}
|
||||
return nextInfo;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "纠偏异常");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else{
|
||||
Logger.d(TAG, "定位点异常");
|
||||
if (lastLocation == null) {
|
||||
return null;
|
||||
}else{
|
||||
try {
|
||||
float targetDistance =
|
||||
(float) (lastLocation.getSpeed() * (SystemClock.elapsedRealtime() - anchorTime) / 1000) + TARGET_DISTANCE_DEVIATION;
|
||||
float distance = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().calculateLineDistance(LocationParseUtil.cloudLocationToMogoLatLng(lastLocation), LocationParseUtil.cloudLocationToMogoLatLng(info));
|
||||
Logger.d(TAG,
|
||||
"异常定位点\n准备计算{ lastInfo: " + lastLocation.print() + " info: " + info.print() + " targetDistance: " + targetDistance + " distance : " + distance + "}");
|
||||
// 按照上一个点的方向和速度,计算下一个点的位置,下一个点除坐标点外,其余数据与上一个点相同
|
||||
CloudLocationInfo nextInfo = new CloudLocationInfo(lastLocation);
|
||||
MogoLatLng nextLatLon = computerThatLonLat(lastLocation.getLon(),
|
||||
lastLocation.getLat(), lastLocation.getHeading(), targetDistance);
|
||||
nextInfo.setLon(nextLatLon.lon);
|
||||
nextInfo.setLat(nextLatLon.lat);
|
||||
if(recordLocation()) {
|
||||
errList.add(info);
|
||||
correctList.add(nextInfo);
|
||||
}
|
||||
lastLocation = nextInfo;
|
||||
anchorTime = SystemClock.elapsedRealtime();
|
||||
errCount++;
|
||||
Logger.d(TAG, "异常点纠偏 info: " + lastLocation);
|
||||
if(recordLocation()) {
|
||||
correctList.add(nextInfo);
|
||||
}
|
||||
// return lastLocation;
|
||||
return nextInfo;
|
||||
}catch (Exception e){
|
||||
Logger.e(TAG, e, "纠偏异常");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isLocationValid(CloudLocationInfo info) {
|
||||
return info.getLat() != 0 && info.getLon() != 0;
|
||||
}
|
||||
|
||||
private RecordLocationListener recordLocationListener = null;
|
||||
private boolean hasCallbackRecord = false;
|
||||
|
||||
public void setRecordLocationListener(RecordLocationListener recordLocationListener) {
|
||||
this.recordLocationListener = recordLocationListener;
|
||||
}
|
||||
|
||||
private boolean recordLocation(){
|
||||
if (historyList.size() >= 100 && !hasCallbackRecord && recordLocationListener != null) {
|
||||
hasCallbackRecord = true;
|
||||
recordLocationListener.onRecordFinish(historyList, correctList,validList,correctList);
|
||||
}
|
||||
return historyList.size() < 100;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据距离和角度计算下一个经纬度
|
||||
* 大地坐标系资料WGS-84 长半径a=6378137 短半径b=6356752.3142 扁率f=1/298.2572236
|
||||
*/
|
||||
public MogoLatLng computerThatLonLat(double lon, double lat, double brng, double dist) {
|
||||
|
||||
double alpha1 = rad(brng);
|
||||
double sinAlpha1 = Math.sin(alpha1);
|
||||
double cosAlpha1 = Math.cos(alpha1);
|
||||
|
||||
// 扁率f=1/298.2572236
|
||||
double f = 1 / 298.2572236;
|
||||
double tanU1 = (1 - f) * Math.tan(rad(lat));
|
||||
double cosU1 = 1 / Math.sqrt((1 + tanU1 * tanU1));
|
||||
double sinU1 = tanU1 * cosU1;
|
||||
double sigma1 = Math.atan2(tanU1, cosAlpha1);
|
||||
double sinAlpha = cosU1 * sinAlpha1;
|
||||
double cosSqAlpha = 1 - sinAlpha * sinAlpha;
|
||||
// 长半径a=6378137
|
||||
double a = 6378137;
|
||||
// 短半径b=6356752.3142
|
||||
double b = 6356752.3142;
|
||||
double uSq = cosSqAlpha * (a * a - b * b) / (b * b);
|
||||
double A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)));
|
||||
double B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)));
|
||||
|
||||
double cos2SigmaM=0;
|
||||
double sinSigma=0;
|
||||
double cosSigma=0;
|
||||
double sigma = dist / (b * A), sigmaP = 2 * Math.PI;
|
||||
while (Math.abs(sigma - sigmaP) > 1e-12) {
|
||||
cos2SigmaM = Math.cos(2 * sigma1 + sigma);
|
||||
sinSigma = Math.sin(sigma);
|
||||
cosSigma = Math.cos(sigma);
|
||||
double deltaSigma = B * sinSigma * (cos2SigmaM + B / 4 * (cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM)
|
||||
- B / 6 * cos2SigmaM * (-3 + 4 * sinSigma * sinSigma) * (-3 + 4 * cos2SigmaM * cos2SigmaM)));
|
||||
sigmaP = sigma;
|
||||
sigma = dist / (b * A) + deltaSigma;
|
||||
}
|
||||
|
||||
double tmp = sinU1 * sinSigma - cosU1 * cosSigma * cosAlpha1;
|
||||
double lat2 = Math.atan2(sinU1 * cosSigma + cosU1 * sinSigma * cosAlpha1,
|
||||
(1 - f) * Math.sqrt(sinAlpha * sinAlpha + tmp * tmp));
|
||||
double lambda = Math.atan2(sinSigma * sinAlpha1, cosU1 * cosSigma - sinU1 * sinSigma * cosAlpha1);
|
||||
double C = f / 16 * cosSqAlpha * (4 + f * (4 - 3 * cosSqAlpha));
|
||||
double L = lambda - (1 - C) * f * sinAlpha
|
||||
* (sigma + C * sinSigma * (cos2SigmaM + C * cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM)));
|
||||
|
||||
// final bearing
|
||||
double revAz = Math.atan2(sinAlpha, -tmp);
|
||||
|
||||
System.out.println(revAz);
|
||||
System.out.println(lon+deg(L)+","+deg(lat2));
|
||||
return new MogoLatLng(deg(lat2), lon + deg(L));
|
||||
}
|
||||
|
||||
/**
|
||||
* 度换成弧度
|
||||
*
|
||||
* @param d
|
||||
* 度
|
||||
* @return 弧度
|
||||
*/
|
||||
private double rad(double d) {
|
||||
return d * Math.PI / 180.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 弧度换成度
|
||||
*
|
||||
* @param x
|
||||
* 弧度
|
||||
* @return 度
|
||||
*/
|
||||
private double deg(double x) {
|
||||
return x * 180 / Math.PI;
|
||||
}
|
||||
|
||||
public interface RecordLocationListener{
|
||||
void onRecordFinish(List<CloudLocationInfo> history, List<CloudLocationInfo> correct,List<CloudLocationInfo> valid,List<CloudLocationInfo> err);
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package com.mogo.module.service.vrmode;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.IBinder;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/10/27
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class VrModeController {
|
||||
|
||||
private static final String TAG = "VrModeController";
|
||||
|
||||
private static volatile VrModeController sInstance;
|
||||
private ServiceConnection mServiceConnection;
|
||||
|
||||
private VrModeController() {
|
||||
}
|
||||
|
||||
public static VrModeController getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( VrModeController.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new VrModeController();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private boolean mIsBinding = false;
|
||||
|
||||
public void onVrModeChanged( boolean isVrMode ) {
|
||||
if ( isVrMode ) {
|
||||
bindVrModeService();
|
||||
} else {
|
||||
unbindVrModeService();
|
||||
}
|
||||
}
|
||||
|
||||
private void bindVrModeService() {
|
||||
if ( mIsBinding ) {
|
||||
return;
|
||||
}
|
||||
mIsBinding = true;
|
||||
Intent intent = new Intent();
|
||||
intent.setComponent( new ComponentName( "com.mogo.launcher.f", "com.mogo.module.machine.vision.MachineVisionMapService" ) );
|
||||
AbsMogoApplication.getApp().bindService( intent, mServiceConnection = new ServiceConnection() {
|
||||
@Override
|
||||
public void onServiceConnected( ComponentName name, IBinder service ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected( ComponentName name ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindingDied( ComponentName name ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNullBinding( ComponentName name ) {
|
||||
}
|
||||
}, Context.BIND_AUTO_CREATE );
|
||||
}
|
||||
|
||||
private void unbindVrModeService() {
|
||||
mIsBinding = false;
|
||||
if ( mServiceConnection != null ) {
|
||||
try {
|
||||
AbsMogoApplication.getApp().unbindService( mServiceConnection );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "unbindVrModeService" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onMainPageResumeStatusChanged( boolean isResume ) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user