Merge remote-tracking branch 'origin/dev_hengyang_base' into dev_hengyang_base
2
.idea/misc.xml
generated
@@ -8,7 +8,7 @@
|
||||
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
|
||||
<groovy codeStyle="LEGACY" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -221,7 +221,7 @@ public class OchBusFragment extends BaseOchFragment< OchBusFragment, OchBusPrese
|
||||
isOperationStatus = launch;
|
||||
if ( launch ) {
|
||||
tvOperationStatus.setText( "收车" );
|
||||
showSlidePanle("滑动出发");
|
||||
// showSlidePanle("滑动出发");
|
||||
showPanel();
|
||||
} else {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice("已收车");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="17px" />
|
||||
<corners android:radius="32px" />
|
||||
<solid android:color="#3B4577"/>
|
||||
</shape>
|
||||
</item>
|
||||
@@ -12,7 +12,7 @@
|
||||
android:right="3px"
|
||||
android:top="3px">
|
||||
<shape>
|
||||
<corners android:radius="17px" />
|
||||
<corners android:radius="32px" />
|
||||
<solid android:color="#3B4577"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
public interface IOperationChangedListener {
|
||||
void onOperationChanged(boolean launch);
|
||||
void onOrderStatusChanged(int status);
|
||||
}
|
||||
@@ -8,7 +8,10 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.IMogoOCH;
|
||||
import com.mogo.och.OCHConstants;
|
||||
import com.mogo.och.taxi.ui.OCHTaxiFragment;
|
||||
import com.mogo.och.taxi.ui.OCHTaxiUiController;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -20,13 +23,17 @@ public
|
||||
* 网约车-出租车
|
||||
*/
|
||||
@Route( path = OCHConstants.PATH )
|
||||
class MogoOCHTaxi implements IMogoOCH {
|
||||
class MogoOCHTaxi implements IMogoOCH , IMogoStatusChangedListener {
|
||||
|
||||
private static final String TAG = "MogoOCHTaxi";
|
||||
|
||||
private OCHTaxiFragment ochTaxiFragment;
|
||||
private FragmentActivity mActivity;
|
||||
private int mContainerId;
|
||||
@Override
|
||||
public void init( FragmentActivity activity, int containerId ) {
|
||||
MogoOCHTaxiModel.getInstance().init( activity.getApplicationContext() );
|
||||
this.mActivity = activity;
|
||||
this.mContainerId = containerId;
|
||||
// MogoOCHTaxiModel.getInstance().init( activity.getApplicationContext() );
|
||||
OCHTaxiUiController.getInstance().init( activity, containerId );
|
||||
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
@@ -38,5 +45,36 @@ class MogoOCHTaxi implements IMogoOCH {
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
Logger.d( TAG, "init" );
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("ochTaxi", StatusDescriptor.VR_MODE,this);
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("ochTaxi", StatusDescriptor.TOP_VIEW,this);
|
||||
}
|
||||
|
||||
private void showFragment() {
|
||||
if (ochTaxiFragment == null) {
|
||||
Logger.d(TAG, "准备add fragment======");
|
||||
ochTaxiFragment = new OCHTaxiFragment();
|
||||
mActivity.getSupportFragmentManager().beginTransaction().add(mContainerId, ochTaxiFragment).commit();
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "准备show fragment");
|
||||
mActivity.getSupportFragmentManager().beginTransaction().show(ochTaxiFragment).commit();
|
||||
}
|
||||
|
||||
private void hideFragment(){
|
||||
if (ochTaxiFragment != null){
|
||||
mActivity.getSupportFragmentManager().beginTransaction().hide(ochTaxiFragment).commit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
if (descriptor == StatusDescriptor.VR_MODE){
|
||||
if (isTrue){
|
||||
showFragment();
|
||||
MogoOCHTaxiModel.getInstance().init( mActivity.getApplicationContext() );
|
||||
}else {
|
||||
hideFragment();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@ import android.content.Intent;
|
||||
import android.location.Location;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
@@ -93,16 +93,18 @@ class MogoOCHTaxiModel {
|
||||
*/
|
||||
private boolean mIsArriveAtEndStation = false;
|
||||
|
||||
/**
|
||||
* 乘客已到达上车站点
|
||||
*/
|
||||
private boolean mIsUserArriveAtStartStation = false;
|
||||
// /**
|
||||
// * 乘客已到达上车站点
|
||||
// */
|
||||
// private boolean mIsUserArriveAtStartStation = false;
|
||||
|
||||
/**
|
||||
* 查询订单信息重试次数
|
||||
*/
|
||||
private int mRetryCounter = 0;
|
||||
|
||||
private int mOCHRHCarstatus = -1;
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
@@ -111,6 +113,9 @@ class MogoOCHTaxiModel {
|
||||
public void init( Context context ) {
|
||||
mContext = context.getApplicationContext();
|
||||
|
||||
if (mOCHTaxiServiceApi == null){
|
||||
mOCHTaxiServiceApi = MogoApisHandler.getInstance().getApis().getNetworkApi().create(OCHTaxiServiceApi.class, HostConst.OCH_DOMAIN);
|
||||
}
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi( context )
|
||||
@@ -127,7 +132,47 @@ class MogoOCHTaxiModel {
|
||||
.getApis()
|
||||
.getIntentManagerApi()
|
||||
.registerIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener );
|
||||
if ( NetworkUtils.isConnected( mContext ) ) {
|
||||
// if ( NetworkUtils.isConnected( mContext ) ) {
|
||||
// restoreOrderInfo();
|
||||
// }
|
||||
// if ( NetworkUtils.isConnected( mContext ) ) {
|
||||
// querryCarStatus();
|
||||
// }
|
||||
}
|
||||
|
||||
public void querryCarStatus() {
|
||||
mOCHTaxiServiceApi.queryCarStatus( new OCHCarStatus (MoGoAiCloudClientConfig.getInstance().getSn(),0))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< OCHCarStatusResponse >(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(OCHCarStatusResponse data) {
|
||||
super.onSuccess(data);
|
||||
Logger.e(TAG,"querryCarStatus:"+data.data.status);
|
||||
mOCHRHCarstatus = data.data.status;
|
||||
//更新view
|
||||
OCHTaxiUiController.getInstance().onOperationChanged(mOCHRHCarstatus==1);
|
||||
//刷新数据
|
||||
updateData(mOCHRHCarstatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.e(TAG,"querryCarStatus:"+e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message,code);
|
||||
Logger.e(TAG,"querryCarStatus:"+message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateData(int status){
|
||||
if (status == 1){
|
||||
//查询订单
|
||||
restoreOrderInfo();
|
||||
}
|
||||
}
|
||||
@@ -141,23 +186,36 @@ class MogoOCHTaxiModel {
|
||||
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 );
|
||||
if ( mCurrentOCHOrder == null ) {
|
||||
// 解决本地没有缓存订单号的问题
|
||||
query2RestoreOrderStatus( null );
|
||||
} else {
|
||||
query2RestoreOrderStatus( mCurrentOCHOrder.orderNo );
|
||||
}
|
||||
} else {
|
||||
// 解决本地没有缓存订单号的问题
|
||||
query2RestoreOrderStatus( null );
|
||||
}
|
||||
} else {
|
||||
query2RestoreOrderStatus( mCurrentOCHOrder.orderNo );
|
||||
}
|
||||
query2RestoreOrderStatus(mCurrentOCHOrder == null ? null : mCurrentOCHOrder.orderNo);
|
||||
}
|
||||
|
||||
// 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>
|
||||
@@ -171,62 +229,65 @@ class MogoOCHTaxiModel {
|
||||
* @param orderNo
|
||||
*/
|
||||
private void query2RestoreOrderStatus( String orderNo ) {
|
||||
Logger.e(TAG,"query2RestoreOrderStatus:"+orderNo);
|
||||
queryOCHOrderStatus( orderNo, new OCHOrderStatusCallback< OCHTaxiOrderResponse2 >() {
|
||||
@Override
|
||||
public void onSuccess( OCHTaxiOrderResponse2 data ) {
|
||||
if ( data == null || data.result == null ) {
|
||||
|
||||
if ( data == null || data.data == null) {
|
||||
Logger.d( TAG, "订单已取消或已完成" );
|
||||
clearCurrentOCHOrder();
|
||||
OCHTaxiUiController.getInstance().removeFragment();
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(OCHOrderStatus.None.getCode());
|
||||
return;
|
||||
}
|
||||
convertCurrentOrder( data );
|
||||
OCHOrderStatus status = OCHOrderStatus.valueOf( data.result.orderDispatchType );
|
||||
OCHOrderStatus status = OCHOrderStatus.valueOf( data.data.orderDispatchType );
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(data.data.orderDispatchType);
|
||||
switch ( status ) {
|
||||
case Completed:
|
||||
TipToast.shortTip( mContext.getString( R.string.module_och_taxi_order_completed ) );
|
||||
clearCurrentOCHOrder();
|
||||
OCHTaxiUiController.getInstance().removeFragment();
|
||||
// OCHTaxiUiController.getInstance().removeFragment();
|
||||
break;
|
||||
case Cancel:
|
||||
TipToast.shortTip( mContext.getString( R.string.module_och_taxi_order_cancel ) );
|
||||
clearCurrentOCHOrder();
|
||||
OCHTaxiUiController.getInstance().removeFragment();
|
||||
// OCHTaxiUiController.getInstance().removeFragment();
|
||||
break;
|
||||
case ArriveAtEndStation:
|
||||
mIsArriveAtEndStation = true;
|
||||
mIsArriveAtStartStation = false;
|
||||
mIsOnTheWay2EndStation = false;
|
||||
mIsUserArriveAtStartStation = false;
|
||||
OCHTaxiUiController.getInstance().addFragment();
|
||||
// mIsUserArriveAtStartStation = false;
|
||||
// OCHTaxiUiController.getInstance().addFragment();
|
||||
break;
|
||||
case ArriveAtStartStation:
|
||||
mIsArriveAtStartStation = true;
|
||||
mIsArriveAtEndStation = false;
|
||||
mIsOnTheWay2EndStation = false;
|
||||
mIsUserArriveAtStartStation = false;
|
||||
OCHTaxiUiController.getInstance().addFragment();
|
||||
// mIsUserArriveAtStartStation = false;
|
||||
// OCHTaxiUiController.getInstance().addFragment();
|
||||
break;
|
||||
case UserArriveAtStartStation:
|
||||
mIsArriveAtStartStation = true;
|
||||
mIsArriveAtEndStation = false;
|
||||
mIsOnTheWay2EndStation = false;
|
||||
mIsUserArriveAtStartStation = true;
|
||||
OCHTaxiUiController.getInstance().addFragment();
|
||||
// mIsUserArriveAtStartStation = true;
|
||||
// OCHTaxiUiController.getInstance().addFragment();
|
||||
break;
|
||||
case OnTheWayToEndStation:
|
||||
mIsArriveAtStartStation = false;
|
||||
mIsArriveAtEndStation = false;
|
||||
mIsOnTheWay2EndStation = true;
|
||||
mIsUserArriveAtStartStation = false;
|
||||
OCHTaxiUiController.getInstance().addFragment();
|
||||
// mIsUserArriveAtStartStation = false;
|
||||
// OCHTaxiUiController.getInstance().addFragment();
|
||||
break;
|
||||
case OnTheWayToStartStation:
|
||||
default:
|
||||
mIsArriveAtStartStation = false;
|
||||
mIsArriveAtEndStation = false;
|
||||
mIsOnTheWay2EndStation = false;
|
||||
mIsUserArriveAtStartStation = false;
|
||||
// mIsUserArriveAtStartStation = false;
|
||||
mOrderMsgListener.onMsgReceived( mCurrentOCHOrder );
|
||||
break;
|
||||
}
|
||||
@@ -256,24 +317,24 @@ class MogoOCHTaxiModel {
|
||||
if ( mCurrentOCHOrder == null ) {
|
||||
mCurrentOCHOrder = new OCHTaxiOrderResponse();
|
||||
}
|
||||
mCurrentOCHOrder.orderNo = data.result.orderNo;
|
||||
mCurrentOCHOrder.orderDispatchType = data.result.orderDispatchType;
|
||||
mCurrentOCHOrder.endStation = data.result.endStation;
|
||||
mCurrentOCHOrder.startStation = data.result.startStation;
|
||||
mCurrentOCHOrder.travelDistance = data.result.travelDistance;
|
||||
mCurrentOCHOrder.orderType = data.result.orderType;
|
||||
mCurrentOCHOrder.orderNo = data.data.orderNo;
|
||||
mCurrentOCHOrder.orderDispatchType = data.data.orderDispatchType;
|
||||
mCurrentOCHOrder.endStation = data.data.endStation;
|
||||
mCurrentOCHOrder.startStation = data.data.startStation;
|
||||
mCurrentOCHOrder.travelDistance = data.data.travelDistance;
|
||||
mCurrentOCHOrder.orderType = data.data.orderType;
|
||||
mCurrentOCHOrder.drivingRoutes = new ArrayList<>();
|
||||
OCHTaxiOrderResponse.OCHTaxiStation startStation = new OCHTaxiOrderResponse.OCHTaxiStation();
|
||||
startStation.lon = data.result.startStationCoordinate.get( 0 );
|
||||
startStation.lat = data.result.startStationCoordinate.get( 1 );
|
||||
startStation.siteId = data.result.startStationId;
|
||||
startStation.siteName = data.result.startStation;
|
||||
startStation.lon = data.data.startStationCoordinate.get( 0 );
|
||||
startStation.lat = data.data.startStationCoordinate.get( 1 );
|
||||
startStation.siteId = data.data.startStationId;
|
||||
startStation.siteName = data.data.startStation;
|
||||
mCurrentOCHOrder.drivingRoutes.add( startStation );
|
||||
OCHTaxiOrderResponse.OCHTaxiStation endStation = new OCHTaxiOrderResponse.OCHTaxiStation();
|
||||
endStation.lon = data.result.endStationCoordinate.get( 0 );
|
||||
endStation.lat = data.result.endStationCoordinate.get( 1 );
|
||||
endStation.siteId = data.result.endStationId;
|
||||
endStation.siteName = data.result.endStation;
|
||||
endStation.lon = data.data.endStationCoordinate.get( 0 );
|
||||
endStation.lat = data.data.endStationCoordinate.get( 1 );
|
||||
endStation.siteId = data.data.endStationId;
|
||||
endStation.siteName = data.data.endStation;
|
||||
mCurrentOCHOrder.drivingRoutes.add( endStation );
|
||||
|
||||
cacheOrderInfo2Native( mCurrentOCHOrder );
|
||||
@@ -288,12 +349,55 @@ class MogoOCHTaxiModel {
|
||||
Logger.d( TAG, "onIntentReceived = %s", intentStr );
|
||||
if ( ConnectivityManager.CONNECTIVITY_ACTION.equals( intentStr ) ) {
|
||||
if ( NetworkUtils.isConnected( mContext ) ) {
|
||||
restoreOrderInfo();
|
||||
// restoreOrderInfo();
|
||||
querryCarStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void changedOperationStatus() {
|
||||
if ( mOCHRHCarstatus == -1){
|
||||
querryCarStatus();
|
||||
return;
|
||||
}
|
||||
|
||||
if (checkCurrentOCHOrder()){
|
||||
TipToast.shortTip( "订单未完成,无法下线收车" );
|
||||
return;
|
||||
}
|
||||
|
||||
int status = mOCHRHCarstatus == 1 ? 0 : 1;
|
||||
mOCHTaxiServiceApi.updateCarStatus(new OCHCarStatus(MoGoAiCloudClientConfig.getInstance().getSn(),status))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< OCHCarStatusResponse >(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(OCHCarStatusResponse o) {
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG,"changeCarStatus:"+e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
Logger.d(TAG,"changeCarStatus:"+message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车定位
|
||||
*/
|
||||
@@ -301,12 +405,12 @@ class MogoOCHTaxiModel {
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location location ) {
|
||||
Logger.d( TAG, "定位已判断是否达到上车站点: 起点(%s, %s), 当前位置(%s, %s)",
|
||||
mCurrentOCHOrder.drivingRoutes.get( 0 ).lon,
|
||||
mCurrentOCHOrder.drivingRoutes.get( 0 ).lat,
|
||||
location.getLongitude(),
|
||||
location.getLatitude()
|
||||
);
|
||||
// Logger.d( TAG, "定位已判断是否达到上车站点: 起点(%s, %s), 当前位置(%s, %s)",
|
||||
// mCurrentOCHOrder.drivingRoutes.get( 0 ).lon,
|
||||
// mCurrentOCHOrder.drivingRoutes.get( 0 ).lat,
|
||||
// location.getLongitude(),
|
||||
// location.getLatitude()
|
||||
// );
|
||||
onLocationChanged( location );
|
||||
}
|
||||
|
||||
@@ -331,9 +435,9 @@ class MogoOCHTaxiModel {
|
||||
if ( mIsArriveAtStartStation ) {
|
||||
return;
|
||||
}
|
||||
if ( mIsUserArriveAtStartStation ) {
|
||||
return;
|
||||
}
|
||||
// if ( mIsUserArriveAtStartStation ) {
|
||||
// return;
|
||||
// }
|
||||
judgeStartStation( location );
|
||||
}
|
||||
|
||||
@@ -392,14 +496,14 @@ class MogoOCHTaxiModel {
|
||||
return mIsArriveAtEndStation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户是否达到上车站点
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isUserArriveAtStartStation() {
|
||||
return mIsUserArriveAtStartStation;
|
||||
}
|
||||
// /**
|
||||
// * 用户是否达到上车站点
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// public boolean isUserArriveAtStartStation() {
|
||||
// return mIsUserArriveAtStartStation;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 设置去往终点状态
|
||||
@@ -446,7 +550,8 @@ class MogoOCHTaxiModel {
|
||||
if ( !isArriveAtStartStation() ) {
|
||||
registerCarLocationListener();
|
||||
}
|
||||
OCHTaxiUiController.getInstance().addFragment();
|
||||
// OCHTaxiUiController.getInstance().addFragment();
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(mCurrentOCHOrder.orderDispatchType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,7 +615,7 @@ class MogoOCHTaxiModel {
|
||||
break;
|
||||
case UserArriveAtStartStation:
|
||||
mIsArriveAtStartStation = true;
|
||||
mIsUserArriveAtStartStation = true;
|
||||
// mIsUserArriveAtStartStation = true;
|
||||
OCHTaxiUiController.getInstance().onUserArriveAtStartStation();
|
||||
break;
|
||||
default:
|
||||
@@ -576,11 +681,13 @@ class MogoOCHTaxiModel {
|
||||
if ( callback != null ) {
|
||||
callback.onError();
|
||||
}
|
||||
Logger.e(TAG,"updateOCHOrderStatus:"+e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.e(TAG,"updateOCHOrderStatus:"+message);
|
||||
if ( callback != null ) {
|
||||
callback.onFail();
|
||||
}
|
||||
@@ -620,6 +727,7 @@ class MogoOCHTaxiModel {
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.e("MogoOCHTaxi","queryOCHOrderStatus:"+message);
|
||||
if ( callback != null ) {
|
||||
callback.onFail();
|
||||
}
|
||||
@@ -635,7 +743,7 @@ class MogoOCHTaxiModel {
|
||||
mIsArriveAtStartStation = false;
|
||||
mIsArriveAtEndStation = false;
|
||||
mIsOnTheWay2EndStation = false;
|
||||
mIsUserArriveAtStartStation = false;
|
||||
// mIsUserArriveAtStartStation = false;
|
||||
SharedPrefsMgr.getInstance( mContext ).remove( SP_KEY_OCH_TAXI_ORDER );
|
||||
}
|
||||
|
||||
@@ -646,8 +754,7 @@ class MogoOCHTaxiModel {
|
||||
*/
|
||||
public boolean checkCurrentOCHOrder() {
|
||||
if ( mCurrentOCHOrder != null
|
||||
&& mCurrentOCHOrder.drivingRoutes != null
|
||||
&& mCurrentOCHOrder.drivingRoutes.size() >= 2 ) {
|
||||
&& mCurrentOCHOrder.drivingRoutes != null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
public
|
||||
/**
|
||||
*
|
||||
* 修改/查询网约车-出租车订单状态的数据结构
|
||||
*/
|
||||
class OCHCarStatus extends BaseData {
|
||||
|
||||
public String sn;// 不排除本地没有缓存订单号的情况
|
||||
public int status; //0 收车 1出车
|
||||
|
||||
public OCHCarStatus(String sn,
|
||||
int status ) {
|
||||
this.sn = sn;
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
public
|
||||
/**
|
||||
*
|
||||
* 修改/查询网约车-出租车订单状态的数据结构
|
||||
*/
|
||||
class OCHCarStatusResponse extends BaseData {
|
||||
|
||||
public String sn;// 不排除本地没有缓存订单号的情况
|
||||
public int status; //0 收车 1出车
|
||||
public Result data;
|
||||
|
||||
public OCHCarStatusResponse(String sn,
|
||||
int status ) {
|
||||
this.sn = sn;
|
||||
this.status = status;
|
||||
}
|
||||
public static class Result{
|
||||
public int id;
|
||||
public String sn;
|
||||
public String areaCode;
|
||||
public String plateNumber;
|
||||
public int status;
|
||||
// String remark;
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ public
|
||||
*/
|
||||
class OCHTaxiOrderResponse2 extends BaseData {
|
||||
|
||||
public Result result;
|
||||
public Result data;
|
||||
|
||||
public static class Result {
|
||||
public String _id;
|
||||
|
||||
@@ -23,7 +23,7 @@ interface OCHTaxiServiceApi {
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/order/updateOCHOrder/v1" )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/order/updateOCHOrderState/v1" )
|
||||
Observable< BaseData > updateOrderStatus( @Body OCHTaxiOrderStatus status );
|
||||
|
||||
/**
|
||||
@@ -32,6 +32,20 @@ interface OCHTaxiServiceApi {
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/order/queryOCHOrderDetails/v1" )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/order/queryOrderForCar/v1" )
|
||||
Observable< OCHTaxiOrderResponse2 > queryOrder( @Body OCHTaxiOrderStatus status );
|
||||
/**
|
||||
* 查询网约车状态
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
@POST("/yycp-onlinecar-hailing/onlineCarHailing/order/queryTaxiCarStatus/v1")
|
||||
Observable<OCHCarStatusResponse> queryCarStatus(@Body OCHCarStatus sn );
|
||||
|
||||
|
||||
/**
|
||||
* 更新网约车状态
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
@POST("/yycp-onlinecar-hailing/onlineCarHailing/order/updateTaxiCarStatus/v1")
|
||||
Observable<OCHCarStatusResponse> updateCarStatus(@Body OCHCarStatus status );
|
||||
}
|
||||
|
||||
@@ -8,12 +8,14 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.BaseOchFragment;
|
||||
import com.mogo.och.taxi.IMogoADASAutoPilotStatusChangedListener;
|
||||
import com.mogo.och.taxi.IMogoOCHTaxiArriveCallback;
|
||||
import com.mogo.och.taxi.IOperationChangedListener;
|
||||
import com.mogo.och.taxi.MogoOCHTaxiModel;
|
||||
import com.mogo.och.taxi.OCHOrderStatus;
|
||||
import com.mogo.och.taxi.OCHOrderStatusCallback;
|
||||
@@ -35,6 +37,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
IMogoStatusChangedListener,
|
||||
IMogoOCHTaxiArriveCallback,
|
||||
IMogoADASAutoPilotStatusChangedListener,
|
||||
IOperationChangedListener,
|
||||
IMogoCarLocationChangedListener2 {
|
||||
|
||||
public static final String TAG = "OCHTaxiFragment";
|
||||
@@ -52,7 +55,6 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
private TextView mStartStationName;
|
||||
private TextView mEndStationName;
|
||||
private TextView mDistance;
|
||||
|
||||
@Override
|
||||
public int getStationPanelViewId() {
|
||||
return R.layout.module_och_taxi_panel;
|
||||
@@ -62,6 +64,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
public void restartAutopilot() {
|
||||
// 在自动驾驶中,才会有重新开启自动驾驶的操作
|
||||
if ( MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
|
||||
Logger.d( TAG, "restartAutopilot" );
|
||||
MogoOCHTaxiModel.getInstance().startAutoPilot();
|
||||
}
|
||||
}
|
||||
@@ -74,9 +77,11 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
mEndStationName = findViewById( R.id.module_och_taxi_order_end_station );
|
||||
mDistance = findViewById( R.id.module_och_taxi_order_distance );
|
||||
|
||||
showPanel();
|
||||
// showPanel();
|
||||
hidPanel();
|
||||
initListeners();
|
||||
updateOrderStatus();
|
||||
// TODO: 2021/6/18 调整接口刷新时间
|
||||
// updateOrderStatus();
|
||||
if ( MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getStatusManagerApi()
|
||||
@@ -85,8 +90,8 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
} else {
|
||||
flatMode();
|
||||
}
|
||||
// 出租车不需要开启按钮
|
||||
tvOperationStatus.setVisibility(View.GONE);
|
||||
|
||||
tvOperationStatus.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
@@ -96,6 +101,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
.registerStatusChangedListener( TAG, StatusDescriptor.VR_MODE, this );
|
||||
OCHTaxiUiController.getInstance().setOCHTaxiArriveCallback( this );
|
||||
OCHTaxiUiController.getInstance().setAutoPilotStatusChangedListener( this );
|
||||
OCHTaxiUiController.getInstance().setOperationChangeListener(this);
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
@@ -117,6 +123,12 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onChangeOperationStatus() {
|
||||
super.onChangeOperationStatus();
|
||||
MogoOCHTaxiModel.getInstance().changedOperationStatus();
|
||||
}
|
||||
|
||||
private void vrMode() {
|
||||
if ( mRootView != null ) {
|
||||
mRootView.setVisibility(
|
||||
@@ -151,15 +163,17 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
} else if ( MogoOCHTaxiModel.getInstance().isArriveAtStartStation() ) {
|
||||
Logger.d( TAG, "已经达到起点" );
|
||||
mOrderStatus.setText( R.string.module_och_taxi_waiting );
|
||||
if ( MogoOCHTaxiModel.getInstance().isUserArriveAtStartStation() ) {
|
||||
Logger.d( TAG, "乘客已上车" );
|
||||
slidePanelView.setVisibility( View.VISIBLE );
|
||||
// if ( MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE ) {
|
||||
// } else {
|
||||
// slidePanelView.setVisibility( View.GONE );
|
||||
// }
|
||||
slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_start_station ) );
|
||||
}
|
||||
// if ( MogoOCHTaxiModel.getInstance().isUserArriveAtStartStation() ) {
|
||||
// Logger.d( TAG, "乘客已上车" );
|
||||
// slidePanelView.setVisibility( View.VISIBLE );
|
||||
//// if ( MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE ) {
|
||||
//// } else {
|
||||
//// slidePanelView.setVisibility( View.GONE );
|
||||
//// }
|
||||
// slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_start_station ) );
|
||||
// }
|
||||
slidePanelView.setVisibility( View.VISIBLE );
|
||||
slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_start_station ) );
|
||||
} else if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
|
||||
Logger.d( TAG, "去往上车站点" );
|
||||
slidePanelView.setVisibility( View.GONE );
|
||||
@@ -247,6 +261,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
.unregisterStatusChangedListener( TAG, StatusDescriptor.VR_MODE, this );
|
||||
OCHTaxiUiController.getInstance().setOCHTaxiArriveCallback( null );
|
||||
OCHTaxiUiController.getInstance().setAutoPilotStatusChangedListener( null );
|
||||
OCHTaxiUiController.getInstance().setOperationChangeListener(null);
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
@@ -269,7 +284,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
Logger.d( TAG, "更新状态成功" );
|
||||
MogoOCHTaxiModel.getInstance().clearCurrentOCHOrder();
|
||||
MogoOCHTaxiModel.getInstance().cancelAutopilot();
|
||||
OCHTaxiUiController.getInstance().removeFragment();
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -284,8 +299,8 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
} );
|
||||
return;
|
||||
// 乘客已确认到达起点,前往下一站并开启自动驾驶
|
||||
} else if ( MogoOCHTaxiModel.getInstance().isUserArriveAtStartStation()
|
||||
&& !MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
|
||||
} else if ( !MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
|
||||
// MogoOCHTaxiModel.getInstance().isUserArriveAtStartStation() &&
|
||||
MogoOCHTaxiModel.getInstance().startAutoPilot();
|
||||
}
|
||||
}
|
||||
@@ -367,4 +382,33 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
}
|
||||
mLocation = location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOperationChanged(boolean launch) {
|
||||
Logger.e(TAG,"onOperationChanged:"+ launch);
|
||||
isOperationStatus = launch;
|
||||
if ( launch ) {
|
||||
tvOperationStatus.setText( "收车" );
|
||||
// showSlidePanle("滑动出发");
|
||||
// showPanel();
|
||||
} else {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice("已收车");
|
||||
tvOperationStatus.setText("出车");
|
||||
// hideSlidePanel();
|
||||
// hidPanel();
|
||||
}
|
||||
// changeLayoutViewStatus(launch);
|
||||
}
|
||||
|
||||
private void changeLayoutViewStatus(boolean launch) {
|
||||
getPanelView().setVisibility(launch ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrderStatusChanged(int status) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
getPanelView().setVisibility(status != 0 ? View.VISIBLE : View.INVISIBLE);
|
||||
updateOrderStatus();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import androidx.fragment.app.FragmentManager;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.taxi.IMogoADASAutoPilotStatusChangedListener;
|
||||
import com.mogo.och.taxi.IMogoOCHTaxiArriveCallback;
|
||||
import com.mogo.och.taxi.IOperationChangedListener;
|
||||
import com.mogo.och.taxi.MogoOCHTaxiModel;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -31,6 +32,7 @@ class OCHTaxiUiController implements IMogoOCHTaxiArriveCallback, IMogoADASAutoPi
|
||||
|
||||
private IMogoOCHTaxiArriveCallback mOCHTaxiArriveCallback;
|
||||
private IMogoADASAutoPilotStatusChangedListener mAutoPilotStatusChangedListener;
|
||||
private IOperationChangedListener mOperationChangedLisnter;
|
||||
|
||||
private OCHTaxiUiController() {
|
||||
}
|
||||
@@ -101,6 +103,10 @@ class OCHTaxiUiController implements IMogoOCHTaxiArriveCallback, IMogoADASAutoPi
|
||||
this.mAutoPilotStatusChangedListener = autoPilotStatusChangedListener;
|
||||
}
|
||||
|
||||
public void setOperationChangeListener(IOperationChangedListener listener){
|
||||
this.mOperationChangedLisnter = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTheWay2StartStation() {
|
||||
runOnUIThread( () -> {
|
||||
@@ -167,6 +173,8 @@ class OCHTaxiUiController implements IMogoOCHTaxiArriveCallback, IMogoADASAutoPi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 进入鹰眼模式,设置手势缩放地图失效
|
||||
*/
|
||||
@@ -178,4 +186,19 @@ class OCHTaxiUiController implements IMogoOCHTaxiArriveCallback, IMogoADASAutoPi
|
||||
.getMapUIController()
|
||||
.openVrMode( false );
|
||||
}
|
||||
|
||||
public void onOperationChanged(boolean b) {
|
||||
runOnUIThread( () -> {
|
||||
if (mOperationChangedLisnter != null){
|
||||
mOperationChangedLisnter.onOperationChanged(b);
|
||||
}
|
||||
} );
|
||||
}
|
||||
public void onOrderStatusChanged(int status){
|
||||
runOnUIThread( () -> {
|
||||
if (mOperationChangedLisnter != null){
|
||||
mOperationChangedLisnter.onOrderStatusChanged(status);
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
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:orientation="vertical">
|
||||
@@ -72,6 +73,7 @@
|
||||
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"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_taxi_order_start_station"
|
||||
@@ -116,6 +118,7 @@
|
||||
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"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<dimen name="module_och_taxi_order_start_station_marginLeft">15px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_marginLeft">25px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_marginTop">25px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_textSize">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_textSize">32px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_divider_height">1px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_divider_marginLeft">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_divider_marginTop">20px</dimen>
|
||||
@@ -24,4 +24,5 @@
|
||||
<dimen name="module_och_taxi_order_distance_anchor_textSize">32px</dimen>
|
||||
<dimen name="module_och_taxi_order_distance_textSize">36px</dimen>
|
||||
<dimen name="module_och_taxi_order_distance_marginRight">17px</dimen>
|
||||
<dimen name="module_och_taxi_order_text_marginRight">31.5px</dimen>
|
||||
</resources>
|
||||
@@ -24,4 +24,5 @@
|
||||
<dimen name="module_och_taxi_order_distance_anchor_textSize">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_distance_textSize">24px</dimen>
|
||||
<dimen name="module_och_taxi_order_distance_marginRight">17px</dimen>
|
||||
<dimen name="module_och_taxi_order_text_marginRight">22.5px</dimen>
|
||||
</resources>
|
||||
@@ -57,7 +57,7 @@ public class SlidePanelView extends View {
|
||||
private final Paint blockPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Paint textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
|
||||
private static int textSize = 40;
|
||||
private static int textSize = 67;
|
||||
private static int BLOCK_START_X = 15;
|
||||
private static int BLOCK_START_Y = 15;
|
||||
private static int NORMAL_TEXT_MARGIN_LEFT = 40;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
|
||||
<gradient android:angle="315" android:endColor="#2B6EFF" android:startColor="#2B6EFF" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
|
||||
<gradient android:angle="315" android:endColor="#3B4577" android:startColor="#3B4577" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
|
||||
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
@@ -2,13 +2,13 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:bottomLeftRadius="20px" android:bottomRightRadius="45px" android:topLeftRadius="45px" android:topRightRadius="20px" />
|
||||
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
|
||||
<gradient android:angle="315" android:endColor="#2B6EFF" android:startColor="#2B6EFF" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:bottomLeftRadius="20px" android:bottomRightRadius="45px" android:topLeftRadius="45px" android:topRightRadius="20px" />
|
||||
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
|
||||
<gradient android:angle="315" android:endColor="#3B4577" android:startColor="#3B4577" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="@dimen/module_mogo_och_autopilot_status_bg_corner" />
|
||||
android:shape="oval">
|
||||
<!-- <corners android:radius="@dimen/module_mogo_och_autopilot_status_bg_corner" />-->
|
||||
<gradient
|
||||
android:startColor="#323C6F"
|
||||
android:endColor="#323C6F"
|
||||
android:angle="315"/>
|
||||
|
||||
android:angle="315"
|
||||
/>
|
||||
<size
|
||||
android:width="120px"
|
||||
android:height="120px"
|
||||
/>
|
||||
</shape>
|
||||
@@ -2,7 +2,7 @@
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="17px" />
|
||||
<corners android:radius="32px" />
|
||||
<solid android:color="#3B4577"/>
|
||||
</shape>
|
||||
</item>
|
||||
@@ -12,7 +12,7 @@
|
||||
android:right="3px"
|
||||
android:top="3px">
|
||||
<shape>
|
||||
<corners android:radius="17px" />
|
||||
<corners android:radius="32px" />
|
||||
<solid android:color="#3B4577"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
android:text="自动驾驶"
|
||||
android:textColor="@color/module_mogo_och_autopilot_text_color_normal"
|
||||
android:textSize="@dimen/module_mogo_och_autopilot_status_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
@@ -50,7 +49,7 @@
|
||||
android:text="出车"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/module_mogo_och_autopilot_text_color_selector"
|
||||
android:textSize="@dimen/module_mogo_och_autopilot_status_text_size"
|
||||
android:textSize="@dimen/module_mogo_och_operation_status_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
@@ -21,17 +21,19 @@
|
||||
<dimen name="module_mogo_och_autopilot_status_bg_width">460px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_status_bg_height">140px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_operation_status_bg_width">140px</dimen>
|
||||
<dimen name="module_mogo_och_operation_status_bg_height">140px</dimen>
|
||||
<dimen name="module_mogo_och_operation_status_bg_width">120px</dimen>
|
||||
<dimen name="module_mogo_och_operation_status_bg_height">120px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_operation_status_padding">92px</dimen>
|
||||
<dimen name="module_mogo_och_operation_status_padding">83px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_autopilot_order_m_t">30px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_order_bg_width">466px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_order_bg_height">414px</dimen>
|
||||
|
||||
|
||||
<dimen name="module_mogo_och_autopilot_status_text_size">44px</dimen>
|
||||
<!-- <dimen name="module_mogo_och_autopilot_status_text_size">44px</dimen>-->
|
||||
<dimen name="module_mogo_och_autopilot_status_text_size">46px</dimen>
|
||||
<dimen name="module_mogo_och_operation_status_text_size">36px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_status_text_padding_top">13px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_status_text_drawable_padding">12px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_status_text_m_l">350px</dimen>
|
||||
|
||||
@@ -171,7 +171,9 @@ ext {
|
||||
|
||||
// obu sdk
|
||||
obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.3",
|
||||
mebulaobu : 'com.zhidao.support.nebulaobu:nebulaobu:1.0.0.3',
|
||||
// mebulaobu : 'com.zhidao.support.nebulaobu:nebulaobu:1.0.0.3',
|
||||
mogoobu : 'com.zhidao.support.obu:mogoobu:1.0.0.2',
|
||||
|
||||
// 左侧面板
|
||||
moduleleftpanel : "com.mogo.module:module-left-panel:${MOGO_MODULE_LEFT_PANEL_VERSION}",
|
||||
// 左侧面板空实现
|
||||
|
||||
@@ -43,7 +43,7 @@ public abstract class SubscribeImpl< T extends BaseData > implements Observer< T
|
||||
@Override
|
||||
public void onNext( T o ) {
|
||||
if ( o != null ) {
|
||||
if ( o.code != 0 ) {
|
||||
if ( o.code != 0 && o.code!= 200 ) {
|
||||
onError( o.msg, o.code );
|
||||
} else {
|
||||
onSuccess( o );
|
||||
|
||||
@@ -27,14 +27,15 @@ import java.io.OutputStreamWriter;
|
||||
*/
|
||||
public class FileUtils {
|
||||
public static boolean createFileDir(String fileDir) {
|
||||
|
||||
if (TextUtils.isEmpty(fileDir)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
File dir = new File(fileDir);
|
||||
return dir.exists() || dir.mkdir();
|
||||
if(!dir.exists()){
|
||||
return dir.mkdirs();
|
||||
}
|
||||
return dir.exists();
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -187,4 +187,4 @@ applicationId=com.mogo.launcer
|
||||
applicationName=IntelligentPilot
|
||||
versionCode=80007
|
||||
versionName=8.0.7
|
||||
MAP_SDK_VERSION=1.0.0-vr-8.5.49
|
||||
MAP_SDK_VERSION=1.0.0-vr-8.5.51
|
||||
@@ -353,6 +353,9 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
setUIMode(ui);
|
||||
break;
|
||||
case Type_VR:
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_LENOVO) {
|
||||
mMapView.getMapAutoViewHelper().setScaleVRMode(true);
|
||||
}
|
||||
mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_VR);
|
||||
return;
|
||||
case Type_Light:
|
||||
|
||||
@@ -100,7 +100,8 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
|
||||
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
|
||||
.setZoom( 20 )
|
||||
.setPointToCenter( 0.734375f, 0.5f )
|
||||
// .setPointToCenter( 0.734375f, 0.5f )
|
||||
.setPointToCenter( 0.5f, 0.5f ) //todo 2D模式下需要注意ADAS部分遮挡
|
||||
.setStyleMode( MapParams.MAP_STYLE_NIGHT ), NavParams.Companion.init() );
|
||||
MapAutoView mapAutoView = new MapAutoView(context);
|
||||
IMogoMapView mapView = new AMapViewWrapper(mapAutoView);
|
||||
|
||||
@@ -38,7 +38,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.module.adas.entity.AdasAutoPilotLocReceiverBean;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
|
||||
public class AdasAutoPilotManager implements IMogoOnMessageListener<AdasAutoPilotLocReceiverBean> {
|
||||
|
||||
private static volatile AdasAutoPilotManager instance;
|
||||
private static final byte[] obj = new byte[0];
|
||||
private static final int MSG_SOCKET_TYPE = 1;
|
||||
private Context mContext;
|
||||
|
||||
private AdasAutoPilotManager() {
|
||||
|
||||
}
|
||||
|
||||
public static AdasAutoPilotManager getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (obj) {
|
||||
if (instance == null) {
|
||||
instance = new AdasAutoPilotManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void initSocket(Context context) {
|
||||
this.mContext = context;
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi(mContext).registerOnMessageListener(MSG_SOCKET_TYPE, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<AdasAutoPilotLocReceiverBean> target() {
|
||||
return AdasAutoPilotLocReceiverBean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(AdasAutoPilotLocReceiverBean adasAutoPilotLocReceiverBean) {
|
||||
if (adasAutoPilotLocReceiverBean != null
|
||||
&& adasAutoPilotLocReceiverBean.getLat() != 0.0
|
||||
&& adasAutoPilotLocReceiverBean.getLon() != 0.0) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/28 15:24
|
||||
*/
|
||||
public class AdasConstant {
|
||||
public static final String HOST_DEV = "http://dzt-test.zhidaohulian.com";
|
||||
public static final String HOST_TEST = "http://dzt-test.zhidaohulian.com";
|
||||
public static final String HOST_DEMO = "http://dzt-show.zhidaohulian.com";
|
||||
public static final String HOST_PRODUCT = "https://dzt.zhidaohulian.com";
|
||||
}
|
||||
@@ -1,7 +1,17 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
import android.os.RemoteException;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.module.adas.entity.AutonomousDriveStatusBean;
|
||||
import com.mogo.module.adas.entity.ReportSiteBean;
|
||||
import com.mogo.module.adas.entity.WarnMessageModel;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
|
||||
@@ -18,6 +28,18 @@ import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
import com.zhidao.support.adas.high.common.MsgActionType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Flowable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
import static com.mogo.commons.context.ContextHolderUtil.getContext;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/4/25 14:43
|
||||
@@ -25,14 +47,22 @@ import java.util.ArrayList;
|
||||
public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusListener {
|
||||
|
||||
private final String TAG = "AdasEventManager";
|
||||
|
||||
private final Gson gson;
|
||||
|
||||
private final ArrayList<AdasDataListener> iAdasEventListeners = new ArrayList<>();
|
||||
private final ArrayList<AdasStatusListener> iAdasStatusListeners = new ArrayList<>();
|
||||
private IAdasApiService mAdasApiService;
|
||||
private Disposable uploadAutopilotStatus;
|
||||
//自动驾驶状态
|
||||
private int mCurrentAutopilotStatus = -1;
|
||||
//自动驾驶车速度
|
||||
private float mCurrentAutopilotSpeed = 0;
|
||||
private Disposable mdDisposable;
|
||||
//自动驾驶状态
|
||||
private AutopilotStatus.ValuesBean mAutopilotStatus = null;
|
||||
|
||||
public AdasEventManager() {
|
||||
gson = GsonUtil.getGson();
|
||||
mAdasApiService = MogoApisHandler.getInstance().getApis().getNetworkApi().create( IAdasApiService.class, AdasConstant.HOST_PRODUCT );
|
||||
}
|
||||
|
||||
public void addEventListener(AdasDataListener listener) {
|
||||
@@ -65,6 +95,11 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
}
|
||||
}
|
||||
|
||||
public void removeStatusListener() {
|
||||
Logger.d(TAG,"注销adas状态事件监听");
|
||||
iAdasStatusListeners.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWarnMessage(WarnMessageInfo warnMessageInfo) {
|
||||
Logger.d(TAG,"onWarnMessage " + warnMessageInfo);
|
||||
@@ -145,7 +180,6 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
AutopilotStatus.ValuesBean autopilotStatusValues = autopilotStatus.getValues();
|
||||
AutopilotStatus.ValuesBean mAutopilotStatus;
|
||||
|
||||
|
||||
if (autopilotStatusValues != null) {
|
||||
AdasAIDLAutopilotStateModel adasAIDLAutopilotStateModel=new AdasAIDLAutopilotStateModel();
|
||||
adasAIDLAutopilotStateModel.setReason(autopilotStatusValues.getReason());
|
||||
@@ -154,14 +188,15 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
float speed = autopilotStatusValues.getSpeed();
|
||||
adasAIDLAutopilotStateModel.setState(state);
|
||||
adasAIDLAutopilotStateModel.setSpeed(speed);
|
||||
|
||||
mCurrentAutopilotStatus = state;
|
||||
mCurrentAutopilotSpeed = speed;
|
||||
for (AdasDataListener listener:iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.notifyAutopilotState(adasAIDLAutopilotStateModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,8 +209,12 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
if (endLatLon != null) {
|
||||
AdasAIDLAutopilotArriveModel adasAIDLAutopilotArriveModel = new AdasAIDLAutopilotArriveModel();
|
||||
adasAIDLAutopilotArriveModel.setCarType(result.getCarType());
|
||||
adasAIDLAutopilotArriveModel.setLat(endLatLon.getLat());
|
||||
adasAIDLAutopilotArriveModel.setLon(endLatLon.getLon());
|
||||
double lon = endLatLon.getLon();
|
||||
double lat = endLatLon.getLat();
|
||||
adasAIDLAutopilotArriveModel.setLat(lat);
|
||||
adasAIDLAutopilotArriveModel.setLon(lon);
|
||||
Logger.d(TAG,"autopilotArrive reportSite");
|
||||
reportSite(lon, lat);
|
||||
for (AdasDataListener listener:iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.autopilotArrive(adasAIDLAutopilotArriveModel);
|
||||
@@ -188,7 +227,7 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
|
||||
@Override
|
||||
public void onAutopilotRoute(String route) {
|
||||
|
||||
//todo
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -197,6 +236,7 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
for (AdasStatusListener listener :iAdasStatusListeners) {
|
||||
listener.onServiceConnected();
|
||||
}
|
||||
updateDriveStatusTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -206,4 +246,80 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
listener.onServiceDisconnected();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateDriveStatusTask() {
|
||||
Logger.d(TAG,"updateDriveStatusTask");
|
||||
mdDisposable = Flowable.interval(0,5, TimeUnit.SECONDS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.unsubscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<Long>() {
|
||||
@Override
|
||||
public void accept(@NonNull Long aLong) throws Exception {
|
||||
updateDriveStatus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateDriveStatus() {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
AutonomousDriveStatusBean request = new AutonomousDriveStatusBean(sn, mCurrentAutopilotStatus, mCurrentAutopilotSpeed);
|
||||
RequestBody requestBody = RequestBody.create( MediaType.get( "application/json;charset=UTF-8" ), GsonUtil.jsonFromObject( request ) );
|
||||
mAdasApiService.updateAutonomousDriveStatus(requestBody).
|
||||
subscribeOn( Schedulers.io() ).observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG,"updateDriveStatus success");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void reportSite( double lon, double lat) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
ReportSiteBean reportSiteBean = new ReportSiteBean(sn, lon, lat);
|
||||
RequestBody requestBody = RequestBody.create( MediaType.get( "application/json;charset=UTF-8" ), GsonUtil.jsonFromObject( reportSiteBean ) );
|
||||
mAdasApiService.updateReportSite(requestBody).
|
||||
subscribeOn( Schedulers.io() ).observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG,"autopilotArrive success");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public AdasAIDLAutopilotStateModel autopilotStateCall() {
|
||||
AdasAIDLAutopilotStateModel adasAIDLAutopilotStateModel=new AdasAIDLAutopilotStateModel();
|
||||
if (mAutopilotStatus != null) {
|
||||
adasAIDLAutopilotStateModel.setSpeed(mAutopilotStatus.getSpeed());
|
||||
adasAIDLAutopilotStateModel.setState(mAutopilotStatus.getState());
|
||||
adasAIDLAutopilotStateModel.setReason(mAutopilotStatus.getReason());
|
||||
}
|
||||
return adasAIDLAutopilotStateModel;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
|
||||
|
||||
@@ -24,9 +25,9 @@ public class AdasProvider implements IProvider {
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Logger.d(TAG, "初始化 AdasProvider 模块");
|
||||
|
||||
adasEventManager = new AdasEventManager();
|
||||
initAdas(context, adasEventManager);
|
||||
initAutoPilotBusiness(context);
|
||||
}
|
||||
|
||||
private void initAdas(Context context, AdasEventManager adasEventManager) {
|
||||
@@ -35,6 +36,10 @@ public class AdasProvider implements IProvider {
|
||||
AdasManager.getInstance().setOnAdasConnectStatusListener(adasEventManager);
|
||||
}
|
||||
|
||||
private void initAutoPilotBusiness(Context context) {
|
||||
AdasAutoPilotManager.getInstance().initSocket(context);
|
||||
}
|
||||
|
||||
public void addAdasEventListener(AdasDataListener listener) {
|
||||
adasEventManager.addEventListener(listener);
|
||||
}
|
||||
@@ -51,8 +56,46 @@ public class AdasProvider implements IProvider {
|
||||
adasEventManager.removeStatusListener(listener);
|
||||
}
|
||||
|
||||
public void removeAdasStatusListener() {
|
||||
adasEventManager.removeStatusListener();
|
||||
}
|
||||
|
||||
public void sendWsMessage(String msg) {
|
||||
AdasManager.getInstance().aiCloudToAdasData(msg);
|
||||
}
|
||||
|
||||
public void cancelPilot() {
|
||||
if (AdasManager.getInstance().isSocketConnect()) {
|
||||
AdasManager.getInstance().controlAutopilotCarHead();
|
||||
}
|
||||
}
|
||||
|
||||
public void hideAdas() {
|
||||
|
||||
}
|
||||
|
||||
public void showAdas() {
|
||||
|
||||
}
|
||||
|
||||
public void killAdas() {
|
||||
|
||||
}
|
||||
|
||||
//原ADAS sdk中为空实现
|
||||
public void settingCarModelListInfo(String msg) {
|
||||
|
||||
}
|
||||
|
||||
//原ADAS sdk中为空实现
|
||||
public void setSettingStatus(boolean show) {
|
||||
}
|
||||
|
||||
//原ADAS sdk中为空实现
|
||||
public void setUseAlgorithm(boolean open) {
|
||||
}
|
||||
|
||||
public AdasAIDLAutopilotStateModel autopilotStateCall() {
|
||||
return adasEventManager.autopilotStateCall();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/28 16:12
|
||||
*/
|
||||
public class AutonomousDriveStatusBean {
|
||||
|
||||
private String sn;
|
||||
private int status;
|
||||
private float vehicleSpeed;
|
||||
|
||||
public AutonomousDriveStatusBean(String sn, int status, float vehicleSpeed) {
|
||||
this.sn = sn;
|
||||
this.status = status;
|
||||
this.vehicleSpeed = vehicleSpeed;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public float getVehicleSpeed() {
|
||||
return vehicleSpeed;
|
||||
}
|
||||
|
||||
public void setVehicleSpeed(float vehicleSpeed) {
|
||||
this.vehicleSpeed = vehicleSpeed;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/28 14:24
|
||||
*/
|
||||
public interface IAdasApiService {
|
||||
|
||||
//上传自动驾驶状态接口
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-carDataService/autonomousDrive/updateAutonomousDriveStatus" )
|
||||
Observable<BaseData> updateAutonomousDriveStatus(@Body RequestBody requestBody );
|
||||
//站点上报
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-carDataService/autonomousDrive/reportSite" )
|
||||
Observable<BaseData> updateReportSite(@Body RequestBody requestBody );
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/31 16:24
|
||||
*/
|
||||
public class ReportSiteBean {
|
||||
private String sn;
|
||||
private double lon;
|
||||
private double lat;
|
||||
|
||||
public ReportSiteBean(String sn, double lon, double lat) {
|
||||
this.sn = sn;
|
||||
this.lon = lon;
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
public class AdasAutoPilotLocReceiverBean {
|
||||
|
||||
private int poiId;
|
||||
private double lat;
|
||||
private double lon;
|
||||
private String poiAddress;
|
||||
private long systemTime;
|
||||
|
||||
public AdasAutoPilotLocReceiverBean(int poiId, double lat, double lon, String poiAddress, long systemTime) {
|
||||
this.poiId = poiId;
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
this.poiAddress = poiAddress;
|
||||
this.systemTime = systemTime;
|
||||
}
|
||||
|
||||
public int getPoiId() {
|
||||
return poiId;
|
||||
}
|
||||
|
||||
public void setPoiId(int poiId) {
|
||||
this.poiId = poiId;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public String getPoiAddress() {
|
||||
return poiAddress;
|
||||
}
|
||||
|
||||
public void setPoiAddress(String poiAddress) {
|
||||
this.poiAddress = poiAddress;
|
||||
}
|
||||
|
||||
public long getSystemTime() {
|
||||
return systemTime;
|
||||
}
|
||||
|
||||
public void setSystemTime(long systemTime) {
|
||||
this.systemTime = systemTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AdasAutoPilotLocReceiverBean{" +
|
||||
"poiId=" + poiId +
|
||||
", lat=" + lat +
|
||||
", lon=" + lon +
|
||||
", poiAddress='" + poiAddress + '\'' +
|
||||
", systemTime=" + systemTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/28 16:12
|
||||
*/
|
||||
public class AutonomousDriveStatusBean {
|
||||
|
||||
private String sn;
|
||||
private int status;
|
||||
private float vehicleSpeed;
|
||||
|
||||
public AutonomousDriveStatusBean(String sn, int status, float vehicleSpeed) {
|
||||
this.sn = sn;
|
||||
this.status = status;
|
||||
this.vehicleSpeed = vehicleSpeed;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public float getVehicleSpeed() {
|
||||
return vehicleSpeed;
|
||||
}
|
||||
|
||||
public void setVehicleSpeed(float vehicleSpeed) {
|
||||
this.vehicleSpeed = vehicleSpeed;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/31 16:24
|
||||
*/
|
||||
public class ReportSiteBean {
|
||||
private String sn;
|
||||
private double lon;
|
||||
private double lat;
|
||||
|
||||
public ReportSiteBean(String sn, double lon, double lat) {
|
||||
this.sn = sn;
|
||||
this.lon = lon;
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.adas;
|
||||
package com.mogo.module.adas.entity;
|
||||
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.module.adas.view;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.module.adas.R;
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
|
||||
public class DispatchRemindDialog extends BaseFloatDialog {
|
||||
|
||||
public DispatchRemindDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
setContentView(R.layout.dialog_adas_dispatch_remind);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="@dimen/adas_dispatch_remind_dialog_corner"/>
|
||||
<solid android:color="@color/adas_dispatch_remind_background"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="@dimen/adas_dispatch_remind_dialog_width"
|
||||
android:layout_height="@dimen/adas_dispatch_remind_dialog_height"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<TextView
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="adas_dispatch_remind_dialog_width">950px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_height">540px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_corner">32px</dimen>
|
||||
</resources>
|
||||
6
modules/mogo-module-adas/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="adas_dispatch_remind_loc">#1F9BFE</color>
|
||||
<color name="adas_dispatch_remind_background">#E63B4577</color>
|
||||
<color name="adas_dispatch_remind_count_down_bg">#4D000000</color>
|
||||
</resources>
|
||||
6
modules/mogo-module-adas/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="adas_dispatch_remind_dialog_width">950px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_height">540px</dimen>
|
||||
<dimen name="adas_dispatch_remind_dialog_corner">32px</dimen>
|
||||
</resources>
|
||||
@@ -380,10 +380,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mSwitchMapModeImage = (ImageView) findViewById(R.id.module_switch_model_icon);
|
||||
mSwitchMapModeLayout.setOnClickListener(clickListener);
|
||||
mSwitchText = (TextView) findViewById(R.id.module_switch_model_text);
|
||||
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_LENOVO) {
|
||||
enterVrMode();
|
||||
}
|
||||
}
|
||||
|
||||
private int debugPanelClickCount = 0;
|
||||
@@ -393,7 +389,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
private Group groupFix;
|
||||
|
||||
private void enterVrMode() {
|
||||
if (!localIsVrMode) {
|
||||
tvEnterVrMode.setVisibility(View.GONE);
|
||||
mMove2CurrentLocation.setVisibility(View.GONE);
|
||||
mUploadRoadCondition.setVisibility(View.GONE);
|
||||
@@ -415,11 +410,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
flSpeed.setVisibility(View.VISIBLE);
|
||||
mSwitchMapModeLayout.setVisibility(View.VISIBLE);
|
||||
mApis.getV2XListenerManager().changeTipWindowStatusForListener(ACTION_V2X_REMOVE_TIP_WINDOW);
|
||||
}
|
||||
}
|
||||
|
||||
private void exitVrMode() {
|
||||
if (localIsVrMode) {
|
||||
EntranceViewHolder.getInstance().forceHideNoticeView();
|
||||
tvEnterVrMode.setVisibility(View.VISIBLE);
|
||||
mMove2CurrentLocation.setVisibility(View.VISIBLE);
|
||||
@@ -443,7 +436,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
flSpeed.setVisibility(View.GONE);
|
||||
mSwitchMapModeLayout.setVisibility(View.GONE);
|
||||
clTrafficLight.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void debugCrashWarn() {
|
||||
@@ -722,29 +714,21 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
TopViewAnimHelper.getInstance().setIMogoMapUIController(mMApUIController);
|
||||
TopViewNoLinkageAnimHelper.getInstance().setIMogoMapUIController(mMApUIController);
|
||||
|
||||
// 进入vr模式,不可缩放地图
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_LENOVO) {
|
||||
UiThreadHandler.postDelayed(this::stepIntoVrMode, 3_500L);
|
||||
}
|
||||
|
||||
mClickShareVoiceStrings =
|
||||
getContext().getResources().getStringArray(R.array.click_share_voice_guide_array);
|
||||
mInnerGuideVoiceStrings =
|
||||
getContext().getResources().getStringArray(R.array.search_voice_guide_inner_array);
|
||||
mOuterGuideVoiceStrings =
|
||||
getContext().getResources().getStringArray(R.array.search_voice_guide_outer_array);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入鹰眼模式,设置手势缩放地图失效
|
||||
*/
|
||||
private void stepIntoVrMode() {
|
||||
Logger.d(TAG, "进入vr模式");
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getMapServiceApi()
|
||||
.getMapUIController()
|
||||
.openVrMode(false);
|
||||
//TODO 因为衡阳6.30交付没有2D模式,临时方案,进入vr模式,不可缩放地图
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_LENOVO) {
|
||||
// 进入鹰眼模式,设置手势缩放地图失效
|
||||
Logger.d(TAG, "进入vr模式");
|
||||
mMApUIController.changeMapMode(EnumMapUI.Type_VR);
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,9 +7,14 @@
|
||||
<!-- <stroke-->
|
||||
<!-- android:width="1dp"-->
|
||||
<!-- android:color="#182155" />-->
|
||||
<!-- <corners-->
|
||||
<!-- android:bottomLeftRadius="@dimen/dp_100"-->
|
||||
<!-- android:bottomRightRadius="@dimen/dp_20"-->
|
||||
<!-- android:topLeftRadius="@dimen/dp_20"-->
|
||||
<!-- android:topRightRadius="@dimen/dp_100" />-->
|
||||
<corners
|
||||
android:bottomLeftRadius="@dimen/dp_100"
|
||||
android:bottomRightRadius="@dimen/dp_20"
|
||||
android:topLeftRadius="@dimen/dp_20"
|
||||
android:topRightRadius="@dimen/dp_100" />
|
||||
android:bottomLeftRadius="130px"
|
||||
android:bottomRightRadius="30px"
|
||||
android:topLeftRadius="30px"
|
||||
android:topRightRadius="130px" />
|
||||
</shape>
|
||||
@@ -5,7 +5,7 @@
|
||||
<dimen name="module_ext_speed_height">460px</dimen>
|
||||
<dimen name="module_ext_arcView_width">320px</dimen>
|
||||
<dimen name="module_ext_arcView_height">320px</dimen>
|
||||
<dimen name="module_ext_arcView_stroke_with">15px</dimen>
|
||||
<dimen name="module_ext_arcView_stroke_with">20px</dimen>
|
||||
<dimen name="module_ext_arcView_center_text_size">110px</dimen>
|
||||
<dimen name="module_ext_arcView_des_text_size">40px</dimen>
|
||||
<dimen name="module_switch_map">279px</dimen>
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<item>提前看看出行路况,试试唤醒小智说,“中关村路况怎么样”</item>
|
||||
</string-array>
|
||||
|
||||
<string name="module_map_model_normal">默认视角</string>
|
||||
<string name="module_map_model_normal">近距视角</string>
|
||||
<string name="module_map_model_faster">远距视角</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -437,7 +437,9 @@ public class MogoServices implements IMogoMapListener,
|
||||
// isNeedUploadCoordinatesDurationInTime() ) { //todo 实时在线车辆需要注释,否则在2D模式下不能展示
|
||||
// }
|
||||
//请求在线车辆数据,刷新地图在线车辆
|
||||
MapMarkerManager.getInstance().getOnlineCarDataByAutoRefreshStrategy( ro.mLonLat );
|
||||
if (!mLastStatusIsVr){
|
||||
MapMarkerManager.getInstance().getOnlineCarDataByAutoRefreshStrategy( ro.mLonLat );
|
||||
}
|
||||
|
||||
Logger.i( TAG, "刷新半径 = %s, 点 = %s, zoomLevel = %s, amount = %s", ro.mRadius, ro.mLonLat, mLastZoomLevel, ro.mAmount );
|
||||
}
|
||||
@@ -938,6 +940,8 @@ public class MogoServices implements IMogoMapListener,
|
||||
|
||||
@Override
|
||||
public void onMapModeChanged( EnumMapUI ui ) {
|
||||
Log.i(TAG, "onMapModeChanged:" + ui);
|
||||
clearAllData();
|
||||
if ( ui == EnumMapUI.Type_VR ) {
|
||||
if ( !mLastStatusIsVr ) {
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.service.launchercard.LauncherCardRefresher;
|
||||
import com.mogo.module.service.marker.MapMarkerManager;
|
||||
import com.mogo.module.service.strategy.CarIconDisplayStrategy;
|
||||
import com.mogo.module.service.vrmode.VrModeController;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
@@ -90,7 +89,6 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
MogoServices.getInstance().unregisterInternalUnWakeupWords();
|
||||
MogoServices.getInstance().stopAutoRefreshStrategy();
|
||||
}
|
||||
VrModeController.getInstance().onMainPageResumeStatusChanged(resume);
|
||||
}
|
||||
|
||||
public void onMainPageIsBackgroundStatusChanged(boolean isBackground) {
|
||||
@@ -163,7 +161,6 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
}
|
||||
|
||||
public void onVrModeChanged(boolean isVrMode) {
|
||||
VrModeController.getInstance().onVrModeChanged(isVrMode);
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSeekHelping()) {
|
||||
onSeekHelpingStatusChanged(true);
|
||||
}
|
||||
|
||||
@@ -617,6 +617,10 @@ public class MockIntentHandler implements IntentHandler {
|
||||
case 55:
|
||||
//开启模拟数据Mock,用于验证算法准确性
|
||||
TimeDelayUploadManager.getInstance().init(context);
|
||||
break;
|
||||
case 56:
|
||||
// 开启数据采集 自车定位和视觉识别
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.mogo.module.service.mocktools;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class DataCollectionHandler {
|
||||
|
||||
private static volatile DataCollectionHandler handler;
|
||||
private static final byte[] obj = new byte[0];
|
||||
private volatile boolean openDataCollect = false;
|
||||
|
||||
private Handler mLocationDataCollectHandler;
|
||||
private Handler mRecognizeDataCollectHandler;
|
||||
|
||||
private static final String WRITE_FILE_PATH = Environment.getExternalStorageDirectory().getPath() + File.separator + "mockWrite";
|
||||
|
||||
private DataCollectionHandler() {
|
||||
|
||||
}
|
||||
|
||||
public static DataCollectionHandler getInstance() {
|
||||
if (handler == null) {
|
||||
synchronized (obj) {
|
||||
if (handler == null) {
|
||||
handler = new DataCollectionHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
|
||||
public void start() {
|
||||
openDataCollect = true;
|
||||
}
|
||||
|
||||
public boolean canCollectData() {
|
||||
return openDataCollect;
|
||||
}
|
||||
|
||||
public void collectLocationDataToFile(String locationData) {
|
||||
if (mLocationDataCollectHandler == null) {
|
||||
mLocationDataCollectHandler = new Handler(WorkThreadHandler.newInstance("data-collect-thread").getLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public void collectRecogniseDataToFile() {
|
||||
if (mRecognizeDataCollectHandler == null) {
|
||||
mRecognizeDataCollectHandler = new Handler(WorkThreadHandler.newInstance("recognize-collect-thread").getLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
openDataCollect = false;
|
||||
mLocationDataCollectHandler = null;
|
||||
mRecognizeDataCollectHandler = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 8.7 KiB |
@@ -94,7 +94,8 @@ dependencies {
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
implementation project(':modules:mogo-module-obu')
|
||||
implementation rootProject.ext.dependencies.mebulaobu
|
||||
// implementation rootProject.ext.dependencies.mebulaobu
|
||||
implementation rootProject.ext.dependencies.mogoobu
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XObuEventEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
@@ -29,6 +30,8 @@ import com.mogo.module.v2x.utils.DrivingDirectionUtils;
|
||||
import com.mogo.module.v2x.utils.ObuConfig;
|
||||
import com.mogo.module.v2x.utils.TestOnLineCarUtils;
|
||||
import com.mogo.module.v2x.utils.ToastUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.entrance.IMogoEntranceButtonController;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -38,15 +41,26 @@ import com.zhidao.mogo.module.obu.obu.IObuCallback;
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuEventInfo;
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuLocationInfo;
|
||||
import com.zhidao.mogo.module.obu.obu.bean.MogoObuTrafficLightInfo;
|
||||
import com.zhidao.support.nebulaobu.NebulaObuClient;
|
||||
import com.zhidao.support.nebulaobu.OnObuListener;
|
||||
import com.zhidao.support.nebulaobu.model.ActiveSafetyInfo;
|
||||
import com.zhidao.support.nebulaobu.model.ObuInfo;
|
||||
import com.zhidao.support.nebulaobu.model.ObuInfoMore;
|
||||
//import com.zhidao.support.nebulaobu.NebulaObuClient;
|
||||
//import com.zhidao.support.nebulaobu.OnObuListener;
|
||||
//import com.zhidao.support.nebulaobu.model.ActiveSafetyInfo;
|
||||
//import com.zhidao.support.nebulaobu.model.ObuInfo;
|
||||
//import com.zhidao.support.nebulaobu.model.ObuInfoMore;
|
||||
|
||||
import com.zhidao.support.obu.MogoObuManager;
|
||||
import com.zhidao.support.obu.OnMogoObuListener;
|
||||
import com.zhidao.support.obu.constants.ObuConstants;
|
||||
import com.zhidao.support.obu.model.CvxAppInitIndInfo;
|
||||
import com.zhidao.support.obu.model.CvxHvCarIndInfo;
|
||||
import com.zhidao.support.obu.model.CvxHvInfoIndInfo;
|
||||
import com.zhidao.support.obu.model.CvxRvInfoIndInfo;
|
||||
import com.zhidao.support.obu.model.CvxSetConfigCfmInfo;
|
||||
import com.zhidao.support.obu.model.CvxV2vThreatIndInfo;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -85,6 +99,7 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
private final Handler handler = new Handler(this);
|
||||
private final ObuTypeExchangeReceiver obuTypeExchangeReceiver = new ObuTypeExchangeReceiver();
|
||||
private ObuManager obuManager;
|
||||
final String icw_data = "02000114010000000000001effd7892b11a4440af70100142a03000907e506100e2917019000005662010a45000b0000220847162c000037970010000a17f6215c459478b6010347ac045000090a0006012c01f4009600080073007300730073000b000000000000000000000000000000002b000037780000247300003261000000000000426c827f47001200100000000000000000000021220000349a006c0010000a17f63ecb45947ba301030000332c0010000a17f642e945947bea010300004d580010000a17f6435545947e4e0103000054c40010000a17f6413a45947f96010300005c300010000a17f62c2845947d140103000070e40010000a17f5fdb14594786001030000992000060004ffec2710";
|
||||
|
||||
public void init(Context context) {
|
||||
Logger.d(MODULE_NAME, "obuManager初始化--");
|
||||
@@ -94,12 +109,19 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
obuManager.registerObuDataChangedListener(this);
|
||||
|
||||
//使用adas部门obu sdk (星云)
|
||||
NebulaObuClient.getInstance().init(context);
|
||||
NebulaObuClient.getInstance().registerObu(100);
|
||||
NebulaObuClient.getInstance().registerObuListener(listener);
|
||||
// NebulaObuClient.getInstance().init(context);
|
||||
// NebulaObuClient.getInstance().registerObu(100);
|
||||
// NebulaObuClient.getInstance().registerObuListener(listener);
|
||||
|
||||
//自研obu
|
||||
MogoObuManager.getInstance().init(context);
|
||||
MogoObuManager.getInstance().connect();
|
||||
MogoObuManager.getInstance().registerListener(mogoObuListener);
|
||||
|
||||
//TODO 测试
|
||||
// MogoObuManager.getInstance().test(icw_data);
|
||||
|
||||
// UiThreadHandler.postDelayed( () -> {
|
||||
// //TODO 测试
|
||||
// MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(3, MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
||||
// handleSdkObu(1);
|
||||
//
|
||||
@@ -109,66 +131,184 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
context.registerReceiver(obuTypeExchangeReceiver, filter);
|
||||
}
|
||||
|
||||
|
||||
public void release() {
|
||||
NebulaObuClient.getInstance().unregisterObu();
|
||||
NebulaObuClient.getInstance().unregisterObuListener();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 星云obu数据监听
|
||||
*/
|
||||
private OnObuListener listener = new OnObuListener() {
|
||||
private OnMogoObuListener mogoObuListener = new OnMogoObuListener() {
|
||||
@Override
|
||||
public void onRegister() {
|
||||
public void onConnected() {
|
||||
//OBU连接成功
|
||||
Logger.d("liyz", "onConnected ------> ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectFail(boolean isNeedReconnect) {
|
||||
Logger.d("liyz", "onConnectFail ------> ");
|
||||
//OBU连接失败
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnregister() {
|
||||
public void onDisconnect() {
|
||||
Logger.d("liyz", "onDisconnect ------> ");
|
||||
//OBU断开连接
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onObuInfo(ObuInfo info) {
|
||||
Logger.d("liyz", "onObuInfo ------> " + info.toString());
|
||||
public void onReceiveOriginData(String data) {
|
||||
super.onReceiveOriginData(data);
|
||||
Logger.d("liyz", "onReceiveOriginData ------> data = " + data);
|
||||
//接收到的原始数据
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWarningInfo(List<ActiveSafetyInfo> infoList) {
|
||||
if (infoList != null) {
|
||||
if (infoList.size() > 0) { //一般只有一个
|
||||
ActiveSafetyInfo info = infoList.get(0);
|
||||
Logger.d("liyz", "onWarningInfo type ------> " + info.getWarningtype() + "--size = " + infoList.size());
|
||||
if (info.getWarningtype() == 3) {
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
handleSdkObu(2);
|
||||
}
|
||||
}
|
||||
public void onSendData(byte[] bytes) {
|
||||
super.onSendData(bytes);
|
||||
//发送的数据
|
||||
Logger.d("liyz", "onSendData ------> ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCvxAppInitIndInfo(CvxAppInitIndInfo info) {
|
||||
super.onCvxAppInitIndInfo(info);
|
||||
Logger.d("liyz", "onCvxAppInitIndInfo ------> " + info.toString());
|
||||
//CV2X系统信息
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCvxSetConfigCfm(CvxSetConfigCfmInfo info) {
|
||||
super.onCvxSetConfigCfm(info);
|
||||
Logger.d("liyz", "onCvxSetConfigCfm ------> " + info.toString());
|
||||
//设置CV2X系统的配置确认
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCvxHvCarIndInfo(CvxHvCarIndInfo info) {
|
||||
//主车车辆信息
|
||||
Logger.d("liyz", "onCvxHvCarIndInfo ------> " + info.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCvxHvInfoIndInfo(CvxHvInfoIndInfo info) {
|
||||
//主车信息
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCvxRvInfoIndInfo(CvxRvInfoIndInfo info) {
|
||||
//远车信息
|
||||
Logger.d("liyz", "onCvxRvInfoIndInfo ------> " + info.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCvxV2vThreatIndInfo(CvxV2vThreatIndInfo info) {
|
||||
//预警信息
|
||||
Logger.e("liyz", "onCvxV2vThreatIndInfo ------> " + info.toString());
|
||||
//预警类型 threat_level 3
|
||||
if (info != null) {
|
||||
if (info.getThreat_info() != null && info.getControl() != null &&
|
||||
info.getThreat_info().getThreat_level() == 3) { //看看2的情况
|
||||
//预警方位
|
||||
int direction = V2XUtils.getDirection((float) info.getExt_info().getAzimuth());
|
||||
Log.d("liyz", "direction = " + direction + "---azimuth = " + (float) info.getExt_info().getAzimuth());
|
||||
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(direction, MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
||||
|
||||
//处理预警类型
|
||||
int appId = info.getThreat_info().getApp_id();
|
||||
handleSdkObu(getEventType(appId));
|
||||
}
|
||||
|
||||
//预警数据的组装,车辆实时移动和变色 TODO 这里需要obu提供他车列表
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(getResultList(info));
|
||||
} else {
|
||||
Log.e("liyz", "info == null ");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private int getEventType(int appid) {
|
||||
if (appid == ObuConstants.USE_CASE_ID.EBW) {
|
||||
return ObuConstant.TYPE_URGENCY_COLLISION_WARNING;
|
||||
} else if (appid == ObuConstants.USE_CASE_ID.ICW) {
|
||||
return ObuConstant.TYPE_CROSS_COLLISION_WARNING;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private List<ADASRecognizedResult> resultList = null;
|
||||
|
||||
private List<ADASRecognizedResult> getResultList(CvxV2vThreatIndInfo info) {
|
||||
if (resultList == null) {
|
||||
resultList = new ArrayList<>();
|
||||
}
|
||||
|
||||
ADASRecognizedResult adasRecognizedResult = new ADASRecognizedResult();
|
||||
adasRecognizedResult.uuid = info.getVehicle_id();
|
||||
if (info.getBasic_info() != null && info.getBasic_info().getPosition() != null) {
|
||||
adasRecognizedResult.lat = info.getBasic_info().getPosition().getLatitude();
|
||||
adasRecognizedResult.lon = info.getBasic_info().getPosition().getLongitude();
|
||||
}
|
||||
adasRecognizedResult.type = 3; //小轿车
|
||||
adasRecognizedResult.heading = info.getBasic_info().getHeading();
|
||||
adasRecognizedResult.speed = info.getBasic_info().getSpeed();
|
||||
|
||||
resultList.add(adasRecognizedResult);
|
||||
|
||||
return resultList;
|
||||
|
||||
}
|
||||
|
||||
// public void release() {
|
||||
// NebulaObuClient.getInstance().unregisterObu();
|
||||
// NebulaObuClient.getInstance().unregisterObuListener();
|
||||
// MogoObuManager.getInstance().unregisterListener();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 星云obu数据监听
|
||||
*/
|
||||
// private OnObuListener listener = new OnObuListener() {
|
||||
// @Override
|
||||
// public void onRegister() {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onConnectFail(boolean isNeedReconnect) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onUnregister() {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onObuInfo(ObuInfo info) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onWarningInfo(List<ActiveSafetyInfo> infoList) {
|
||||
// if (infoList != null) {
|
||||
// if (infoList.size() > 0) { //一般只有一个
|
||||
// ActiveSafetyInfo info = infoList.get(0);
|
||||
// Logger.d("liyz", "onWarningInfo type ------> " + info.getWarningtype() + "--size = " + infoList.size());
|
||||
// if (info.getWarningtype() == 3) {
|
||||
// if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
// handleSdkObu(2);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
private void handleSdkObu(int type) {
|
||||
V2XMessageEntity<V2XObuEventEntity> messageEntity = new V2XMessageEntity<>();
|
||||
messageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_OBU_EVENT);
|
||||
|
||||
V2XObuEventEntity urgencyEvent = new V2XObuEventEntity();
|
||||
if (type == 1) { //交叉路口碰撞预警 TODO
|
||||
if (type == ObuConstant.TYPE_CROSS_COLLISION_WARNING) { //交叉路口碰撞预警
|
||||
urgencyEvent.setType(ObuConstant.TYPE_CROSS_COLLISION_WARNING);
|
||||
urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_CROING_WARN_TEXT);
|
||||
} else if (type == 2) { // 前车紧急制动预警
|
||||
} else if (type == ObuConstant.TYPE_URGENCY_COLLISION_WARNING) { // 前车紧急制动预警
|
||||
urgencyEvent.setType(ObuConstant.TYPE_URGENCY_COLLISION_WARNING);
|
||||
urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_COLLISION_WARN_TEXT);
|
||||
} else {
|
||||
urgencyEvent.setType(ObuConstant.TYPE_URGENCY_COLLISION_WARNING);
|
||||
urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_COLLISION_WARN_TEXT);
|
||||
// urgencyEvent.setType(ObuConstant.TYPE_URGENCY_COLLISION_WARNING);
|
||||
// urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_COLLISION_WARN_TEXT);
|
||||
}
|
||||
|
||||
messageEntity.setContent(urgencyEvent);
|
||||
@@ -367,7 +507,7 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
// 暂无设计图,先简单显示
|
||||
V2XObuEventEntity tmpEvent = new V2XObuEventEntity();
|
||||
tmpEvent.setType(eventType);
|
||||
tmpEvent.setDesc(info.getType()+"--"+info.getDescribe());
|
||||
tmpEvent.setDesc(info.getType() + "--" + info.getDescribe());
|
||||
messageEntity.setContent(tmpEvent);
|
||||
V2XObuEventScenario.getInstance().init(messageEntity);
|
||||
break;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class V2XObuEventScenario extends AbsV2XScenario<V2XObuEventEntity> imple
|
||||
|
||||
public static final String URGENCY_COLLISION_WARN_TEXT_ONE = "前车急刹,注意保持安全距离!";
|
||||
public static final String URGENCY_COLLISION_WARN_TEXT = "前车急刹";
|
||||
public static final String URGENCY_CROING_WARN_TEXT = "交叉路口碰撞预警";
|
||||
public static final String URGENCY_CROING_WARN_TEXT = "注意交叉路口车辆";
|
||||
|
||||
private static final int MSG_CLOSE_OBU_WINDOW = 1001;
|
||||
private static final int DEFAULT_EXPIRE_TIME = 20_000;
|
||||
|
||||
@@ -85,7 +85,7 @@ public class V2XObuEventWindow extends FrameLayout implements IV2XWindow<V2XObuE
|
||||
break;
|
||||
case ObuConstant.TYPE_CROSS_COLLISION_WARNING:
|
||||
// 交叉路口碰撞预警
|
||||
ivTypeIcon.setImageResource(R.drawable.v2x_icon_ahead_car_brake);
|
||||
ivTypeIcon.setImageResource(R.drawable.v2x_icon_car_collide_warning);
|
||||
tvDesc.setText(entity.getDesc());
|
||||
tvType.setText("交叉路口碰撞预警");
|
||||
tvType.setBackgroundResource(R.drawable.bg_v2x_event_type_read);
|
||||
|
||||
@@ -79,8 +79,6 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
Log.d(TAG, "显示时间为++" + String.valueOf(showTime));
|
||||
pointsBetween();
|
||||
bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing();
|
||||
//预警蒙层
|
||||
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(mCloundWarningInfo.getDirection(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
||||
isSelfLineClear = false;
|
||||
isFirstLocation = false;
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS);
|
||||
@@ -127,6 +125,9 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
isSelfLineClear = true;
|
||||
}, showTime);
|
||||
}
|
||||
//预警蒙层
|
||||
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(mCloundWarningInfo.getDirection(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -779,4 +779,16 @@ public class V2XUtils {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public static int getDirection(float degree) {
|
||||
if (degree > 45 && degree < 135) {
|
||||
return 1; //前方
|
||||
} else if (degree > 135 && degree < 225) {
|
||||
return 4; //右方
|
||||
} else if ((degree < 45 && degree > 0) || degree < 360 && degree > 315) {
|
||||
return 3; //左方
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 7.1 KiB |
@@ -2,7 +2,7 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="328dp" android:height="98dp">
|
||||
<shape android:shape="rectangle">
|
||||
<gradient android:angle="360" android:endColor="#ff616381" android:startColor="#ff48495e" />
|
||||
<gradient android:angle="360" android:endColor="#5060BC" android:startColor="#5060BC" />
|
||||
<corners android:radius="@dimen/dp_20" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#3D4053"
|
||||
android:background="#3B4577"
|
||||
android:gravity="center"
|
||||
app:roundLayoutRadius="@dimen/dp_30"
|
||||
tools:layout_height="@dimen/module_v2x_event_see_live_window_height">
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/module_v2x_event_see_live_window_height"
|
||||
android:background="@color/live_video_background_color"
|
||||
android:background="#3B4577"
|
||||
app:roundLayoutRadius="@dimen/dp_20">
|
||||
|
||||
<com.mogo.module.v2x.view.SimpleLiveVideoPlayer
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.RemoteException;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -47,7 +46,6 @@ import com.zhidao.adasconfig.api.AdasConfigApiController;
|
||||
import com.zhidao.adasconfig.common.config.EnumCarChatIncognitoMode;
|
||||
import com.zhidao.adasconfig.common.config.EnumCarHeading;
|
||||
import com.zhidao.adasconfig.common.config.EnumSkinStyle;
|
||||
import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarRectModel;
|
||||
@@ -142,6 +140,9 @@ public class MogoADASController implements IMogoADASController {
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
|
||||
|
||||
ADASCarStateInfo stateInfo = GsonUtil.objectFromJson(((String) msg.obj), ADASCarStateInfo.class);
|
||||
if (stateInfo == null || stateInfo.getValues() == null) {
|
||||
Logger.d(TAG, "ADAS-LOC-timer", "upd 到 aidl 传输数据 stateInfo or stateInfo.getValues() is null");
|
||||
@@ -298,7 +299,8 @@ public class MogoADASController implements IMogoADASController {
|
||||
@Override
|
||||
public void killADAS() {
|
||||
try {
|
||||
AutopilotServiceManage.getInstance().kill();
|
||||
//AutopilotServiceManage.getInstance().kill();
|
||||
adasProvider.killAdas();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
@@ -306,6 +308,16 @@ public class MogoADASController implements IMogoADASController {
|
||||
|
||||
private volatile boolean needEmphasizeMyLocation = false;
|
||||
|
||||
private void testOCH() {
|
||||
RemoteControlAutoPilotParameters currentAutopilot = new RemoteControlAutoPilotParameters();
|
||||
currentAutopilot.isSpeakVoice = true;
|
||||
currentAutopilot.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( 0, 1 );
|
||||
currentAutopilot.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( 2, 3 );
|
||||
currentAutopilot.vehicleType = 10;
|
||||
Logger.d( TAG, "开启自动驾驶====" + currentAutopilot );
|
||||
aiCloudToAdasData(currentAutopilot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showADAS() {
|
||||
|
||||
@@ -328,6 +340,9 @@ public class MogoADASController implements IMogoADASController {
|
||||
info.setSn(MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
AdasManager.getInstance().setBasicInfo(info);
|
||||
invokeShowADASOperation();
|
||||
|
||||
//测试网约车
|
||||
//testOCH();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -386,7 +401,8 @@ public class MogoADASController implements IMogoADASController {
|
||||
// 向adas发送车模list
|
||||
String carModelList = SharedPrefsMgr.getInstance(context).getString("CAR_MODEL_LIST", "");
|
||||
if (carModelList != null && !carModelList.isEmpty()) {
|
||||
AutopilotServiceManage.getInstance().settingCarModelListInfo(carModelList);
|
||||
//AutopilotServiceManage.getInstance().settingCarModelListInfo(carModelList);
|
||||
adasProvider.settingCarModelListInfo(carModelList);
|
||||
}
|
||||
// 此处进行网络请求,请求成功后再通知一次adas
|
||||
requestCarModelList();
|
||||
@@ -530,7 +546,8 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
|
||||
try {
|
||||
AutopilotServiceManage.getInstance().showAdas();
|
||||
//AutopilotServiceManage.getInstance().showAdas();
|
||||
adasProvider.showAdas();
|
||||
} catch (Exception e) {
|
||||
Intent intent = new Intent(ACTION);
|
||||
intent.putExtra(PARAM_COMMAND, VAL_COMMAND);
|
||||
@@ -553,7 +570,8 @@ public class MogoADASController implements IMogoADASController {
|
||||
Logger.d(TAG, "close adas");
|
||||
|
||||
try {
|
||||
AutopilotServiceManage.getInstance().hideAdas();
|
||||
//AutopilotServiceManage.getInstance().hideAdas();
|
||||
adasProvider.hideAdas();
|
||||
} catch (Exception e) {
|
||||
Intent intent = new Intent(ACTION);
|
||||
intent.putExtra(PARAM_COMMAND, VAL_COMMAND);
|
||||
@@ -582,7 +600,7 @@ public class MogoADASController implements IMogoADASController {
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
AutopilotServiceManage.getInstance().init(context);
|
||||
//AutopilotServiceManage.getInstance().init(context);
|
||||
mIsReleased = false;
|
||||
mAdasMessageFactory = new MyMessageFactory();
|
||||
adasProvider = ARouter.getInstance().navigation(AdasProvider.class);
|
||||
@@ -591,12 +609,14 @@ public class MogoADASController implements IMogoADASController {
|
||||
|
||||
@Override
|
||||
public void setSettingStatus(boolean show) {
|
||||
AutopilotServiceManage.getInstance().setSettingStatus(show);
|
||||
//AutopilotServiceManage.getInstance().setSettingStatus(show);
|
||||
adasProvider.setSettingStatus(show);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseAlgorithm(boolean open) {
|
||||
AutopilotServiceManage.getInstance().setUseAlgorithm(open);
|
||||
//AutopilotServiceManage.getInstance().setUseAlgorithm(open);
|
||||
adasProvider.setUseAlgorithm(open);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -667,21 +687,16 @@ public class MogoADASController implements IMogoADASController {
|
||||
AdasControlCommandParameter parameter = new AdasControlCommandParameter(action, result);
|
||||
//位置信息 action是aiCloudToStartAutopilot
|
||||
try {
|
||||
AutopilotServiceManage.getInstance().aiCloudToAdasData(GsonUtil.jsonFromObject(parameter));
|
||||
//AutopilotServiceManage.getInstance().aiCloudToAdasData(GsonUtil.jsonFromObject(parameter));
|
||||
adasProvider.sendWsMessage(GsonUtil.jsonFromObject(parameter));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static final String TEST_SN = "ZD802B1932L00617";
|
||||
private String currentSn = TEST_SN;
|
||||
|
||||
private void requestCarModelList() {
|
||||
Map<String, String> params = new HashMap<>(8);
|
||||
params.put("sn", MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
// currentSn = useTestSn ? TEST_SN : MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
// params.put("sn", currentSn);
|
||||
|
||||
SingletonsHolder.get(IMogoNetwork.class).create(CarModelInfoNetApiServices.class, CarModelInfoNetApiServices.getBaseUrl()).
|
||||
requestCarModelList(params).
|
||||
subscribeOn(Schedulers.io()).
|
||||
@@ -695,7 +710,8 @@ public class MogoADASController implements IMogoADASController {
|
||||
String value = GsonUtil.jsonFromObject(o.getResult());
|
||||
SharedPrefsMgr.getInstance(context).putString("CAR_MODEL_LIST", value);
|
||||
if (value != null && !value.isEmpty()) {
|
||||
AutopilotServiceManage.getInstance().settingCarModelListInfo(value);
|
||||
//AutopilotServiceManage.getInstance().settingCarModelListInfo(value);
|
||||
adasProvider.settingCarModelListInfo(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -719,7 +735,8 @@ public class MogoADASController implements IMogoADASController {
|
||||
mIsReleased = true;
|
||||
//AutopilotServiceManage.getInstance().unRegisterAutopilotDataListener( mAutopolitDataCallBack );
|
||||
adasProvider.removeAdasEventListener(mAdasDataListener);
|
||||
AutopilotServiceManage.getInstance().release();
|
||||
adasProvider.removeAdasStatusListener();
|
||||
//AutopilotServiceManage.getInstance().release();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -829,7 +846,8 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
int status = IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE;
|
||||
try {
|
||||
status = AutopilotServiceManage.getInstance().autopilotStateCall().getState();
|
||||
//status = AutopilotServiceManage.getInstance().autopilotStateCall().getState();
|
||||
status = adasProvider.autopilotStateCall().getState();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -854,11 +872,12 @@ public class MogoADASController implements IMogoADASController {
|
||||
|
||||
@Override
|
||||
public void cancelAutopilot() {
|
||||
try {
|
||||
AutopilotServiceManage.getInstance().cancelAutopilot();
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//try {
|
||||
//AutopilotServiceManage.getInstance().cancelAutopilot();
|
||||
adasProvider.cancelPilot();
|
||||
//} catch (RemoteException e) {
|
||||
// e.printStackTrace();
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -159,7 +159,7 @@ public class MogoStatusManager implements IMogoStatusManager {
|
||||
|
||||
private boolean get_bool_val(StatusDescriptor descriptor ) {
|
||||
Boolean val = mStatus.get( descriptor );
|
||||
return val == null ? false : val;
|
||||
return val != null && val;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||