Merge branch 'qa_hengyang_base' into feature/feature_hengyang_base
# Conflicts: # .idea/runConfigurations.xml
This commit is contained in:
1
.idea/runConfigurations.xml
generated
1
.idea/runConfigurations.xml
generated
@@ -3,7 +3,6 @@
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.mogo.och.taxi.ui.OCHTaxiUiController;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.service.adas.entity.AdasOCHData;
|
||||
import com.mogo.service.connection.IMogoLifecycleListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
@@ -28,8 +29,11 @@ import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public
|
||||
@@ -75,6 +79,7 @@ class MogoOCHTaxiModel {
|
||||
private Context mContext;
|
||||
private OCHTaxiOrderResponse mCurrentOCHOrder;
|
||||
private OCHArriveNotifyCallback mNotifyCallback;
|
||||
private OCHSocketLifeCycleLisnter mSocketLifeCycleLisnter;
|
||||
private IMogoCarLocationChangedListener2 mCarLocationChangedListener2;
|
||||
/**
|
||||
* 是否达到起始站点
|
||||
@@ -122,6 +127,10 @@ class MogoOCHTaxiModel {
|
||||
.getApis()
|
||||
.getSocketManagerApi( context )
|
||||
.registerOnMessageListener( 401019, mOrderStatusMsgListener = new OrderStatusMsgListener() );
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi(context)
|
||||
.registerLifecycleListener(10010,mSocketLifeCycleLisnter = new OCHSocketLifeCycleLisnter());
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getAdasControllerApi()
|
||||
@@ -149,6 +158,7 @@ class MogoOCHTaxiModel {
|
||||
Logger.e(TAG,"querryCarStatus:"+data.data.status);
|
||||
|
||||
mOCHRHCarstatus = data.data.status == 1 ? 1:0;
|
||||
|
||||
//更新view
|
||||
OCHTaxiUiController.getInstance().onOperationChanged(mOCHRHCarstatus==1);
|
||||
//刷新数据
|
||||
@@ -182,40 +192,9 @@ class MogoOCHTaxiModel {
|
||||
private void restoreOrderInfo() {
|
||||
Logger.d( TAG, "重新查询订单状态" );
|
||||
mRetryCounter = 0;
|
||||
// if ( mCurrentOCHOrder == null ) {
|
||||
// // 订单恢复
|
||||
// String orderInfo = SharedPrefsMgr.getInstance( mContext ).getString( SP_KEY_OCH_TAXI_ORDER );
|
||||
// Logger.d(TAG,"restoreOrderInfo:"+orderInfo);
|
||||
// if ( !TextUtils.isEmpty( orderInfo ) ) {
|
||||
// mCurrentOCHOrder = GsonUtil.objectFromJson( orderInfo, OCHTaxiOrderResponse.class );
|
||||
// }
|
||||
// }
|
||||
// query2RestoreOrderStatus(mCurrentOCHOrder == null ? null : mCurrentOCHOrder.orderNo);
|
||||
query2RestoreOrderStatus(null);
|
||||
}
|
||||
|
||||
// private void restoreOrderInfo_() {
|
||||
// Logger.d( TAG, "重新查询订单状态" );
|
||||
// mRetryCounter = 0;
|
||||
// if ( mCurrentOCHOrder == null ) {
|
||||
// // 订单恢复
|
||||
// String orderInfo = SharedPrefsMgr.getInstance( mContext ).getString( SP_KEY_OCH_TAXI_ORDER );
|
||||
// if ( !TextUtils.isEmpty( orderInfo ) ) {
|
||||
// mCurrentOCHOrder = GsonUtil.objectFromJson( orderInfo, OCHTaxiOrderResponse.class );
|
||||
// if ( mCurrentOCHOrder == null ) {
|
||||
// // 解决本地没有缓存订单号的问题
|
||||
// query2RestoreOrderStatus( null );
|
||||
// } else {
|
||||
// query2RestoreOrderStatus( mCurrentOCHOrder.orderNo );
|
||||
// }
|
||||
// } else {
|
||||
// // 解决本地没有缓存订单号的问题
|
||||
// query2RestoreOrderStatus( null );
|
||||
// }
|
||||
// } else {
|
||||
// query2RestoreOrderStatus( mCurrentOCHOrder.orderNo );
|
||||
// }
|
||||
// }
|
||||
/**
|
||||
* 查询订单状态,来恢复旧订单(因crash导致应用重启、断网没收到推送等)状态
|
||||
* <p>
|
||||
@@ -309,6 +288,58 @@ class MogoOCHTaxiModel {
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于长连接
|
||||
* @param orderNo
|
||||
*/
|
||||
private void querryOrderStatusForMakeUp( String orderNo ) {
|
||||
Logger.e(TAG,"querryOrderStatusForMakeUp:"+orderNo);
|
||||
queryOCHOrderStatus( orderNo, new OCHOrderStatusCallback< OCHTaxiOrderResponse2 >() {
|
||||
@Override
|
||||
public void onSuccess( OCHTaxiOrderResponse2 data ) {
|
||||
Logger.d( TAG, "querryOrderStatusForMakeUp:"+ data.toString());
|
||||
if ( data == null || data.data == null) {
|
||||
Logger.d( TAG, "订单已取消或已完成" );
|
||||
clearCurrentOCHOrder();
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(OCHOrderStatus.None.getCode());
|
||||
return;
|
||||
}
|
||||
convertCurrentOrder( data );
|
||||
OCHOrderStatus status = OCHOrderStatus.valueOf( data.data.orderDispatchType );
|
||||
switch ( status ) {
|
||||
case JourneyCompleted:
|
||||
TipToast.shortTip( mContext.getString( R.string.module_och_taxi_order_completed ) );
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(data.data.orderDispatchType);
|
||||
clearCurrentOCHOrder();
|
||||
break;
|
||||
case Cancel:
|
||||
TipToast.shortTip( mContext.getString( R.string.module_och_taxi_order_cancel ) );
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(data.data.orderDispatchType);
|
||||
clearCurrentOCHOrder();
|
||||
break;
|
||||
case OnTheWayToStartStation:
|
||||
default:
|
||||
mIsArriveAtStartStation = false;
|
||||
mIsArriveAtEndStation = false;
|
||||
mIsOnTheWay2EndStation = false;
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(data.data.orderDispatchType);
|
||||
mOrderMsgListener.onMsgReceived( mCurrentOCHOrder );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
Logger.w( TAG, "查询订单失败" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 将查询到的订单转换成推送的订单数据,目前两者数据结构不一样
|
||||
*
|
||||
@@ -394,8 +425,6 @@ class MogoOCHTaxiModel {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG,"OCHCarStatusResponse:"+o.data.status);
|
||||
mOCHRHCarstatus = o.data.status;
|
||||
// mIsWork = mOCHRHCarstatus.status == 1;
|
||||
// mOCHRHCarstatus.status = status;
|
||||
OCHTaxiUiController.getInstance().onOperationChanged(mOCHRHCarstatus == 1);
|
||||
updateData(mOCHRHCarstatus);
|
||||
Logger.d(TAG,"changeCarStatus:"+status);
|
||||
@@ -514,14 +543,6 @@ class MogoOCHTaxiModel {
|
||||
return mIsArriveAtEndStation;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 用户是否达到上车站点
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// public boolean isUserArriveAtStartStation() {
|
||||
// return mIsUserArriveAtStartStation;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 设置去往终点状态
|
||||
@@ -572,7 +593,6 @@ class MogoOCHTaxiModel {
|
||||
if ( !isArriveAtStartStation() ) {
|
||||
registerCarLocationListener();
|
||||
}
|
||||
// OCHTaxiUiController.getInstance().addFragment();
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(mCurrentOCHOrder.orderDispatchType);
|
||||
}
|
||||
}
|
||||
@@ -613,6 +633,13 @@ class MogoOCHTaxiModel {
|
||||
.unregisterCarLocationChangedListener( TAG, mCarLocationChangedListener2 );
|
||||
}
|
||||
|
||||
public void unregisterSocketListener(){
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi(mContext)
|
||||
.unregisterLifecycleListener(10010);
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端长链推送通知订单状态被改变
|
||||
*/
|
||||
@@ -637,12 +664,10 @@ class MogoOCHTaxiModel {
|
||||
switch ( status ) {
|
||||
case Cancel:
|
||||
clearCurrentOCHOrder();
|
||||
// OCHTaxiUiController.getInstance().removeFragment();
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(status.getCode());
|
||||
break;
|
||||
case UserArriveAtStartStation:
|
||||
mIsArriveAtStartStation = true;
|
||||
// mIsUserArriveAtStartStation = true;
|
||||
OCHTaxiUiController.getInstance().onUserArriveAtStartStation();
|
||||
break;
|
||||
default:
|
||||
@@ -652,6 +677,38 @@ class MogoOCHTaxiModel {
|
||||
}
|
||||
}
|
||||
|
||||
private class OCHSocketLifeCycleLisnter implements IMogoLifecycleListener {
|
||||
|
||||
@Override
|
||||
public void onConnectFailure() {
|
||||
Logger.e(TAG,"socket onConnectFailure");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectSuccess() {
|
||||
Logger.e(TAG,"socket onConnectSuccess");
|
||||
stopSocketMakeUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectLost() {
|
||||
Logger.e(TAG,"socket onConnectLost");
|
||||
startSocketMakeUp();
|
||||
}
|
||||
}
|
||||
|
||||
public void startSocketMakeUp(){
|
||||
if (mOCHRHCarstatus == 1){
|
||||
timeLoop();
|
||||
}
|
||||
}
|
||||
|
||||
public void stopSocketMakeUp(){
|
||||
if (mDisposable != null){
|
||||
mDisposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶本地通知订单到站
|
||||
*/
|
||||
@@ -841,4 +898,18 @@ class MogoOCHTaxiModel {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static final int PERIOD = 1 * 1000;
|
||||
private static final int DELAY = 100;
|
||||
private Disposable mDisposable;
|
||||
/**
|
||||
* 定时循环任务
|
||||
*/
|
||||
private void timeLoop() {
|
||||
mDisposable = Observable.interval(DELAY, PERIOD, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> querryOrderStatusForMakeUp(null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
private TextView mDistance;
|
||||
|
||||
private MogoPolylineOptions mogoPolylineOptions;
|
||||
private int saveOrderState = -1;
|
||||
private volatile int saveOrderState = -1;
|
||||
@Override
|
||||
public int getStationPanelViewId() {
|
||||
return R.layout.module_och_taxi_panel;
|
||||
@@ -279,6 +279,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
.getRegisterCenterApi()
|
||||
.unregisterCarLocationChangedListener( TAG, this );
|
||||
MogoOCHTaxiModel.getInstance().unregisterCarLocationListener();
|
||||
MogoOCHTaxiModel.getInstance().unregisterSocketListener();
|
||||
mLocation = null;
|
||||
}
|
||||
|
||||
@@ -320,7 +321,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
public void onAutoPilotStatusChanged( int status, String reason ) {
|
||||
Logger.d( TAG, "status = %s, reason = %s", status, reason );
|
||||
onAutopilotStatusChanged( status == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING );
|
||||
if ( status == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING ) {
|
||||
if ( status == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING && !MogoOCHTaxiModel.getInstance().isArriveAtEndStation()) {
|
||||
resetOCHTaxiOrderAutopilotStatus();
|
||||
} else {
|
||||
updateOrderStatus();
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
android:id="@+id/module_och_taxi_layoutview"
|
||||
android:layout_width="@dimen/module_mogo_och_autopilot_order_bg_width"
|
||||
android:layout_height="@dimen/module_mogo_och_autopilot_order_bg_height"
|
||||
android:minHeight="@dimen/module_mogo_och_autopilot_order_bg_height"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
@@ -63,13 +62,10 @@
|
||||
android:layout_marginLeft="@dimen/module_och_taxi_order_start_station_marginLeft"
|
||||
android:textColor="@color/module_och_order_status_textColor"
|
||||
android:textSize="@dimen/module_och_taxi_order_start_station_textSize"
|
||||
android:ellipsize="end"
|
||||
android:maxWidth="252px"
|
||||
android:lines="2"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toRightOf="@+id/greenDot"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="后路站后路站后路站后路站后路站" />
|
||||
tools:text="后路站" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_taxi_order_start_station_anchor"
|
||||
@@ -111,9 +107,6 @@
|
||||
android:textColor="@color/module_och_order_status_textColor"
|
||||
android:textSize="@dimen/module_och_taxi_order_start_station_textSize"
|
||||
android:textStyle="bold"
|
||||
android:ellipsize="end"
|
||||
android:maxWidth="252px"
|
||||
android:lines="2"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_och_taxi_order_start_station"
|
||||
app:layout_constraintLeft_toRightOf="@+id/greenDot"
|
||||
@@ -135,112 +128,6 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:id="@+id/module_och_taxi_order_status_stationInfo"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:orientation="vertical"-->
|
||||
<!-- android:paddingLeft="@dimen/module_och_taxi_order_status_stationInfo_paddingLeft"-->
|
||||
<!-- android:paddingTop="@dimen/module_och_taxi_order_status_stationInfo_paddingTop"-->
|
||||
<!-- android:paddingRight="@dimen/module_och_taxi_order_status_stationInfo_paddingRight"-->
|
||||
<!-- android:paddingBottom="@dimen/module_och_taxi_order_status_stationInfo_paddingBottom"-->
|
||||
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/module_och_taxi_order_status_divider">-->
|
||||
<!-- >-->
|
||||
<!-- <RelativeLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:orientation="horizontal">-->
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/greenDot"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:src="@drawable/module_mogo_och_icon_arriving_station"-->
|
||||
<!-- android:layout_centerVertical="true"-->
|
||||
<!-- />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/module_och_taxi_order_start_station"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginLeft="@dimen/module_och_taxi_order_start_station_marginLeft"-->
|
||||
<!-- android:textColor="@color/module_och_order_status_textColor"-->
|
||||
<!-- android:textSize="@dimen/module_och_taxi_order_start_station_textSize"-->
|
||||
<!-- android:ellipsize="end"-->
|
||||
<!-- android:maxWidth="252px"-->
|
||||
<!-- android:lines="2"-->
|
||||
<!-- android:textStyle="bold"-->
|
||||
<!-- android:layout_toRightOf="@id/greenDot"-->
|
||||
<!-- tools:text="后路站后路站后路站后路站后路站" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/module_och_taxi_order_start_station_anchor"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:text="上车"-->
|
||||
<!-- android:textColor="@color/module_och_taxi_order_start_station_anchor_textColor"-->
|
||||
<!-- android:layout_marginRight="@dimen/module_och_taxi_order_text_marginRight"-->
|
||||
<!-- android:textSize="@dimen/module_och_taxi_order_start_station_anchor_textSize"-->
|
||||
<!-- android:textStyle="bold"-->
|
||||
<!-- android:layout_alignParentRight="true"-->
|
||||
<!-- android:layout_centerVertical="true"-->
|
||||
<!-- />-->
|
||||
<!-- </RelativeLayout>-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/dotLine"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="0dp"-->
|
||||
<!-- android:scaleType="fitXY"-->
|
||||
<!-- android:src="@drawable/module_och_dot_line"-->
|
||||
<!-- app:layout_constraintBottom_toTopOf="@+id/blueDot"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="@+id/greenDot"-->
|
||||
<!-- app:layout_constraintRight_toRightOf="@+id/greenDot"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/greenDot" />-->
|
||||
|
||||
<!-- <RelativeLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:orientation="horizontal">-->
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/blueDot"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:src="@drawable/module_mogo_och_icon_arrived_station"-->
|
||||
<!-- android:layout_centerVertical="true"-->
|
||||
<!-- />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/module_och_taxi_order_end_station"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginLeft="@dimen/module_och_taxi_order_start_station_marginLeft"-->
|
||||
<!-- android:textColor="@color/module_och_order_status_textColor"-->
|
||||
<!-- android:textSize="@dimen/module_och_taxi_order_start_station_textSize"-->
|
||||
<!-- android:textStyle="bold"-->
|
||||
<!-- android:ellipsize="end"-->
|
||||
<!-- android:maxWidth="252px"-->
|
||||
<!-- android:lines="2"-->
|
||||
<!-- android:layout_toRightOf="@id/blueDot"-->
|
||||
<!-- tools:text="后路站后路站后路站后路站后路站" />-->
|
||||
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/module_och_taxi_order_end_station_anchor"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:text="下车"-->
|
||||
<!-- android:layout_marginRight="@dimen/module_och_taxi_order_text_marginRight"-->
|
||||
<!-- android:textColor="@color/module_och_taxi_order_end_station_anchor_textColor"-->
|
||||
<!-- android:textSize="@dimen/module_och_taxi_order_end_station_anchor_textSize"-->
|
||||
<!-- android:textStyle="bold"-->
|
||||
<!-- android:layout_centerVertical="true"-->
|
||||
<!-- android:layout_alignParentRight="true"-->
|
||||
<!-- />-->
|
||||
<!-- </RelativeLayout>-->
|
||||
|
||||
<!-- </LinearLayout>-->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_och_taxi_order_distance_container"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -319,18 +319,6 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
// }
|
||||
ARouter.getInstance().navigation(ITestCrashReportProvider.class);
|
||||
Log.i("timer", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
|
||||
try {
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_LENOVO) {
|
||||
Intent intent = new Intent();
|
||||
intent.setComponent(new ComponentName("com.zhidao.speech.voice.pad",
|
||||
"com.zhidao.speech.MainActivity"));
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,13 +4,13 @@ apply from: "javadoc.gradle"
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
|
||||
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
|
||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
maven { url 'https://maven.aliyun.com/repository/google' }
|
||||
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
|
||||
maven { url 'https://maven.aliyun.com/repository/jcenter' }
|
||||
maven { url 'http://nexus.zhidaoauto.com/repository/maven-releases/' }
|
||||
maven { url 'http://nexus.zhidaoauto.com/repository/maven-public/' }
|
||||
maven { url 'https://nexus.zhidaoauto.com/repository/maven-releases/' }
|
||||
maven { url 'https://nexus.zhidaoauto.com/repository/maven-public/' }
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
|
||||
@@ -8,11 +8,13 @@ import com.mogo.cloud.socket.IMogoCloudSocketMsgAckListener;
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
|
||||
import com.mogo.cloud.socket.SocketManager;
|
||||
import com.mogo.cloud.socket.entity.MsgBody;
|
||||
import com.mogo.service.connection.IMogoLifecycleListener;
|
||||
import com.mogo.service.connection.IMogoMsgAckListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.ptech.connsvr.commom.protocol.MogoCommon;
|
||||
import com.zhidao.socket.ConnectionLifecycleListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -26,7 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* 长链实现:基于 netty
|
||||
*/
|
||||
@Keep
|
||||
public class MogoAiCloudSocketManager implements IMogoSocketManager {
|
||||
public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implements IMogoSocketManager {
|
||||
|
||||
private static final String TAG = "MogoAiCloudSocketManager-apk";
|
||||
|
||||
@@ -54,6 +56,7 @@ public class MogoAiCloudSocketManager implements IMogoSocketManager {
|
||||
* key - msgType
|
||||
*/
|
||||
private final Map<Integer, List<IMogoOnMessageListener>> mListeners = new ConcurrentHashMap<>();
|
||||
private final Map<Integer, IMogoLifecycleListener> mLifeCycleListeners = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 管理消息回执
|
||||
@@ -66,6 +69,7 @@ public class MogoAiCloudSocketManager implements IMogoSocketManager {
|
||||
public void init(Context context, String appId) {
|
||||
this.mAppId = appId;
|
||||
SocketManager.getInstance().init(context);
|
||||
SocketManager.getInstance().registerSocketConnCallback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,6 +105,24 @@ public class MogoAiCloudSocketManager implements IMogoSocketManager {
|
||||
SocketManager.getInstance().unregisterOnMessageListener(msgType, mogoCloudSocketOnMessageListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerLifecycleListener(int msgType, IMogoLifecycleListener listener) {
|
||||
if (mLifeCycleListeners.containsKey(msgType)) {
|
||||
return;
|
||||
}
|
||||
if (!mLifeCycleListeners.containsKey(msgType)) {
|
||||
mLifeCycleListeners.put(msgType, listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterLifecycleListener(int msgType) {
|
||||
if (!mLifeCycleListeners.containsKey(msgType)) {
|
||||
return;
|
||||
}
|
||||
mLifeCycleListeners.remove(msgType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg(MsgBody body, IMogoMsgAckListener listener) {
|
||||
Logger.d(TAG, "sendMsg.");
|
||||
@@ -150,4 +172,37 @@ public class MogoAiCloudSocketManager implements IMogoSocketManager {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onConnectSuccess() {
|
||||
if (mLifeCycleListeners.size() > 0){
|
||||
for (IMogoLifecycleListener lifecycleListener : mLifeCycleListeners.values()){
|
||||
if (lifecycleListener != null){
|
||||
lifecycleListener.onConnectSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectFailure() {
|
||||
if (mLifeCycleListeners.size() > 0){
|
||||
for (IMogoLifecycleListener lifecycleListener : mLifeCycleListeners.values()){
|
||||
if (lifecycleListener != null){
|
||||
lifecycleListener.onConnectFailure();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectLost(boolean reconnect) {
|
||||
if (mLifeCycleListeners.size() > 0){
|
||||
for (IMogoLifecycleListener lifecycleListener : mLifeCycleListeners.values()){
|
||||
if (lifecycleListener != null){
|
||||
lifecycleListener.onConnectLost();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,13 @@ import com.mogo.cloud.socket.IMogoCloudSocketMsgAckListener;
|
||||
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
|
||||
import com.mogo.cloud.socket.SocketManager;
|
||||
import com.mogo.cloud.socket.entity.MsgBody;
|
||||
import com.mogo.service.connection.IMogoLifecycleListener;
|
||||
import com.mogo.service.connection.IMogoMsgAckListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.ptech.connsvr.commom.protocol.MogoCommon;
|
||||
import com.zhidao.socket.ConnectionLifecycleListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -26,7 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* 长链实现:基于 netty
|
||||
*/
|
||||
@Keep
|
||||
public class MogoAiCloudSocketManager implements IMogoSocketManager {
|
||||
public class MogoAiCloudSocketManager extends ConnectionLifecycleListener implements IMogoSocketManager {
|
||||
|
||||
private static final String TAG = "MogoAiCloudSocketManager-sdk";
|
||||
|
||||
@@ -54,6 +56,7 @@ public class MogoAiCloudSocketManager implements IMogoSocketManager {
|
||||
* key - msgType
|
||||
*/
|
||||
private final Map<Integer, List<IMogoOnMessageListener>> mListeners = new ConcurrentHashMap<>();
|
||||
private final Map<Integer, IMogoLifecycleListener> mLifeCycleListeners = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 管理消息回执
|
||||
@@ -66,6 +69,7 @@ public class MogoAiCloudSocketManager implements IMogoSocketManager {
|
||||
public void init(Context context, String appId) {
|
||||
this.mAppId = appId;
|
||||
SocketManager.getInstance().init(context);
|
||||
SocketManager.getInstance().registerSocketConnCallback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,6 +105,24 @@ public class MogoAiCloudSocketManager implements IMogoSocketManager {
|
||||
SocketManager.getInstance().unregisterOnMessageListener(msgType, mogoCloudSocketOnMessageListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerLifecycleListener(int msgType, IMogoLifecycleListener listener) {
|
||||
if (mLifeCycleListeners.containsKey(msgType)) {
|
||||
return;
|
||||
}
|
||||
if (!mLifeCycleListeners.containsKey(msgType)) {
|
||||
mLifeCycleListeners.put(msgType, listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterLifecycleListener(int msgType) {
|
||||
if (!mLifeCycleListeners.containsKey(msgType)) {
|
||||
return;
|
||||
}
|
||||
mLifeCycleListeners.remove(msgType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg(MsgBody body, IMogoMsgAckListener listener) {
|
||||
Logger.d(TAG, "sendMsg.");
|
||||
@@ -150,4 +172,37 @@ public class MogoAiCloudSocketManager implements IMogoSocketManager {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onConnectSuccess() {
|
||||
if (mLifeCycleListeners.size() > 0){
|
||||
for (IMogoLifecycleListener lifecycleListener : mLifeCycleListeners.values()){
|
||||
if (lifecycleListener != null){
|
||||
lifecycleListener.onConnectSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectFailure() {
|
||||
if (mLifeCycleListeners.size() > 0){
|
||||
for (IMogoLifecycleListener lifecycleListener : mLifeCycleListeners.values()){
|
||||
if (lifecycleListener != null){
|
||||
lifecycleListener.onConnectFailure();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectLost(boolean reconnect) {
|
||||
if (mLifeCycleListeners.size() > 0){
|
||||
for (IMogoLifecycleListener lifecycleListener : mLifeCycleListeners.values()){
|
||||
if (lifecycleListener != null){
|
||||
lifecycleListener.onConnectLost();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
@@ -18,6 +19,8 @@ import androidx.appcompat.app.AppCompatDelegate;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.skin.support.MogoSkinManager;
|
||||
import com.mogo.utils.SoftKeyBoardJobber;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.permissions.PermissionsDialogUtils;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -28,6 +31,8 @@ import com.mogo.utils.SoftKeyBoardJobber;
|
||||
public abstract class MvpActivity< V extends IView, P extends Presenter< V > >
|
||||
extends AppCompatActivity implements IView {
|
||||
|
||||
protected static final String TAG = "MvpActivity";
|
||||
|
||||
protected P mPresenter;
|
||||
|
||||
@Override
|
||||
@@ -42,23 +47,32 @@ public abstract class MvpActivity< V extends IView, P extends Presenter< V > >
|
||||
initViews();
|
||||
mPresenter = createPresenter();
|
||||
getLifecycle().addObserver( mPresenter );
|
||||
//申请悬浮窗权限
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
// 检查是否有悬浮窗权限
|
||||
if (Settings.canDrawOverlays(this)) {
|
||||
startVoicePad();
|
||||
}
|
||||
} else {
|
||||
startVoicePad();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
hideBottomUIMenu();
|
||||
startVoicePad();
|
||||
}
|
||||
|
||||
/**
|
||||
* 在Pad上拉起语音
|
||||
*/
|
||||
private void startVoicePad() {
|
||||
public void startVoicePad() {
|
||||
try {
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_LENOVO) {
|
||||
Logger.d(TAG, "启动小智语音");
|
||||
Intent intent = new Intent();
|
||||
intent.setComponent(new ComponentName("com.zhidao.speech.voice.pad",
|
||||
intent.setComponent(new ComponentName("com.zhidao.speech",
|
||||
"com.zhidao.speech.MainActivity"));
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.mogo.utils.permissions;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/7/22 4:57 下午
|
||||
*/
|
||||
public class PermissionsDialogUtils {
|
||||
|
||||
public static AlertDialog mAlertDialog;
|
||||
|
||||
|
||||
/**
|
||||
* 打开APP的详情设置
|
||||
*/
|
||||
public static void openAppDetails(Activity activity, String msg, int CODE_WINDOW) {
|
||||
if (mAlertDialog == null || !mAlertDialog.isShowing()) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
if (TextUtils.isEmpty(msg)) {
|
||||
builder.setMessage("请在 “应用信息 -> 权限” 中授予权限");
|
||||
} else {
|
||||
builder.setMessage("请在 “应用信息 -> 权限” 中授予【" + msg + "】权限");
|
||||
}
|
||||
builder.setPositiveButton("手动授权", (dialog, which) -> {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
intent.setData(Uri.parse("package:" + activity.getPackageName()));
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
|
||||
activity.startActivityForResult(intent, CODE_WINDOW);
|
||||
});
|
||||
builder.setCancelable(false);
|
||||
mAlertDialog = builder.show();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转浮层权限获取页面
|
||||
*
|
||||
* @param activity
|
||||
* @param CODE_WINDOW
|
||||
*/
|
||||
public static void openOverlayPermission(Activity activity, int CODE_WINDOW) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
activity.startActivityForResult(new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
||||
Uri.parse("package:" + activity.getPackageName())), CODE_WINDOW);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -159,21 +159,21 @@ LOGLIB_VERSION = 1.0.4
|
||||
|
||||
######## MogoAiCloudSDK Version
|
||||
# 网络请求
|
||||
MOGO_NETWORK_VERSION=1.1.21
|
||||
MOGO_NETWORK_VERSION=1.1.27
|
||||
# 鉴权
|
||||
MOGO_PASSPORT_VERSION=1.1.21
|
||||
MOGO_PASSPORT_VERSION=1.1.27
|
||||
# 常链接
|
||||
MOGO_SOCKET_VERSION=1.1.21
|
||||
MOGO_SOCKET_VERSION=1.1.27
|
||||
# 数据采集
|
||||
MOGO_REALTIME_VERSION=1.1.21
|
||||
MOGO_REALTIME_VERSION=1.1.27
|
||||
# 探路,道路事件发布,获取
|
||||
MOGO_TANLU_VERSION=1.1.21
|
||||
MOGO_TANLU_VERSION=1.1.27
|
||||
# 直播推流
|
||||
MOGO_LIVE_VERSION=1.1.21
|
||||
MOGO_LIVE_VERSION=1.1.27
|
||||
# 直播拉流
|
||||
MOGO_TRAFFICLIVE_VERSION=1.1.21
|
||||
MOGO_TRAFFICLIVE_VERSION=1.1.27
|
||||
# 定位服务
|
||||
MOGO_LOCATION_VERSION=1.1.21
|
||||
MOGO_LOCATION_VERSION=1.1.27
|
||||
|
||||
|
||||
######## Foundation MogoAiCloud Module
|
||||
@@ -182,7 +182,7 @@ MOGO_AICLOUD_SERVICES_APK_VERSION=1.0.0-SNAPSHOT
|
||||
# mogoAiCloud sdk services
|
||||
MOGO_AICLOUD_SERVICES_SDK_VERSION=1.0.0-SNAPSHOT
|
||||
# 自研地图
|
||||
MAP_SDK_VERSION=1.0.0-vr-8.5.75
|
||||
MAP_SDK_VERSION=1.0.0-vr-8.5.77
|
||||
|
||||
|
||||
## 产品库必备配置,产品库自动对versionCode和versionName版本进行升级
|
||||
|
||||
@@ -245,6 +245,11 @@ public class AMapWrapper implements IMogoMap {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapVersion() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean checkAMap() {
|
||||
if ( mAMap == null ) {
|
||||
Logger.e( TAG, "高德map实例为空,请检查" );
|
||||
|
||||
@@ -263,6 +263,11 @@ public class AMapWrapper implements IMogoMap {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapVersion() {
|
||||
return MapAutoApi.INSTANCE.getSDKVersion();
|
||||
}
|
||||
|
||||
private boolean checkAMap() {
|
||||
mAMap = mMapView.getMapAutoViewHelper();
|
||||
sAMap = mAMap;
|
||||
|
||||
@@ -142,4 +142,10 @@ public interface IMogoMap {
|
||||
* @return
|
||||
*/
|
||||
IMogoPolyline addPolyline( MogoPolylineOptions options );
|
||||
|
||||
/**
|
||||
* 获取地图版本号
|
||||
* @return
|
||||
*/
|
||||
String getMapVersion();
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
[{"lat":26.820175208327566,"lng":0.0,"lon":112.57748204198309},{"lat":26.82009891465042,"lng":0.0,"lon":112.57735739748664},{"lat":26.820022750763542,"lng":0.0,"lon":112.57723266155585},{"lat":26.81994655656347,"lng":0.0,"lon":112.57710795477944},{"lat":26.81987031666393,"lng":0.0,"lon":112.57698328267305},{"lat":26.819793988171348,"lng":0.0,"lon":112.57685866945901},{"lat":26.819717530408877,"lng":0.0,"lon":112.57673414980971},{"lat":26.819635079638967,"lng":0.0,"lon":112.57661462149986},{"lat":26.819532022659132,"lng":0.0,"lon":112.5765234581422},{"lat":26.819488197195188,"lng":0.0,"lon":112.5764835085963},{"lat":26.81947053563866,"lng":0.0,"lon":112.57645743645142},{"lat":26.81945285740347,"lng":0.0,"lon":112.5764313389555},{"lat":26.81941584428336,"lng":0.0,"lon":112.57637074918446},{"lat":26.819355855639404,"lng":0.0,"lon":112.57626774620917},{"lat":26.8193352833325,"lng":0.0,"lon":112.57623094969783},{"lat":26.819315738575742,"lng":0.0,"lon":112.57619587959701},{"lat":26.81929619389902,"lng":0.0,"lon":112.5761608096667},{"lat":26.819276064037396,"lng":0.0,"lon":112.5761245744324},{"lat":26.819221654527443,"lng":0.0,"lon":112.5760208132482},{"lat":26.819153675938914,"lng":0.0,"lon":112.5758903945585},{"lat":26.8190859083974,"lng":0.0,"lon":112.57576035026403},{"lat":26.81904791926707,"lng":0.0,"lon":112.57568644394968},{"lat":26.819047477540156,"lng":0.0,"lon":112.57568591545105},{"lat":26.819047035811135,"lng":0.0,"lon":112.57568538694994},{"lat":26.819046594080046,"lng":0.0,"lon":112.57568485844635},{"lat":26.81902999052958,"lng":0.0,"lon":112.57568137976324},{"lat":26.818966668056316,"lng":0.0,"lon":112.57572279587626},{"lat":26.81896660310204,"lng":0.0,"lon":112.57572518130716},{"lat":26.81896683258833,"lng":0.0,"lon":112.57572606581252},{"lat":26.81896706207354,"lng":0.0,"lon":112.57572695031374},{"lat":26.818971211272444,"lng":0.0,"lon":112.57573544393973},{"lat":26.819027657144368,"lng":0.0,"lon":112.57584589447032},{"lat":26.819095546341085,"lng":0.0,"lon":112.57597644303986},{"lat":26.8191650468231,"lng":0.0,"lon":112.57610591408428},{"lat":26.819236806047,"lng":0.0,"lon":112.5762338575302},{"lat":26.819310184480436,"lng":0.0,"lon":112.57636063880027},{"lat":26.819384451187933,"lng":0.0,"lon":112.5764867800095},{"lat":26.819460642360763,"lng":0.0,"lon":112.57661149583805},{"lat":26.819536878267925,"lng":0.0,"lon":112.57673619431976},{"lat":26.819613220428206,"lng":0.0,"lon":112.57686079387894},{"lat":26.819689146973122,"lng":0.0,"lon":112.57698570087358},{"lat":26.819765257290772,"lng":0.0,"lon":112.57711047564952},{"lat":26.81984156841068,"lng":0.0,"lon":112.57723510283108},{"lat":26.819916608456698,"lng":0.0,"lon":112.57735767331373},{"lat":26.819990868286688,"lng":0.0,"lon":112.57747918205983},{"lat":26.82006704845146,"lng":0.0,"lon":112.57760363217366},{"lat":26.820142688927376,"lng":0.0,"lon":112.57772676391022},{"lat":26.820220480866162,"lng":0.0,"lon":112.57784947830805},{"lat":26.82029609426984,"lng":0.0,"lon":112.57797111160743},{"lat":26.820372540342063,"lng":0.0,"lon":112.57809575812311},{"lat":26.820449035279513,"lng":0.0,"lon":112.57822036992494},{"lat":26.82052479395364,"lng":0.0,"lon":112.5783432083879},{"lat":26.820600741070034,"lng":0.0,"lon":112.57846626552721},{"lat":26.820676451505513,"lng":0.0,"lon":112.57858892597905},{"lat":26.820750627333855,"lng":0.0,"lon":112.57870908764811},{"lat":26.820788099971104,"lng":0.0,"lon":112.57876896886103},{"lat":26.82079340880141,"lng":0.0,"lon":112.57877600898784},{"lat":26.82079871765643,"lng":0.0,"lon":112.57878304914836},{"lat":26.820804096213536,"lng":0.0,"lon":112.57879017489086},{"lat":26.820866626548845,"lng":0.0,"lon":112.5788587003478},{"lat":26.820983640738305,"lng":0.0,"lon":112.57893123552938},{"lat":26.82111632395692,"lng":0.0,"lon":112.57893777257203},{"lat":26.82117204164965,"lng":0.0,"lon":112.57891747212024},{"lat":26.821184743761496,"lng":0.0,"lon":112.57890962148315},{"lat":26.821197445813166,"lng":0.0,"lon":112.5789017
|
||||
@@ -56,6 +56,8 @@ dependencies {
|
||||
api project(":foudations:mogo-commons")
|
||||
api project(':services:mogo-service-api')
|
||||
}
|
||||
|
||||
annotationProcessor 'com.elegant.spi:compiler:1.0.3'
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -1,2 +1,12 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.module.common" />
|
||||
package="com.mogo.module.common" >
|
||||
|
||||
<application>
|
||||
<receiver android:name=".datacenter.receiver.SnapShotMockTestPanelBroadCastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.loc.test_panel_control" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.mogo.module.common.datacenter;
|
||||
|
||||
public class RealTimeData {
|
||||
|
||||
private static volatile RealTimeData realTimeData;
|
||||
private static final byte[] bytes = new byte[0];
|
||||
|
||||
private double lat;
|
||||
private double lon;
|
||||
private double heading;
|
||||
private int speed;
|
||||
private long satelliteTime;
|
||||
|
||||
private RealTimeData() {
|
||||
|
||||
}
|
||||
|
||||
public static RealTimeData getInstance() {
|
||||
if (realTimeData == null) {
|
||||
synchronized (bytes) {
|
||||
if (realTimeData == null) {
|
||||
realTimeData = new RealTimeData();
|
||||
}
|
||||
}
|
||||
}
|
||||
return realTimeData;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public void setHeading(double heading) {
|
||||
this.heading = heading;
|
||||
}
|
||||
|
||||
public void setSpeed(int speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public void setSatelliteTime(long satelliteTime) {
|
||||
this.satelliteTime = satelliteTime;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public double getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
public int getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public long getSatelliteTime() {
|
||||
return satelliteTime;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +1,30 @@
|
||||
package com.mogo.module.common.uploadintime;
|
||||
package com.mogo.module.common.datacenter;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.locationinfo.CloudLocationInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/12/14
|
||||
*
|
||||
* 实时坐标数据处理中心
|
||||
/**
|
||||
* 定位坐标同步数据中心
|
||||
* 接收来自工控机实际定位数据
|
||||
*/
|
||||
public class SnapshotLocationController {
|
||||
public class SnapshotLocationDataCenter {
|
||||
|
||||
private static final String TAG = "SnapshotLocationController";
|
||||
private static volatile SnapshotLocationDataCenter sInstance;
|
||||
|
||||
private static volatile SnapshotLocationController sInstance;
|
||||
|
||||
private SnapshotLocationController() {
|
||||
private SnapshotLocationDataCenter() {
|
||||
}
|
||||
|
||||
public static SnapshotLocationController getInstance() {
|
||||
public static SnapshotLocationDataCenter getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (SnapshotLocationController.class) {
|
||||
synchronized (SnapshotLocationDataCenter.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new SnapshotLocationController();
|
||||
sInstance = new SnapshotLocationDataCenter();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,6 +47,7 @@ public class SnapshotLocationController {
|
||||
private double mCurSpeed;
|
||||
private double mCurLon;
|
||||
private double mCurLat;
|
||||
private long mSatelliteTime = 0;
|
||||
|
||||
/**
|
||||
* 同步从定位来的数据(也可能是rtk)
|
||||
@@ -81,7 +77,6 @@ public class SnapshotLocationController {
|
||||
//测试面板状态同步
|
||||
DebugConfig.setStatus(DebugConfig.sLocation, true);
|
||||
|
||||
// Logger.d(TAG, "同步到rtk数据");
|
||||
double lon = data.optDouble("lon", -1);
|
||||
double lat = data.optDouble("lat", -1);
|
||||
double alt = data.optDouble("alt", -1);
|
||||
@@ -111,6 +106,7 @@ public class SnapshotLocationController {
|
||||
mCurSpeed = cloudLocationInfo.getSpeed();
|
||||
mCurLon = cloudLocationInfo.getLon();
|
||||
mCurLat = cloudLocationInfo.getLat();
|
||||
mSatelliteTime = cloudLocationInfo.getSatelliteTime();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,7 +139,6 @@ public class SnapshotLocationController {
|
||||
if (list.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
//Logger.d( TAG, "upload loc size = %s", list == null ? 0 : list.size() );
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -153,7 +148,6 @@ public class SnapshotLocationController {
|
||||
* @return 精度
|
||||
*/
|
||||
public int getDataAccuracy() {
|
||||
//Logger.d( TAG, "upload loc accuracy = %s", mDataAccuracy );
|
||||
return mDataAccuracy;
|
||||
}
|
||||
|
||||
@@ -168,4 +162,8 @@ public class SnapshotLocationController {
|
||||
public double getCurLat() {
|
||||
return mCurLat;
|
||||
}
|
||||
|
||||
public long getSatelliteTime(){
|
||||
return mSatelliteTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.mogo.module.common.datacenter;
|
||||
|
||||
import com.elegant.spi.annotations.Service;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.realtime.api.IRealTimeProvider;
|
||||
import com.mogo.realtime.entity.SocketReceiveDataProto3;
|
||||
import com.mogo.realtime.util.MortonCode;
|
||||
|
||||
import static com.mogo.cloud.socket.SocketMsgType.MSG_TYPE_UPLINK_CAR_DATA;
|
||||
|
||||
@Service(value = IRealTimeProvider.class)
|
||||
public class SpiRealTimeProvider implements IRealTimeProvider {
|
||||
|
||||
@Override
|
||||
public SocketReceiveDataProto3.SocketReceiveDataProto getLocationMsg() {
|
||||
|
||||
double lat = RealTimeData.getInstance().getLat();
|
||||
double lon = RealTimeData.getInstance().getLon();
|
||||
if (lat == 0.0f || lon == 0.0f) {
|
||||
return null;
|
||||
}
|
||||
double heading = RealTimeData.getInstance().getHeading();
|
||||
int speed = RealTimeData.getInstance().getSpeed();
|
||||
long satelliteTime = RealTimeData.getInstance().getSatelliteTime();
|
||||
long mortonCode = MortonCode.encodeMorton(lon, lat);
|
||||
|
||||
SocketReceiveDataProto3.LocationInfoProto locationInfoProto =
|
||||
SocketReceiveDataProto3.LocationInfoProto.newBuilder()
|
||||
.setLat(lat)
|
||||
.setLon(lon)
|
||||
.setHeading(heading)
|
||||
.setSystemTime(System.currentTimeMillis())
|
||||
.setSatelliteTime(satelliteTime)
|
||||
.setAlt(0)
|
||||
.setDataAccuracy(1)
|
||||
.setSpeed(speed)
|
||||
.setMortonCode(mortonCode)
|
||||
.setSn(MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
.build();
|
||||
|
||||
SocketReceiveDataProto3.MyLocationReq myLocationReq =
|
||||
SocketReceiveDataProto3.MyLocationReq.newBuilder()
|
||||
.setLastCoordinate(locationInfoProto)
|
||||
.setDataAccuracy(1)
|
||||
.setMortonCode(mortonCode)
|
||||
.setFromType(0)
|
||||
.setSn(MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
.build();
|
||||
|
||||
SocketReceiveDataProto3.OnePerSecondSendReqProto self =
|
||||
SocketReceiveDataProto3.OnePerSecondSendReqProto.newBuilder()
|
||||
.setSelf(myLocationReq)
|
||||
.build();
|
||||
return SocketReceiveDataProto3.SocketReceiveDataProto.newBuilder()
|
||||
.setIPCSn(MoGoAiCloudClientConfig.getInstance().getSn() + "xavier")
|
||||
.setSn(MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
.setData(self)
|
||||
.setMsgType(MSG_TYPE_UPLINK_CAR_DATA.getMsgType())
|
||||
.setSeq(System.currentTimeMillis()).build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.mogo.module.common.datacenter.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.module.common.datacenter.RealTimeData;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public class SnapShotMockTestPanelBroadCastReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = "SnapShotMockTestPanelBroadCastReceiver";
|
||||
|
||||
/**
|
||||
* 定位模拟测试控制面板广播Action
|
||||
*/
|
||||
public static final String BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY = "sceneType";
|
||||
|
||||
private Context mContext;
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
this.mContext = context;
|
||||
int sceneType = intent.getIntExtra(BROADCAST_TEST_PANEL_CONTROL_TYPE_EXTRA_KEY, 0);
|
||||
Logger.d(TAG, "textPanelOpenType:" + sceneType);
|
||||
// 分发场景
|
||||
dispatchSceneTest(sceneType);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分发处理场景
|
||||
* 定位模拟分发场景中,需要case自己处理数据,以生产者消费者模式来提供 RealTimeData 所需字段
|
||||
*
|
||||
* @param sceneType 场景类型
|
||||
*/
|
||||
private void dispatchSceneTest(int sceneType) {
|
||||
Logger.d(TAG, "sceneType=" + sceneType);
|
||||
if (sceneType == 1) {
|
||||
//模拟顺义固定位置
|
||||
RealTimeData.getInstance().setLat(39.968309);
|
||||
RealTimeData.getInstance().setLon(116.410871);
|
||||
RealTimeData.getInstance().setHeading(120);
|
||||
RealTimeData.getInstance().setSpeed(30);
|
||||
long satelliteTime = SnapshotLocationDataCenter.getInstance().getSatelliteTime();
|
||||
if (satelliteTime == 0) {
|
||||
satelliteTime = System.currentTimeMillis();
|
||||
}
|
||||
RealTimeData.getInstance().setSatelliteTime(satelliteTime);
|
||||
} else if (sceneType == 2) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
/**
|
||||
* 上一帧数据的缓存
|
||||
*/
|
||||
protected static Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
|
||||
private static Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
|
||||
|
||||
public AdasRecognizedResultDrawer() {
|
||||
super();
|
||||
@@ -76,7 +76,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
/**
|
||||
* 渲染 adas 识别的数据
|
||||
*
|
||||
* @param resultList
|
||||
* @param resultList adas感知融合数据
|
||||
*/
|
||||
public void renderAdasRecognizedResult(List<ADASRecognizedResult> resultList) {
|
||||
final long start = System.nanoTime();
|
||||
@@ -114,7 +114,6 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
}
|
||||
removeUselessMarker(mMarkersCaches);
|
||||
removeUselessLastRecord();
|
||||
Log.d("ADAS数据延时绘制", "查找缓存绘制 cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||
int newDiffSetSize = newDiffSet.size();
|
||||
// Log.d(TAG, "原数据量 : " + resultList.size() + " 新增marker数量 : " + newDiffSetSize);
|
||||
// 复用过期 marker
|
||||
@@ -133,7 +132,6 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||
mMarkersCaches.clear();
|
||||
mMarkersCaches = newAdasRecognizedMarkersCaches;
|
||||
// Log.d(TAG, "更新缓存marker, size : " + mMarkersCaches.size());
|
||||
Log.d("ADAS数据延时绘制", "render 接收数据 -> 处理结束 " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms");
|
||||
}
|
||||
|
||||
@@ -233,7 +231,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
if (recognizedListResult == null) {
|
||||
return true;
|
||||
}
|
||||
if (!isRenderType(recognizedListResult.type)) {
|
||||
if (nonRenderType(recognizedListResult.type)) {
|
||||
return true;
|
||||
}
|
||||
String uniqueKey = recognizedListResult.uuid;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import static java.lang.Math.PI;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
@@ -15,8 +17,8 @@ import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.constants.AdasRecognizedType;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.common.drawer.bean.SpeedData;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -26,12 +28,6 @@ import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
|
||||
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_MY_LOCATION;
|
||||
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_ADAS;
|
||||
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_DATA;
|
||||
import static java.lang.Math.PI;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
@@ -176,15 +172,15 @@ class BaseDrawer {
|
||||
* @param type {@link AdasRecognizedType}
|
||||
* @return render
|
||||
*/
|
||||
public boolean isRenderType(int type) {
|
||||
public boolean nonRenderType(int type) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
return recognizedType == AdasRecognizedType.classIdCar
|
||||
|| recognizedType == AdasRecognizedType.classIdMoto
|
||||
|| recognizedType == AdasRecognizedType.classIdBicycle
|
||||
|| recognizedType == AdasRecognizedType.classIdPerson
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficBus
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck
|
||||
|| recognizedType == AdasRecognizedType.classIdUnKnow;
|
||||
return recognizedType != AdasRecognizedType.classIdCar
|
||||
&& recognizedType != AdasRecognizedType.classIdMoto
|
||||
&& recognizedType != AdasRecognizedType.classIdBicycle
|
||||
&& recognizedType != AdasRecognizedType.classIdPerson
|
||||
&& recognizedType != AdasRecognizedType.classIdTrafficBus
|
||||
&& recognizedType != AdasRecognizedType.classIdTrafficTruck
|
||||
&& recognizedType != AdasRecognizedType.classIdUnKnow;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,8 +190,9 @@ class BaseDrawer {
|
||||
* @return showSpeed
|
||||
*/
|
||||
public boolean shouldShowSpeed(int type) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
return recognizedType != AdasRecognizedType.classIdPerson;
|
||||
return true; //todo 验证行人预警,对行人和自行车不做infoWindow过滤
|
||||
// AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
// return recognizedType != AdasRecognizedType.classIdPerson;
|
||||
// &&recognizedType != AdasRecognizedType.classIdBicycle //todo Bicycle显示
|
||||
// && recognizedType != AdasRecognizedType.classIdMoto //todo moto显示
|
||||
}
|
||||
@@ -255,7 +252,7 @@ class BaseDrawer {
|
||||
protected double getCurSpeed() {
|
||||
double speed = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastSpeed();
|
||||
if (speed <= 0) {
|
||||
speed = SnapshotLocationController.getInstance().getCurSpeed();
|
||||
speed = SnapshotLocationDataCenter.getInstance().getCurSpeed();
|
||||
}
|
||||
return speed;
|
||||
}
|
||||
@@ -271,8 +268,8 @@ class BaseDrawer {
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
|
||||
};
|
||||
if (coordinates[0] <= 0) {
|
||||
coordinates[0] = SnapshotLocationController.getInstance().getCurLon();
|
||||
coordinates[1] = SnapshotLocationController.getInstance().getCurLat();
|
||||
coordinates[0] = SnapshotLocationDataCenter.getInstance().getCurLon();
|
||||
coordinates[1] = SnapshotLocationDataCenter.getInstance().getCurLat();
|
||||
}
|
||||
return coordinates;
|
||||
}
|
||||
@@ -323,7 +320,6 @@ class BaseDrawer {
|
||||
* @param isVrMode 是否是vrMode
|
||||
*/
|
||||
public static void showSelfSpeed(IMogoMarker mogoMarker, double speed, String uuid, int type, double heading, boolean isVrMode) {
|
||||
Log.d("EmArrow", "showSelf uuid : " + uuid + " speed : " + speed);
|
||||
if (mogoMarker == null || mogoMarker.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
@@ -482,15 +478,4 @@ class BaseDrawer {
|
||||
|
||||
return new double[]{lon, lat};
|
||||
}
|
||||
|
||||
protected String getDataTypes(int fromType) {
|
||||
switch (fromType) {
|
||||
case FROM_MY_LOCATION:
|
||||
return TYPE_MARKER_CLOUD_DATA;
|
||||
case FROM_ADAS:
|
||||
return TYPE_MARKER_ADAS;
|
||||
default:
|
||||
return TYPE_MARKER_CLOUD_DATA;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_DATA;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -20,7 +21,6 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.drawer.bean.SpeedData;
|
||||
import com.mogo.module.common.utils.Trigonometric;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
@@ -35,6 +35,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -72,20 +73,13 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上一帧数据的缓存
|
||||
*/
|
||||
protected static Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
|
||||
private static final Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
|
||||
|
||||
private final Map<String, SocketDownData.CloudRoadDataProto> mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
private boolean mIsVrMode = false;
|
||||
|
||||
/**
|
||||
* 注册StatusDescriptor.VR_MODE类型,VR_MODE状态改变回调
|
||||
*
|
||||
@@ -98,15 +92,10 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
mChangeCarModeStatus = true;
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||
removeUselessMarker(mMarkersCaches);
|
||||
mMarkersCaches = new ConcurrentHashMap<>();
|
||||
mLastPositions.clear();
|
||||
AdasRecognizedResultDrawer.getInstance().notifyVrModeChanged(); //清除ADAS old marker data
|
||||
}
|
||||
|
||||
public boolean isVrMode() {
|
||||
return mIsVrMode;
|
||||
}
|
||||
|
||||
public boolean isChangeCarModeStatus() {
|
||||
return mChangeCarModeStatus;
|
||||
}
|
||||
@@ -150,7 +139,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
* @param data 自车周边数据
|
||||
*/
|
||||
public void renderSnapshotData(SocketDownData.LauncherSnapshotProto data) {
|
||||
|
||||
final long start = System.nanoTime();
|
||||
if (clear(data)) {
|
||||
return;
|
||||
}
|
||||
@@ -164,8 +153,8 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
|
||||
Map<String, IMogoMarker> newMarkersCaches = new ConcurrentHashMap<>(allDatumsList.size());
|
||||
List<SocketDownData.CloudRoadDataProto> newDiffSet = new ArrayList<>();
|
||||
|
||||
for (SocketDownData.CloudRoadDataProto cloudRoadData : allDatumsList) {
|
||||
|
||||
if (isUselessValue(cloudRoadData)) {
|
||||
continue;
|
||||
}
|
||||
@@ -173,44 +162,16 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
IMogoMarker marker = mMarkersCaches.remove(uniqueKey);
|
||||
if (marker != null && !marker.isDestroyed()) {
|
||||
updateCacheMarkerRes(marker, cloudRoadData);
|
||||
renderSnapshotOneFrame(true, marker, uniqueKey, cloudRoadData, newMarkersCaches);
|
||||
renderSnapshotOneFrame(marker, uniqueKey, cloudRoadData, newMarkersCaches);
|
||||
} else {
|
||||
newDiffSet.add(cloudRoadData);
|
||||
}
|
||||
}
|
||||
removeUselessMarker(mMarkersCaches);
|
||||
removeUselessLastRecord();
|
||||
|
||||
// 能复用的 marker 数量
|
||||
// int cachedMarkerSize = mMarkersCaches.size();
|
||||
// 需要新增的 marker 数量
|
||||
int newDiffSetSize = newDiffSet.size();
|
||||
// 能复用的数量
|
||||
// int size = Math.min(cachedMarkerSize, newDiffSetSize);
|
||||
|
||||
// 复用过期 marker
|
||||
if (newDiffSetSize > 0) {
|
||||
// Iterator<Map.Entry<String, IMogoMarker>> entryIterator = mMarkersCaches.entrySet().iterator();
|
||||
// for (int i = 0; i < size; i++) {
|
||||
// SocketDownData.CloudRoadDataProto cloudRoadData = newDiffSet.get(i);
|
||||
// String uniqueKey = cloudRoadData.getUuid();
|
||||
// Map.Entry<String, IMogoMarker> entry = entryIterator.next();
|
||||
// entryIterator.remove();
|
||||
// SocketDownData.CloudRoadDataProto old = mLastPositions.remove(entry.getKey());
|
||||
// IMogoMarker marker = entry.getValue();
|
||||
// if (marker == null) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// // 更新资源内容
|
||||
// if (old == null || old.getType() != cloudRoadData.getType()) {
|
||||
// updateCacheMarkerRes(marker, cloudRoadData);
|
||||
// }
|
||||
// renderSnapshotOneFrame(marker, uniqueKey, cloudRoadData, newMarkersCaches);
|
||||
// }
|
||||
|
||||
// 复用过后还需新增的 marker
|
||||
|
||||
for (int i = 0; i < newDiffSetSize; i++) {
|
||||
SocketDownData.CloudRoadDataProto cloudRoadData = newDiffSet.get(i);
|
||||
String uniqueKey = cloudRoadData.getUuid();
|
||||
@@ -218,17 +179,14 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
if (marker == null) {
|
||||
continue;
|
||||
}
|
||||
renderSnapshotOneFrame(false, marker, uniqueKey, cloudRoadData, newMarkersCaches);
|
||||
renderSnapshotOneFrame(marker, uniqueKey, cloudRoadData, newMarkersCaches);
|
||||
}
|
||||
}
|
||||
// if (cachedMarkerSize - size > 0) {
|
||||
// sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||
// }
|
||||
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||
mMarkersCaches.clear();
|
||||
mMarkersCaches = newMarkersCaches;
|
||||
|
||||
mMarkersCaches.putAll(newMarkersCaches);
|
||||
// 移除超时 marker
|
||||
delayRemoveUselessMarker();
|
||||
removeUselessLastRecord();
|
||||
Log.d("云端数据延时绘制", "render 接收数据 -> 处理结束 " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -252,6 +210,33 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
}
|
||||
}
|
||||
|
||||
private void delayRemoveUselessMarker() {
|
||||
if (mMarkersCaches.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
IMogoADASController adasControllerApi = MogoApisHandler.getInstance().getApis().getAdasControllerApi();
|
||||
if (TextUtils.isEmpty(adasControllerApi.getSatelliteTime())) {
|
||||
return;
|
||||
}
|
||||
Iterator<IMogoMarker> iterator = mMarkersCaches.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMarker result = iterator.next();
|
||||
SocketDownData.CloudRoadDataProto proto = ((SocketDownData.CloudRoadDataProto) result.getObject());
|
||||
if(proto == null){ // 后续有业务数据在操作,更新数据,不做处理
|
||||
continue;
|
||||
}
|
||||
long internal = Long.parseLong(adasControllerApi.getSatelliteTime()) - proto.getSatelliteTime();
|
||||
Log.d("MogoArrow", "delayRemoveUselessMarker uuid : " + proto.getUuid()
|
||||
+ " localTime : " + adasControllerApi.getSatelliteTime()
|
||||
+ " originTime : " + proto.getSatelliteTime()
|
||||
+ " internal : " + internal);
|
||||
if (internal > 5000) {
|
||||
iterator.remove();
|
||||
result.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeUselessLastRecord() { // todo 最好重新设计一个数据结构,用于多线程数据过期失效的场景,参见redis数据过期
|
||||
if (mLastPositions.isEmpty()) {
|
||||
return;
|
||||
@@ -264,7 +249,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
Log.d("EmArrow", "removeUselessLastRecord size : " + mLastPositions.size());
|
||||
while (iterator.hasNext()) {
|
||||
SocketDownData.CloudRoadDataProto result = iterator.next();
|
||||
long internal = result.getSatelliteTime() - Long.parseLong(adasControllerApi.getSatelliteTime());
|
||||
long internal = Long.parseLong(adasControllerApi.getSatelliteTime()) - result.getSatelliteTime();
|
||||
if (internal > 3000) {
|
||||
iterator.remove();
|
||||
}
|
||||
@@ -281,7 +266,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
if (cloudRoadData == null) {
|
||||
return true;
|
||||
}
|
||||
if (!isRenderType(cloudRoadData.getType())) {
|
||||
if (nonRenderType(cloudRoadData.getType())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -295,55 +280,45 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
* @param cloudRoadData {@link SocketDownData.CloudRoadDataProto}
|
||||
* @param newSnapshotCaches 缓存数据
|
||||
*/
|
||||
private void renderSnapshotOneFrame(boolean useCache, IMogoMarker marker, String uniqueKey, SocketDownData.CloudRoadDataProto cloudRoadData, Map<String, IMogoMarker> newSnapshotCaches) {
|
||||
|
||||
Logger.d(TAG, "renderSnapshotOneFrame");
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
private void renderSnapshotOneFrame(IMogoMarker marker, String uniqueKey, SocketDownData.CloudRoadDataProto cloudRoadData, Map<String, IMogoMarker> newSnapshotCaches) {
|
||||
final long start = System.nanoTime();
|
||||
SocketDownData.CloudRoadDataProto lastPosition = mLastPositions.remove(uniqueKey);
|
||||
|
||||
double lastLon = -1;
|
||||
double lastLat = -1;
|
||||
if (lastPosition != null) {
|
||||
lastLon = lastPosition.getWgslon();
|
||||
lastLat = lastPosition.getWgslat();
|
||||
}
|
||||
|
||||
double[] matchLonLat = getMatchLonLat(cloudRoadData.getUuid(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading(), lastLon, lastLat);
|
||||
|
||||
SocketDownData.CloudRoadDataProto.Builder builder = cloudRoadData.toBuilder();
|
||||
builder.setWgslon(matchLonLat[0]);
|
||||
builder.setWgslat(matchLonLat[1]);
|
||||
|
||||
cloudRoadData = builder.build();
|
||||
// 道路吸附
|
||||
// double lastLon = -1;
|
||||
// double lastLat = -1;
|
||||
// if (lastPosition != null) {
|
||||
// lastLon = lastPosition.getWgslon();
|
||||
// lastLat = lastPosition.getWgslat();
|
||||
// }
|
||||
// double[] matchLonLat = getMatchLonLat(cloudRoadData.getUuid(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading(), lastLon, lastLat);
|
||||
// SocketDownData.CloudRoadDataProto.Builder builder = cloudRoadData.toBuilder();
|
||||
// builder.setWgslon(matchLonLat[0]);
|
||||
// builder.setWgslat(matchLonLat[1]);
|
||||
// cloudRoadData = builder.build();
|
||||
|
||||
mLastPositions.put(uniqueKey, cloudRoadData);
|
||||
|
||||
if (useCache) {
|
||||
long interval = computeAnimDuration(lastPosition.getSatelliteTime(), cloudRoadData.getSatelliteTime());
|
||||
|
||||
final MogoLatLng point = new MogoLatLng(cloudRoadData.getWgslat(), cloudRoadData.getWgslon());
|
||||
long cost = System.currentTimeMillis() - start;
|
||||
final long intervalRef = interval - cost;
|
||||
marker.addDynamicAnchorPosition(point, (float) cloudRoadData.getHeading(), intervalRef);
|
||||
} else {
|
||||
marker.setRotateAngle(((float) cloudRoadData.getHeading()));
|
||||
marker.setPosition(cloudRoadData.getWgslat(), cloudRoadData.getWgslon());
|
||||
long interval = 45;
|
||||
if (lastPosition != null) {
|
||||
interval = computeAnimDuration(lastPosition.getSatelliteTime(), cloudRoadData.getSatelliteTime());
|
||||
}
|
||||
final MogoLatLng point = new MogoLatLng(cloudRoadData.getWgslat(), cloudRoadData.getWgslon());
|
||||
long cost = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
|
||||
final long intervalRef = interval - cost;
|
||||
marker.addDynamicAnchorPosition(point, (float) cloudRoadData.getHeading(), intervalRef);
|
||||
marker.setAnchorColor(getModelRenderColor(cloudRoadData.getType(), cloudRoadData.getFromType(), cloudRoadData.getSpeed(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading()));
|
||||
|
||||
newSnapshotCaches.put(uniqueKey, marker);
|
||||
if (shouldShowSpeed(cloudRoadData.getType())) {
|
||||
Message msg = mRenderThreadHandler.obtainMessage();
|
||||
msg.obj = new SpeedData(marker
|
||||
, cloudRoadData.getSpeed()
|
||||
, cloudRoadData.getUuid()
|
||||
, cloudRoadData.getType()
|
||||
, cloudRoadData.getHeading()
|
||||
, MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
msg.what = MSG_DISPLAY_SPEED;
|
||||
msg.sendToTarget();
|
||||
}
|
||||
// if (shouldShowSpeed(cloudRoadData.getType())) {
|
||||
// Message msg = mRenderThreadHandler.obtainMessage();
|
||||
// msg.obj = new SpeedData(marker
|
||||
// , cloudRoadData.getSpeed()
|
||||
// , cloudRoadData.getUuid()
|
||||
// , cloudRoadData.getType()
|
||||
// , cloudRoadData.getHeading()
|
||||
// , MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
// msg.what = MSG_DISPLAY_SPEED;
|
||||
// msg.sendToTarget();
|
||||
// }
|
||||
Log.d("云端数据延时", "render 刷新一台车 cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -353,35 +328,10 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
* @param out 输出集合
|
||||
*/
|
||||
private void prepareData(List<SocketDownData.CloudRoadDataProto> in, List<SocketDownData.CloudRoadDataProto> out) {
|
||||
filterData(in);
|
||||
// foreCastPoint(in, out);
|
||||
out.addAll(in);
|
||||
}
|
||||
|
||||
/**
|
||||
* vr 模式下显示合并数据,否则只显示 mogo 车辆上报的数据
|
||||
* 展示融合数据,不包括自车定位数据和adas识别数据
|
||||
*
|
||||
* @param data 道路数据集合
|
||||
*/
|
||||
private void filterData(List<SocketDownData.CloudRoadDataProto> data) {
|
||||
if (data == null || data.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
return;
|
||||
}
|
||||
List<SocketDownData.CloudRoadDataProto> newList = new ArrayList<>();
|
||||
for (SocketDownData.CloudRoadDataProto cloudRoadData : data) {
|
||||
if (cloudRoadData.getFromType() != SocketDownDataHelper.FROM_MY_LOCATION) {
|
||||
continue;
|
||||
}
|
||||
newList.add(cloudRoadData);
|
||||
}
|
||||
data.clear();
|
||||
data.addAll(newList);
|
||||
}
|
||||
|
||||
private final static String FORECAST = "snapshotForecast";
|
||||
|
||||
/**
|
||||
@@ -442,12 +392,13 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
* @return {@link IMogoMarker}
|
||||
*/
|
||||
public IMogoMarker drawSnapshotDataMarker(SocketDownData.CloudRoadDataProto data) {
|
||||
long start = System.nanoTime();
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner(getDataTypes(data.getFromType()))
|
||||
.owner(TYPE_MARKER_CLOUD_DATA)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.rotate((float) data.getHeading())
|
||||
.object(data)
|
||||
@@ -468,13 +419,13 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
options.icon(view);
|
||||
resIdVal = view.getId() + "";
|
||||
}
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(getDataTypes(data.getFromType()), options);
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(TYPE_MARKER_CLOUD_DATA, options);
|
||||
cacheMarkerIconResMd5Val(resIdVal, marker);
|
||||
|
||||
if (!TextUtils.isEmpty(data.getSn())) {
|
||||
bindClickListener(marker);
|
||||
}
|
||||
|
||||
Log.d("云端数据延时", "创建一个新 marker cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||
return marker;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
|
||||
|
||||
/**
|
||||
* 绘制行人和二轮车,前方和左右
|
||||
* 识别物移动
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
@@ -87,12 +87,10 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
markerShowEntity.setMarkerLocation(location);
|
||||
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA);
|
||||
IMogoMarker marker = drawMarker(markerShowEntity, modeResType(data.getType()));
|
||||
//识别物
|
||||
marker.addDynamicAnchorPosition(new MogoLatLng(data.getCollisionLat(), data.getCollisionLon()), (float) data.getHeading(), 5000);
|
||||
//移动完成以后,3s后消失
|
||||
marker.addDynamicAnchorPosition(new MogoLatLng(data.getCollisionLat(), data.getCollisionLon()), (float) data.getHeading(), (long) (data.getShowTime() * 1000));
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
marker.remove();
|
||||
}, data.getShowTime());
|
||||
}, data.getShowTime() * 1000);
|
||||
|
||||
}
|
||||
|
||||
@@ -176,8 +174,6 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
markerShowEntity.setMarkerLocation(location);
|
||||
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_STOP_LINE_DATA);
|
||||
IMogoMarker marker = drawStopLineMarker(markerShowEntity);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -69,6 +69,7 @@ import com.mogo.module.extensions.utils.NoMapTopViewShaderHelper;
|
||||
import com.mogo.module.extensions.utils.TopViewAnimHelper;
|
||||
import com.mogo.module.extensions.utils.TopViewNoLinkageAnimHelper;
|
||||
import com.mogo.module.extensions.view.ArcView;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.module.share.manager.ServiceApisManager;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
@@ -98,6 +99,7 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import static android.content.Intent.ACTION_VIEW;
|
||||
import static com.mogo.module.common.utils.SPConst.getSPGuideRecord;
|
||||
import static com.mogo.module.common.utils.SPConst.getSpGuide;
|
||||
import static com.mogo.module.extensions.ExtensionsModuleConst.TYPE_ENTRANCE;
|
||||
@@ -368,6 +370,16 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
flSpeed = (FrameLayout) findViewById(R.id.fl_speed);
|
||||
mouduleArc = (ArcView) findViewById(R.id.moudule_arc);
|
||||
if (DebugConfig.isDebug()) {
|
||||
mouduleArc.setLongClickable(true);
|
||||
mouduleArc.setOnLongClickListener(v -> {
|
||||
Log.d(TAG,"长按显示状态工具栏");
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("oper", 52);
|
||||
MogoApisHandler.getInstance().getApis().getIntentManagerApi().invoke(MogoReceiver.ACTION_MOCK, intent);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
clTrafficLight = (ConstraintLayout) findViewById(R.id.cl_traffic_light);
|
||||
tvYellow = (TextView) findViewById(R.id.tv_yellow);
|
||||
tvRed = (TextView) findViewById(R.id.tv_red);
|
||||
@@ -392,53 +404,53 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
private Group groupFix;
|
||||
|
||||
private void enterVrMode() {
|
||||
tvEnterVrMode.setVisibility(View.GONE);
|
||||
mMove2CurrentLocation.setVisibility(View.GONE);
|
||||
mUploadRoadCondition.setVisibility(View.GONE);
|
||||
mWeatherContainer.setVisibility(View.GONE);
|
||||
mMsgContainer.setVisibility(View.GONE);
|
||||
groupUserHead.setVisibility(View.GONE);
|
||||
seekHelpGroup.setVisibility(View.GONE);
|
||||
tvEnterVrMode.setVisibility(View.GONE);
|
||||
mMove2CurrentLocation.setVisibility(View.GONE);
|
||||
mUploadRoadCondition.setVisibility(View.GONE);
|
||||
mWeatherContainer.setVisibility(View.GONE);
|
||||
mMsgContainer.setVisibility(View.GONE);
|
||||
groupUserHead.setVisibility(View.GONE);
|
||||
seekHelpGroup.setVisibility(View.GONE);
|
||||
// tvExitVrMode.setVisibility(View.VISIBLE);
|
||||
TopViewAnimHelper.getInstance().enterVrMode();
|
||||
TopViewNoLinkageAnimHelper.getInstance().enterVrMode();
|
||||
mNaviInfo = vrModeNavInfoView;
|
||||
adasNoticeHelper.enterVrMode();
|
||||
mCameraLiveNoticeHelper.enterVrMode();
|
||||
TopViewAnimHelper.getInstance().enterVrMode();
|
||||
TopViewNoLinkageAnimHelper.getInstance().enterVrMode();
|
||||
mNaviInfo = vrModeNavInfoView;
|
||||
adasNoticeHelper.enterVrMode();
|
||||
mCameraLiveNoticeHelper.enterVrMode();
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener(TAG, this);
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener(TAG, this);
|
||||
|
||||
localIsVrMode = true;
|
||||
flSpeed.setVisibility(View.VISIBLE);
|
||||
mSwitchMapModeLayout.setVisibility(View.VISIBLE);
|
||||
mApis.getV2XListenerManager().changeTipWindowStatusForListener(ACTION_V2X_REMOVE_TIP_WINDOW);
|
||||
localIsVrMode = true;
|
||||
flSpeed.setVisibility(View.VISIBLE);
|
||||
mSwitchMapModeLayout.setVisibility(View.VISIBLE);
|
||||
mApis.getV2XListenerManager().changeTipWindowStatusForListener(ACTION_V2X_REMOVE_TIP_WINDOW);
|
||||
}
|
||||
|
||||
private void exitVrMode() {
|
||||
EntranceViewHolder.getInstance().forceHideNoticeView();
|
||||
tvEnterVrMode.setVisibility(View.VISIBLE);
|
||||
mMove2CurrentLocation.setVisibility(View.VISIBLE);
|
||||
mUploadRoadCondition.setVisibility(View.VISIBLE);
|
||||
groupUserHead.setVisibility(View.VISIBLE);
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isSeekHelping()) {
|
||||
seekHelpGroup.setVisibility(View.VISIBLE);
|
||||
}
|
||||
EntranceViewHolder.getInstance().forceHideNoticeView();
|
||||
tvEnterVrMode.setVisibility(View.VISIBLE);
|
||||
mMove2CurrentLocation.setVisibility(View.VISIBLE);
|
||||
mUploadRoadCondition.setVisibility(View.VISIBLE);
|
||||
groupUserHead.setVisibility(View.VISIBLE);
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isSeekHelping()) {
|
||||
seekHelpGroup.setVisibility(View.VISIBLE);
|
||||
}
|
||||
// mWeatherContainer.setVisibility(View.VISIBLE);
|
||||
// mMsgContainer.setVisibility(View.VISIBLE);
|
||||
|
||||
// tvExitVrMode.setVisibility(View.GONE);
|
||||
TopViewAnimHelper.getInstance().exitVrMode();
|
||||
TopViewNoLinkageAnimHelper.getInstance().exitVrMode();
|
||||
mNaviInfo = animNavInfoView;
|
||||
adasNoticeHelper.exitVrMode();
|
||||
mCameraLiveNoticeHelper.exitVrMode();
|
||||
TopViewAnimHelper.getInstance().exitVrMode();
|
||||
TopViewNoLinkageAnimHelper.getInstance().exitVrMode();
|
||||
mNaviInfo = animNavInfoView;
|
||||
adasNoticeHelper.exitVrMode();
|
||||
mCameraLiveNoticeHelper.exitVrMode();
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().unregisterMogoLocationListener(TAG);
|
||||
localIsVrMode = false;
|
||||
flSpeed.setVisibility(View.GONE);
|
||||
mSwitchMapModeLayout.setVisibility(View.GONE);
|
||||
clTrafficLight.setVisibility(View.GONE);
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().unregisterMogoLocationListener(TAG);
|
||||
localIsVrMode = false;
|
||||
flSpeed.setVisibility(View.GONE);
|
||||
mSwitchMapModeLayout.setVisibility(View.GONE);
|
||||
clTrafficLight.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void debugCrashWarn() {
|
||||
@@ -729,7 +741,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
// 进入鹰眼模式,设置手势缩放地图失效
|
||||
Logger.d(TAG, "进入vr模式");
|
||||
mMApUIController.changeMapMode(EnumMapUI.Type_VR);
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
package com.mogo.module.main;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
@@ -44,6 +40,7 @@ import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.skin.support.SkinMode;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.permissions.PermissionsDialogUtils;
|
||||
import com.zhidao.adasconfig.api.AdasConfigApiController;
|
||||
import com.zhidao.adasconfig.common.log.LoggerController;
|
||||
import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
||||
@@ -161,9 +158,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
if (Settings.canDrawOverlays(this)) {
|
||||
return;
|
||||
}
|
||||
// Intent intent=new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
|
||||
// startActivityForResult(intent, REQUEST_CODE_DIALOG);
|
||||
openAppDetails("显示悬浮窗");
|
||||
PermissionsDialogUtils.openAppDetails(this, "显示悬浮窗", REQUEST_CODE_DIALOG);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -484,43 +479,27 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
} else {
|
||||
// 弹出对话框告诉用户需要权限的原因, 并引导用户去应用权限管理中手动打开权限按钮
|
||||
if (!isFirst) {
|
||||
openAppDetails(null);
|
||||
PermissionsDialogUtils.openAppDetails(this, null, REQUEST_CODE_DIALOG);
|
||||
isFirst = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开APP的详情设置
|
||||
*/
|
||||
private void openAppDetails(String msg) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
if (TextUtils.isEmpty(msg)) {
|
||||
builder.setMessage("请在 “应用信息 -> 权限” 中授予权限");
|
||||
} else {
|
||||
builder.setMessage("请在 “应用信息 -> 权限” 中授予【" + msg + "】权限");
|
||||
}
|
||||
builder.setPositiveButton("手动授权", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
intent.setData(Uri.parse("package:" + getPackageName()));
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton("取消", null);
|
||||
builder.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
Logger.d(TAG, "requestCode: " + requestCode + " resultCode: " + resultCode);
|
||||
if (requestCode == REQUEST_CODE_DIALOG) {
|
||||
//申请悬浮窗权限
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
// 检查是否有悬浮窗权限
|
||||
if (Settings.canDrawOverlays(this)) {
|
||||
startVoicePad();
|
||||
}
|
||||
} else {
|
||||
startVoicePad();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import com.mogo.module.common.MogoModulePaths;
|
||||
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.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.service.autopilot.AutoPilotRemoteController;
|
||||
import com.mogo.module.service.handler.MainLooperHandler;
|
||||
import com.mogo.module.service.handler.RefreshWorkThreadHandler;
|
||||
@@ -1003,7 +1003,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
e.printStackTrace();
|
||||
}
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( data );
|
||||
SnapshotLocationController.getInstance().syncAdasLocationInfo( data );
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo( data );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.carinfo.CarStateInfo;
|
||||
@@ -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 );
|
||||
SnapshotLocationController.getInstance().syncAdasLocationInfo( data );
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo( data );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.dialog.WMDialog;
|
||||
import com.mogo.module.common.drawer.SnapshotSetDataDrawer;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.status.EnvStatusManager;
|
||||
@@ -852,7 +852,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
//改变rtk定位数据,触发自车移动
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map(jo);
|
||||
Log.i("mock-timer-loc-map", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
SnapshotLocationController.getInstance().syncAdasLocationInfo(jo);
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(jo);
|
||||
Log.i("mock-timer-loc", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
Log.i("mock-timer-loc-info", jo.toString());
|
||||
return true;
|
||||
|
||||
@@ -9,7 +9,7 @@ import android.os.Bundle;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.service.locationinfo.CloudLocationInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -74,7 +74,7 @@ public class MogoRTKLocation {
|
||||
cloudLocationInfo.setSystemTime(System.currentTimeMillis());
|
||||
cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
|
||||
.getTileId(location.getLongitude(), location.getLatitude())));
|
||||
SnapshotLocationController.getInstance().syncLocationInfo(cloudLocationInfo);
|
||||
SnapshotLocationDataCenter.getInstance().syncLocationInfo(cloudLocationInfo);
|
||||
}
|
||||
} else {
|
||||
Logger.e(TAG, "location == null");
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.mogo.module.service.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
@@ -15,6 +13,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
|
||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||
@@ -38,13 +37,12 @@ import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.connection.IMogoLifecycleListener;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.carchattingprovider.ICallChatResponse;
|
||||
|
||||
@@ -142,19 +140,38 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
MoGoAiCloudRealTime.registerOnMsgListener(new IMogoCloudOnMsgListener() {
|
||||
@Override
|
||||
public void onMsgSend(long id) {
|
||||
DebugConfig.setStatus(DebugConfig.sDownloadLink, true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(SocketDownData.LauncherSnapshotProto mogoSnapshotSetData) {
|
||||
DebugConfig.setStatus(DebugConfig.sDownloadSnapshot, true);
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(mogoSnapshotSetData);
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(mogoSnapshotSetData);
|
||||
// Message msg = mSnapshotHandler.obtainMessage();
|
||||
// msg.obj = mogoSnapshotSetData;
|
||||
// msg.what = MSG_SNAPSHOT;
|
||||
// msg.sendToTarget();
|
||||
}
|
||||
});
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi(context)
|
||||
.registerLifecycleListener(10020, new IMogoLifecycleListener() {
|
||||
@Override
|
||||
public void onConnectFailure() {
|
||||
DebugConfig.setStatus(DebugConfig.sDownloadLink, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectSuccess() {
|
||||
DebugConfig.setStatus(DebugConfig.sDownloadLink, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectLost() {
|
||||
DebugConfig.setStatus(DebugConfig.sDownloadLink, false);
|
||||
}
|
||||
});
|
||||
|
||||
// adas 每隔一定频率传递过来的数据
|
||||
MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback(resultList -> {
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.graphics.Color;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
@@ -14,6 +15,9 @@ 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 com.mogo.utils.NetworkUtils;
|
||||
|
||||
import static com.mogo.utils.CommonUtils.getVersionName;
|
||||
|
||||
|
||||
/*
|
||||
@@ -65,13 +69,16 @@ public class EnvStatusManager {
|
||||
|
||||
private void renderStatus() {
|
||||
String[] sStatusName = {
|
||||
"定位",
|
||||
"近景",
|
||||
"下发",
|
||||
"AUTO",
|
||||
"长链",
|
||||
"工控机定位",
|
||||
"ADAS近景感知",
|
||||
"云端远景感知",
|
||||
"自动驾驶状态",
|
||||
"socket长链",
|
||||
"经度",
|
||||
"纬度"
|
||||
"纬度",
|
||||
"网络状态",
|
||||
"App版本",
|
||||
"Map版本"
|
||||
};
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int i = 0; i < sStatusName.length; i++) {
|
||||
@@ -80,6 +87,15 @@ public class EnvStatusManager {
|
||||
stringBuilder.append(DebugConfig.getAutoPilotStatus()).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 {
|
||||
stringBuilder.append("true".equals(DebugConfig.getStatus(i, true)) ? "正常" : "异常").append("\n");
|
||||
}
|
||||
@@ -97,7 +113,10 @@ public class EnvStatusManager {
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.network.TimeDelayApiService;
|
||||
import com.mogo.module.service.network.bean.MockSocketReceiverData;
|
||||
@@ -100,7 +100,7 @@ public class TimeDelayUploadManager implements IMogoOnMessageListener<MockSocket
|
||||
e.printStackTrace();
|
||||
}
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map(jo);
|
||||
SnapshotLocationController.getInstance().syncAdasLocationInfo(jo);
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(jo);
|
||||
mockHandler.sendEmptyMessageDelayed(MOCK_MSG, 50);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ import com.mogo.module.small.map.utils.MapAssetStyleUtils;
|
||||
import com.mogo.module.small.map.view.ISmallMapDirectionView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -147,7 +149,6 @@ public class SmallMapDirectionView
|
||||
mAMapNavi.setIsUseExtraGPSData(true);
|
||||
|
||||
|
||||
|
||||
new Thread(() -> {
|
||||
try {
|
||||
Thread.sleep(1000L);
|
||||
@@ -249,6 +250,19 @@ public class SmallMapDirectionView
|
||||
public void onCarLocationChanged2(Location latLng) {
|
||||
Logger.d(MODULE_NAME, "onCarLocationChanged2 latLng:" + latLng);
|
||||
if (mAMapNavi != null) {
|
||||
NumberFormat nf = NumberFormat.getNumberInstance();
|
||||
// 保留两位小数
|
||||
nf.setMaximumFractionDigits(6);
|
||||
// 如果不需要四舍五入,可以使用RoundingMode.DOWN
|
||||
nf.setRoundingMode(RoundingMode.UP);
|
||||
try {
|
||||
latLng.setLatitude(Double.valueOf(nf.format(latLng.getLatitude())));
|
||||
latLng.setLongitude(Double.valueOf(nf.format(latLng.getLongitude())));
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
latLng.setLatitude(latLng.getLatitude());
|
||||
latLng.setLongitude(latLng.getLongitude());
|
||||
}
|
||||
mAMapNavi.setExtraGPSData(2, latLng);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class DrawLineInfo {
|
||||
|
||||
private float width;
|
||||
|
||||
private int direction;
|
||||
private boolean hasStopLines;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
@@ -69,12 +69,12 @@ public class DrawLineInfo {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public int getDirection() {
|
||||
return direction;
|
||||
public boolean isHasStopLines() {
|
||||
return hasStopLines;
|
||||
}
|
||||
|
||||
public void setDirection(int direction) {
|
||||
this.direction = direction;
|
||||
public void setHasStopLines(boolean hasStopLines) {
|
||||
this.hasStopLines = hasStopLines;
|
||||
}
|
||||
|
||||
public List<MogoLatLng> getLocations() {
|
||||
|
||||
@@ -44,7 +44,7 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
|
||||
.setGps(false);
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
|
||||
if (info.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP) {
|
||||
if (info.isHasStopLines() == true) {
|
||||
colors.add(0x0D3036FF);
|
||||
colors.add(0xD93036FF);
|
||||
colors.add(0x0D3036FF);
|
||||
@@ -75,6 +75,8 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
|
||||
if (mMogoPolyline != null) {
|
||||
mMogoPolyline.remove();
|
||||
mMogoPolyline = null;
|
||||
} else {
|
||||
Log.d("V2XWarningMarker", "mMogoPolyline==null");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.mogo.module.v2x.scenario.view.IV2XMarker;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.network.utils.Util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -58,9 +59,10 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
/*
|
||||
* 自车前方的点,在停止线上--通过自车位置与距离停止线之间的距离计算
|
||||
* */
|
||||
private MogoLatLng middleLocationInStopLine = new MogoLatLng(0,0);
|
||||
private static long showTime = 5000;
|
||||
private MogoLatLng middleLocationInStopLine = new MogoLatLng(0, 0);
|
||||
private static long showTime = 6000;
|
||||
private float bearing;
|
||||
private boolean hasStopLines = false;
|
||||
|
||||
@Override
|
||||
public void drawPOI(Object entity) {
|
||||
@@ -75,40 +77,39 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
}
|
||||
|
||||
public void drawLineWithEntity() {
|
||||
showTime = mCloundWarningInfo.getShowTime() > 0 ? mCloundWarningInfo.getShowTime()*1000 : 5000;
|
||||
Log.d(TAG, "显示时间为++" + String.valueOf(showTime)+"识别物类型:"+String.valueOf(mCloundWarningInfo.getType()));
|
||||
pointsBetween();
|
||||
showTime = mCloundWarningInfo.getShowTime() > 0 ? mCloundWarningInfo.getShowTime() * 1000 : 6000;
|
||||
|
||||
fillPointOnStopLine();
|
||||
bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing();
|
||||
hasStopLines = mCloundWarningInfo.getStopLines().size() > 0;
|
||||
isSelfLineClear = false;
|
||||
isFirstLocation = false;
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS);
|
||||
if (fillPoints.size() > 0) { //存在停止线的情况 TODO
|
||||
if (fillPoints.size() > 0) {
|
||||
//存在停止线的情况 自车与停止线之间绘制蓝色安全线 停止线向前50m绘制红色预警线
|
||||
middleLocationInStopLine = getMiddleLocationInStopLine();
|
||||
//如果是正前方类型,红色绘制区域从停止线向前绘制50米
|
||||
MogoLatLng warningLocation = Trigonometric.getNewLocation(middleLocationInStopLine, 50, mCloundWarningInfo.getAngle());
|
||||
//停止线前方画线
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
if (carLocation.lat != 0 && carLocation.lon != 0) {
|
||||
//在自车与停止线直线绘制蓝色预警线
|
||||
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
|
||||
} else {
|
||||
Log.d(TAG, "自车定位数据为空carLocation == null");
|
||||
}
|
||||
//二轮车和行人的渲染和移动
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
|
||||
//获取停止线前方50m坐标点
|
||||
MogoLatLng warningLocation = Trigonometric.getNewLocation(middleLocationInStopLine,
|
||||
50, angleForCarMoveDirection());
|
||||
//停止线向前方50m绘制红色预警线
|
||||
drawRedWarningLineFrontOfStopLine(mCloundWarningInfo, middleLocationInStopLine,
|
||||
warningLocation);
|
||||
V2XWarnDataDrawer.getInstance().renderWarnData(mCloundWarningInfo);
|
||||
//绘制识别物与交汇点连线,并且更新连线数据
|
||||
drawRedWarningLineFrontOfStopLine(mCloundWarningInfo, middleLocationInStopLine, warningLocation);
|
||||
//添加停止线marker
|
||||
handleStopLine();
|
||||
if (carLocation.lat != 0 && carLocation.lon != 0){
|
||||
//自车画线
|
||||
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
|
||||
}else {
|
||||
Log.d(TAG,"自车定位数据为空carLocation == null");
|
||||
}
|
||||
}, 0);
|
||||
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
||||
V2XServiceManager.getMoGoStopPolylineManager().clearLine();
|
||||
isSelfLineClear = true;
|
||||
}, showTime);
|
||||
Log.d(TAG, "显示时间为++" + String.valueOf(showTime) + "识别物类型:" +
|
||||
String.valueOf(mCloundWarningInfo.getType()));
|
||||
clearAllLine();
|
||||
|
||||
} else { //无停止线
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
@@ -116,43 +117,48 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
drawOtherObjectLine(mCloundWarningInfo);
|
||||
//二轮车和行人的渲染和移动
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
|
||||
V2XWarnDataDrawer.getInstance().renderWarnData(mCloundWarningInfo);
|
||||
//车辆静止的时候
|
||||
if (carLocation.lat != 0 && carLocation.lon != 0){
|
||||
if (carLocation.lat != 0 && carLocation.lon != 0) {
|
||||
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
|
||||
}else {
|
||||
Log.d(TAG,"数据为空carLocation == null");
|
||||
} else {
|
||||
Log.d(TAG, "数据为空carLocation == null");
|
||||
}
|
||||
V2XWarnDataDrawer.getInstance().renderWarnData(mCloundWarningInfo);
|
||||
|
||||
}, 0);
|
||||
|
||||
//延迟3秒清理线
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
||||
isSelfLineClear = true;
|
||||
}, showTime);
|
||||
clearAllLine();
|
||||
}
|
||||
//预警蒙层
|
||||
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(mCloundWarningInfo.getDirection(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
||||
|
||||
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection
|
||||
(mCloundWarningInfo.getDirection(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
||||
}
|
||||
|
||||
/**
|
||||
* 场景如:车辆行驶正前方绘制红色区域(停止线继续前行的预警区域) TODO 需要实时给行人当前位置
|
||||
*/
|
||||
/*
|
||||
*
|
||||
* */
|
||||
public double angleForCarMoveDirection() {
|
||||
MogoLatLng startLatLng = new MogoLatLng(carLocation.lat, carLocation.lon);
|
||||
MogoLatLng endLatLng = new MogoLatLng(middleLocationInStopLine.lat, middleLocationInStopLine.lon);
|
||||
double angle = Trigonometric.getAngle(startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat);
|
||||
Log.d(TAG, "angle==" + String.valueOf(angle));
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
||||
/*绘制停止线前方50m的红色预警线
|
||||
* startLatLng: 划线起点=停止线上的坐标点
|
||||
* mogoLatLng: 停止线前方50m坐标点
|
||||
* */
|
||||
private void drawRedWarningLineFrontOfStopLine(V2XWarningEntity info, MogoLatLng
|
||||
startLatLng, MogoLatLng mogoLatLng) {
|
||||
if (info != null) {
|
||||
double angle = Trigonometric.getAngle(startLatLng.lon, startLatLng.lat, mogoLatLng.lon, mogoLatLng.lat);
|
||||
Log.d(TAG, "angle==drawRedWarningLineFrontOfStopLine:" + String.valueOf(angle));
|
||||
IMogoPolyline polyLine = V2XServiceManager.getMoGoStopPolylineManager().getMogoStopPolyline();
|
||||
MogoLatLng endLatlng = new MogoLatLng(mogoLatLng.lat, mogoLatLng.lon);
|
||||
float distance = CoordinateUtils.calculateLineDistance(startLatLng.lon, startLatLng.lat, endLatlng.lon, endLatlng.lat);
|
||||
MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatLng, distance / 2, mCloundWarningInfo.getAngle());
|
||||
Log.d(TAG, "红色区域起始点 = " + startLatLng.lon + "," + startLatLng.lat +
|
||||
"中间点坐标:" + addMiddleLoc.lon + "," + addMiddleLoc.lat
|
||||
+ "终点" + endLatlng.lon + "," + endLatlng.lat);
|
||||
MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatLng, 25, angle);
|
||||
if (polyLine != null) {
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "drawStopLine polyLine != null");
|
||||
Log.d(TAG, "drawStopLine polyLine != null");
|
||||
polyLine.setPoints(Arrays.asList(startLatLng, addMiddleLoc, endLatlng));
|
||||
polyLine.setTransparency(0.5f);
|
||||
} else {
|
||||
@@ -163,20 +169,39 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
locations.add(endLatlng);
|
||||
lineInfo.setLocations(locations);
|
||||
lineInfo.setHeading(info.heading);
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "drawStopLine width = " + info.getRoadwidth());
|
||||
Log.d(TAG, "drawStopLine width = " + info.getRoadwidth());
|
||||
lineInfo.setWidth(info.getRoadwidth() * 14 + 5);
|
||||
V2XServiceManager.getMoGoStopPolylineManager().drawStopPolyline(getContext(), lineInfo);
|
||||
}
|
||||
Log.d(TAG, "停止线前方50m区域的三个坐标点是:" + startLatLng.lon + "," + startLatLng.lat +
|
||||
"中间点坐标:" + addMiddleLoc.lon + "," + addMiddleLoc.lat
|
||||
+ "终点" + endLatlng.lon + "," + endLatlng.lat);
|
||||
} else {
|
||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
|
||||
V2XServiceManager.getMoGoStopPolylineManager().clearLine();
|
||||
clearAllLine();
|
||||
}
|
||||
}
|
||||
|
||||
public void clearAllLine() {
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
Log.d(TAG, "清除所有预警线的时间是:" + String.valueOf(showTime));
|
||||
//清除识别物到碰撞点预警线
|
||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
|
||||
//清除车前方第一条预警线
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
||||
//清除停止线
|
||||
V2XServiceManager.getMoGoStopPolylineManager().clearLine();
|
||||
//清除小箭头
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS);
|
||||
//清除停止线
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_STOP_LINE_DATA);
|
||||
isSelfLineClear = true;
|
||||
}, showTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 补点后的停止线经纬度合集
|
||||
*/
|
||||
public void pointsBetween() {
|
||||
public void fillPointOnStopLine() {
|
||||
try {
|
||||
fillPoints.clear();
|
||||
List stopLines = mCloundWarningInfo.getStopLines();
|
||||
@@ -217,64 +242,72 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
V2XWarnDataDrawer.getInstance().renderStopLineData(entity);
|
||||
}
|
||||
}
|
||||
//移动完成以后,3s后消失
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_STOP_LINE_DATA);
|
||||
}, mCloundWarningInfo.getShowTime());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private MogoLatLng getMogoLat(MogoLatLng latlng) {
|
||||
MogoLatLng newLocation = Trigonometric.getNewLocation(latlng, mCloundWarningInfo.getStopLineDistance(), mCloundWarningInfo.getAngle());
|
||||
MogoLatLng newLocation = Trigonometric.getNewLocation(latlng, mCloundWarningInfo.getStopLineDistance(),
|
||||
mCloundWarningInfo.getAngle());
|
||||
return newLocation;
|
||||
}
|
||||
|
||||
/*
|
||||
* 自车前方的点,在停止线上--通过自车位置与距离停止线之间的距离计算
|
||||
* 自车前方的点,落点在停止线上--通过自车位置与距离停止线之间的距离计算
|
||||
* */
|
||||
private MogoLatLng getMiddleLocationInStopLine() {
|
||||
Log.d(TAG, "计算停止线上的某个点" + String.valueOf(carLocation.lat + "," + String.valueOf(carLocation.lon)));
|
||||
if (carLocation.lat == 0 || carLocation.lon == 0) {
|
||||
Log.d(TAG, "获取不到车的位置");
|
||||
}
|
||||
MogoLatLng newLocation = Trigonometric.getNewLocation(carLocation, mCloundWarningInfo.getStopLineDistance(), mCloundWarningInfo.getAngle());
|
||||
MogoLatLng newLocation = new MogoLatLng(0, 0);
|
||||
if (mCloundWarningInfo.getStopLines().size() > 1) {
|
||||
MogoLatLng x = mCloundWarningInfo.getStopLines().get(0);
|
||||
MogoLatLng y = mCloundWarningInfo.getStopLines().get(1);
|
||||
float distance = CoordinateUtils.calculateLineDistance(x.lon, x.lat, y.lon, y.lat);
|
||||
double angle = Trigonometric.getAngle(x.lon, x.lat, y.lon, y.lat);
|
||||
newLocation = Trigonometric.getNewLocation(x, distance * 0.5, angle);
|
||||
} else {
|
||||
Log.d(TAG, "停止线返回坐标点数量不正确" + String.valueOf(mCloundWarningInfo.getStopLines().size()));
|
||||
}
|
||||
return newLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车为起点绘制(根据设计,前方行人/弱势交通参与者预警 getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP自车与停止线之间为蓝色预警;其他侧方预警自车与预碰撞点之间显示红色预警)
|
||||
* 存在停止线时自车与停止线之间为蓝色预警
|
||||
* 不存在停止线,自车与预碰撞点之间为红色预警
|
||||
* lon 自车经度
|
||||
* lat 自车纬度
|
||||
*/
|
||||
public void drawSelfCarLine(double lon, double lat, float bearing) {
|
||||
if (!isSelfLineClear) {
|
||||
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
|
||||
if (mCloundWarningInfo != null) {
|
||||
MogoLatLng startLatlng = new MogoLatLng(0,0);
|
||||
MogoLatLng endLatlng = new MogoLatLng(0,0);
|
||||
MogoLatLng addMiddleLoc = new MogoLatLng(0,0);
|
||||
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
|
||||
MogoLatLng startLatlng = new MogoLatLng(0, 0);
|
||||
MogoLatLng endLatlng = new MogoLatLng(0, 0);
|
||||
MogoLatLng addMiddleLoc = new MogoLatLng(0, 0);
|
||||
|
||||
if (!isFirstLocation) {
|
||||
carLocation = getMogoLat(new MogoLatLng(lat, lon));
|
||||
isFirstLocation = true;
|
||||
}
|
||||
//绘制线的终点(在停止线上或者预碰撞点上)
|
||||
endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP ? middleLocationInStopLine.lat : mCloundWarningInfo.getCollisionLat(),
|
||||
mCloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP ? middleLocationInStopLine.lon : mCloundWarningInfo.getCollisionLon());
|
||||
//自车位置
|
||||
endLatlng = new MogoLatLng(hasStopLines ?
|
||||
middleLocationInStopLine.lat : mCloundWarningInfo.getCollisionLat(), hasStopLines ?
|
||||
middleLocationInStopLine.lon : mCloundWarningInfo.getCollisionLon());
|
||||
|
||||
startLatlng = new MogoLatLng(lat, lon);
|
||||
float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
|
||||
//扩展点为了渐变色添加
|
||||
addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat));
|
||||
Log.d(TAG, "自车为起点绘制 自车;" + startLatlng.lon + "," + startLatlng.lat +
|
||||
"中间扩展点" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点:" + endLatlng.lon + "," + endLatlng.lat);
|
||||
|
||||
addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2,
|
||||
Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat));
|
||||
Log.d(TAG, "angle==扩展点为了渐变色添加:" +
|
||||
String.valueOf(Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat)));
|
||||
if (mogoPolyline != null) {
|
||||
mogoPolyline.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
|
||||
mogoPolyline.setTransparency(0.5f);
|
||||
} else {
|
||||
DrawLineInfo info = new DrawLineInfo(); // 对象
|
||||
Log.d(TAG, "安全区域的画线点为" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng);
|
||||
List locations = new ArrayList();
|
||||
locations.add(startLatlng);
|
||||
locations.add(addMiddleLoc);
|
||||
@@ -282,11 +315,14 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
info.setLocations(locations);
|
||||
info.setHeading(bearing);
|
||||
info.setWidth(mCloundWarningInfo.getRoadwidth() * 14 + 5);
|
||||
info.setDirection(mCloundWarningInfo.getDirection());
|
||||
info.setHasStopLines(mCloundWarningInfo.getStopLines().size() > 0);
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info);
|
||||
Log.d(TAG, "自车前方第一条线" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng);
|
||||
}
|
||||
Log.d(TAG, "自车为起点绘制 自车;" + startLatlng.lon + "," + startLatlng.lat +
|
||||
"中间扩展点" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点:" + endLatlng.lon + "," + endLatlng.lat);
|
||||
} else {
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
||||
clearAllLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -307,23 +343,22 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
polyLine.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
|
||||
polyLine.setTransparency(0.5f);
|
||||
} else {
|
||||
//识别物到预碰撞点之间的箭头
|
||||
addArrows(startLatlng, endLatlng);
|
||||
DrawLineInfo lineInfo = new DrawLineInfo();
|
||||
Log.d(TAG, "目标物与预碰撞点画线点为" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng);
|
||||
List locations = new ArrayList();
|
||||
locations.add(startLatlng);
|
||||
locations.add(addMiddleLoc);
|
||||
locations.add(endLatlng);
|
||||
lineInfo.setLocations(locations);
|
||||
lineInfo.setHeading(info.heading);
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "drawOtherObjectLine width = " + info.getRoadwidth());
|
||||
lineInfo.setWidth(info.getRoadwidth() * 14 + 5);
|
||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().drawPersonWarnPolyline(getContext(), lineInfo);
|
||||
//识别物到预碰撞点之间的箭头
|
||||
addArrows(startLatlng, endLatlng);
|
||||
Log.d(TAG, "目标物与预碰撞点画线点为" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng);
|
||||
}
|
||||
} else {
|
||||
Log.e(V2XConst.LOG_NAME_WARN, "info == null");
|
||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
|
||||
clearAllLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,51 +373,17 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
for (int i = 0; i < count; i++) {
|
||||
MogoLatLng newLo = Trigonometric.getNewLocation(
|
||||
startLatLng, 5 * (i + 1), Trigonometric.getAngle(startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat));
|
||||
Log.d(TAG, "小箭头位置" + newLo);
|
||||
V2XWarnDataDrawer.getInstance().drawerArrowsMarkerWithLocation(newLo, WARNING_ARROWS, 10, new Double(rotate).intValue());
|
||||
Log.d(TAG, "小箭头位置" + newLo);
|
||||
}
|
||||
}
|
||||
//延迟3秒清理线
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS);
|
||||
}, showTime);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 2D资源绘制停止线 暂时不需要
|
||||
* */
|
||||
private void drawStopLineWith2Resource() {
|
||||
MogoLatLng carlo = mCloundWarningInfo.getCarLocation();
|
||||
if (carlo == null) {
|
||||
double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
|
||||
double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
|
||||
carlo = new MogoLatLng(lat, lon);
|
||||
}
|
||||
//自车行驶方向的前方*米的经纬度,该经纬度在停止线上
|
||||
MogoLatLng drawStopLineLon = Trigonometric.getNewLocation(carlo, mCloundWarningInfo.getStopLineDistance(), mCloundWarningInfo.getAngle());
|
||||
Log.d(TAG, "2D资源绘" + drawStopLineLon);
|
||||
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
|
||||
.latitude(drawStopLineLon.getLat())
|
||||
.longitude(drawStopLineLon.getLon())
|
||||
.anchor(1.0f, 1.0f)
|
||||
.zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH);
|
||||
|
||||
optionsRipple
|
||||
.icon(ViewUtils.fromView(new EmptyMarkerView(V2XServiceManager.getContext())));
|
||||
IMogoMarker stopLine = V2XServiceManager.getMarkerManager().addMarker(TYPE_MARKER_CLOUD_STOP_LINE_DATA, optionsRipple);
|
||||
stopLine.setInfoWindowAdapter(new SimpleWindow3DAdapter(new V2XFrontTargetMarkerView(V2XServiceManager.getContext())));
|
||||
stopLine.showInfoWindow();
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
stopLine.hideInfoWindow();
|
||||
}, showTime);
|
||||
}
|
||||
|
||||
//线随车动
|
||||
public void onCarLocationChanged2(Location latLng) {
|
||||
carLocation = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() && isSelfLineClear == false) {
|
||||
//当行人经纬度交点 开始画线,否则清理
|
||||
if (mCloundWarningInfo != null) {
|
||||
mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
|
||||
}
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
"stopLineDistance": 60,
|
||||
"warningContent": "注意自行车",
|
||||
"heading": 0,
|
||||
"showTime": 5000,
|
||||
"showTime": 3,
|
||||
"roadwidth": 4.0
|
||||
}
|
||||
@@ -24,6 +24,6 @@
|
||||
"stopLineDistance": 60,
|
||||
"warningContent": "小心行人",
|
||||
"heading": 0,
|
||||
"showTime": 5000,
|
||||
"showTime": 3,
|
||||
"roadwidth": 4.0
|
||||
}
|
||||
@@ -15,6 +15,6 @@
|
||||
"stopLineDistance": 60,
|
||||
"warningContent": "注意摩托车",
|
||||
"heading": 0,
|
||||
"showTime": 5000,
|
||||
"showTime": 3,
|
||||
"roadwidth": 4.0
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.mogo.service.connection;
|
||||
|
||||
public interface IMogoLifecycleListener {
|
||||
void onConnectFailure();
|
||||
|
||||
void onConnectSuccess();
|
||||
|
||||
void onConnectLost();
|
||||
}
|
||||
@@ -45,6 +45,9 @@ public interface IMogoSocketManager extends IProvider {
|
||||
*/
|
||||
void unregisterOnMessageListener( int msgType, IMogoOnMessageListener listener );
|
||||
|
||||
|
||||
void registerLifecycleListener(int msgType,IMogoLifecycleListener listener);
|
||||
void unregisterLifecycleListener(int msgType);
|
||||
/**
|
||||
* 发送消息
|
||||
*
|
||||
|
||||
@@ -144,4 +144,10 @@ public interface IMogoMapService extends IProvider {
|
||||
* @return
|
||||
*/
|
||||
CoordinatesTransformer getCoordinatesTransformer();
|
||||
|
||||
/**
|
||||
* 获取地图版本号
|
||||
* @return
|
||||
*/
|
||||
String getMapVersion();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.cloud.socket.entity.MsgBody;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.connection.IMogoLifecycleListener;
|
||||
import com.mogo.service.connection.IMogoMsgAckListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
@@ -52,6 +53,20 @@ public class MogoSocketManager implements IMogoSocketManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerLifecycleListener(int msgType, IMogoLifecycleListener listener) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.registerLifecycleListener( msgType, listener );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterLifecycleListener(int msgType) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.unregisterLifecycleListener( msgType);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg(MsgBody body, IMogoMsgAckListener listener ) {
|
||||
if ( mDelegate != null ) {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class IntentManager implements IMogoIntentManager {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Map< String, CopyOnWriteArrayList< IMogoIntentListener > > mListeners = new ConcurrentHashMap<>();
|
||||
private final Map< String, CopyOnWriteArrayList< IMogoIntentListener > > mListeners = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public void registerIntentListener( String intent, IMogoIntentListener listener ) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.mogo.map.MogoCoordinatesTransformer;
|
||||
import com.mogo.map.MogoGeoSearch;
|
||||
import com.mogo.map.MogoInputtipsSearch;
|
||||
import com.mogo.map.MogoLocationClient;
|
||||
import com.mogo.map.MogoMap;
|
||||
import com.mogo.map.MogoMapUIController;
|
||||
import com.mogo.map.MogoMapViewInstanceHandler;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
@@ -120,6 +121,11 @@ public class MogoMapService implements IMogoMapService {
|
||||
return MogoCoordinatesTransformer.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapVersion() {
|
||||
return MogoMap.getInstance().getMogoMap().getMapVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.mogo.tts.pad;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
@@ -11,6 +13,7 @@ import com.mogo.tts.base.MogoTTSConstants;
|
||||
import com.mogo.tts.base.PreemptType;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.permissions.PermissionsDialogUtils;
|
||||
import com.zhidao.auto.platform.voice.VoiceClient;
|
||||
import com.zhidao.voicesdk.MogoVoiceManager;
|
||||
import com.zhidao.voicesdk.MogoVoiceManagerImpl;
|
||||
@@ -34,7 +37,7 @@ public
|
||||
@Route( path = MogoTTSConstants.API_PATH )
|
||||
class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
|
||||
private static final String TAG = "ZhiTTS";
|
||||
private static final String TAG = "PadTTS";
|
||||
private String mLastQAndASpeakText;
|
||||
|
||||
private boolean mHasFlush = false;
|
||||
@@ -48,6 +51,7 @@ class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
try {
|
||||
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,6 +83,7 @@ class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* 初始化
|
||||
*/
|
||||
private void initSpeech( Context context ) {
|
||||
Logger.d(TAG, "initSpeech");
|
||||
mogoVoiceManager = MogoVoiceManagerImpl.getInstance();
|
||||
mogoVoiceManager.init( context, new OnConnStatusListener() {
|
||||
@Override
|
||||
@@ -115,7 +120,7 @@ class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
List< IMogoTTSCallback > cmdCallBacks = mCmdMap.get( cmd );
|
||||
iterator = new ArrayList<>( cmdCallBacks ).iterator();
|
||||
} catch ( Exception e ) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
while ( iterator != null && iterator.hasNext() ) {
|
||||
IMogoTTSCallback callBack = iterator.next();
|
||||
@@ -192,6 +197,7 @@ class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
mVoiceClient.speakDefault( text );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,6 +213,7 @@ class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
mVoiceClient.speakDefault( text );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,6 +248,7 @@ class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
mVoiceClient.speakTypeText( text, preemptType );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,6 +328,7 @@ class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
try {
|
||||
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
}
|
||||
@@ -340,6 +349,7 @@ class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
try {
|
||||
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
}
|
||||
@@ -355,6 +365,8 @@ class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param status window_start_cancel 0 - 结束, 1 - 显示, 2 - 未激活调试进入
|
||||
*/
|
||||
public static void startAssistant( Context context, int status ) {
|
||||
Logger.w(TAG, "startAssistant status = %d", status);
|
||||
|
||||
final Intent intent = new Intent();
|
||||
intent.setFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||
intent.setAction( "pvetec.intent.action.txz.switch" );
|
||||
@@ -378,6 +390,7 @@ class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
|
||||
private boolean isVoiceServiceReady( Context context ) {
|
||||
if ( AppUtils.isProcessRunning( context, AppUtils.getPackageUid( context, "com.zhidao.speech" ) )) {
|
||||
Logger.d( TAG, "pad txz is voiceServiceReady" );
|
||||
return true;
|
||||
} else if ( AppUtils.isProcessRunning( context, AppUtils.getPackageUid( context, "com.txznet.txz" ) )
|
||||
&& AppUtils.isProcessRunning( context, AppUtils.getPackageUid( context, "com.txznet.adapter" ) ) ) {
|
||||
@@ -398,6 +411,7 @@ class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
mogoVoiceManager.toSpeak( text, -3, this );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,7 +420,7 @@ class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
mSpeakVoiceMap.remove( text );
|
||||
mogoVoiceManager.shutUp( ttsId );
|
||||
} catch ( Exception e ) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,8 +471,15 @@ class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
mVoiceClient = new VoiceClient( mContext );
|
||||
mVoiceClient.setCallBack( this );
|
||||
initFlushStatus();
|
||||
initSpeech( context );
|
||||
Logger.w( TAG, "voice is ready = %s", mHasFlush );
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
// 检查是否有悬浮窗权限
|
||||
if (Settings.canDrawOverlays(context)) {
|
||||
initSpeech(context);
|
||||
}
|
||||
} else {
|
||||
initSpeech(context);
|
||||
}
|
||||
Logger.w(TAG, "voice is mHasFlush = %s mInitReady= %s", mHasFlush, mInitReady);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,6 +490,7 @@ class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
|
||||
@Override
|
||||
public void startAIAssist( Context context, int status ) {
|
||||
Logger.w(TAG, "startAIAssist status = %d", status);
|
||||
final Intent intent = new Intent();
|
||||
intent.setFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||
intent.setAction( "pvetec.intent.action.txz.switch" );
|
||||
|
||||
Reference in New Issue
Block a user