Merge remote-tracking branch 'origin/dev2' into dev2
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -89,7 +89,6 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -18,4 +18,9 @@ interface IMogoOCHTaxiArriveCallback {
|
||||
* 到达终点站
|
||||
*/
|
||||
void onArriveAtEndStation();
|
||||
|
||||
/**
|
||||
* 去往目的地的路上
|
||||
*/
|
||||
void onTheWay2EndStation();
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
@@ -56,16 +58,11 @@ class MogoOCHTaxiModel {
|
||||
*/
|
||||
public static final String SP_KEY_OCH_TAXI_ORDER = "SP_KEY_OCH_TAXI_ORDER";
|
||||
|
||||
/**
|
||||
* 是否已开启自动驾驶
|
||||
*/
|
||||
public static final String SP_KEY_START_AUTO_PILOT = "SP_KEY_START_AUTO_PILOT";
|
||||
|
||||
private OrderMsgListener mOrderMsgListener;
|
||||
private OrderStatusMsgListener mOrderStatusMsgListener;
|
||||
private OCHTaxiServiceApi mOCHTaxiServiceApi;
|
||||
private Context mContext;
|
||||
private OCHTaxiResponse mCurrentOCHOrder;
|
||||
private OCHTaxiOrderResponse mCurrentOCHOrder;
|
||||
private OCHArriveNotifyCallback mNotifyCallback;
|
||||
private IMogoCarLocationChangedListener2 mCarLocationChangedListener2;
|
||||
|
||||
@@ -74,11 +71,21 @@ class MogoOCHTaxiModel {
|
||||
*/
|
||||
private boolean mIsArriveAtStartStation = false;
|
||||
|
||||
/**
|
||||
* 是否在去往终点站的路上
|
||||
*/
|
||||
private boolean mIsOnTheWay2EndStation = false;
|
||||
|
||||
/**
|
||||
* 是否达到终点
|
||||
*/
|
||||
private boolean mIsArriveAtEndStation = false;
|
||||
|
||||
/**
|
||||
* 查询订单信息重试次数
|
||||
*/
|
||||
private int mRetryCounter = 0;
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
@@ -101,16 +108,109 @@ class MogoOCHTaxiModel {
|
||||
.addAdasOCHCallback( mNotifyCallback = new OCHArriveNotifyCallback() );
|
||||
|
||||
// 订单恢复
|
||||
// String orderInfo = SharedPrefsMgr.getInstance( mContext ).getString( SP_KEY_OCH_TAXI_ORDER );
|
||||
// if ( !TextUtils.isEmpty( orderInfo ) ) {
|
||||
// mCurrentOCHOrder = GsonUtil.objectFromJson( orderInfo, OCHTaxiResponse.class );
|
||||
// if ( mCurrentOCHOrder == null ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( !isAutoPilotStarted() ) {
|
||||
// mOrderMsgListener.onMsgReceived( mCurrentOCHOrder );
|
||||
// }
|
||||
// }
|
||||
String orderInfo = SharedPrefsMgr.getInstance( mContext ).getString( SP_KEY_OCH_TAXI_ORDER );
|
||||
if ( !TextUtils.isEmpty( orderInfo ) ) {
|
||||
mCurrentOCHOrder = GsonUtil.objectFromJson( orderInfo, OCHTaxiOrderResponse.class );
|
||||
if ( mCurrentOCHOrder == null ) {
|
||||
clearCurrentOCHOrder();
|
||||
return;
|
||||
}
|
||||
mRetryCounter = 0;
|
||||
queryOldOrder2RestoreOrderStatus( mCurrentOCHOrder.orderNo );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单状态,来恢复旧订单(因crash导致应用重启等)状态
|
||||
* <p>
|
||||
* 已结束、已取消:清除订单状态
|
||||
* 已到达目的地:更新UI,显示到达目的地状态
|
||||
* 已到达起始地:更新UI,显示已到达起始地状态
|
||||
* 在去往目的地的路上:显示去往目的地的路上
|
||||
* 在去往起始地的路上、未获取具体状态:以新接收订单开始处理
|
||||
*
|
||||
* @param orderNo
|
||||
*/
|
||||
private void queryOldOrder2RestoreOrderStatus( String orderNo ) {
|
||||
queryOCHOrderStatus( orderNo, new OCHOrderStatusCallback< OCHTaxiOrderResponse2 >() {
|
||||
@Override
|
||||
public void onSuccess( OCHTaxiOrderResponse2 data ) {
|
||||
if ( data == null && data.result != null ) {
|
||||
clearCurrentOCHOrder();
|
||||
return;
|
||||
}
|
||||
convertCurrentOrder( data );
|
||||
OCHOrderStatus status = OCHOrderStatus.valueOf( data.result.orderDispatchType );
|
||||
switch ( status ) {
|
||||
case Completed:
|
||||
case Cancel:
|
||||
clearCurrentOCHOrder();
|
||||
break;
|
||||
case ArriveAtEndStation:
|
||||
mIsArriveAtEndStation = true;
|
||||
mIsArriveAtStartStation = true;
|
||||
mIsOnTheWay2EndStation = false;
|
||||
OCHTaxiUiController.getInstance().addFragment();
|
||||
break;
|
||||
case ArriveAtStartStation:
|
||||
mIsArriveAtStartStation = true;
|
||||
mIsArriveAtEndStation = false;
|
||||
mIsOnTheWay2EndStation = false;
|
||||
OCHTaxiUiController.getInstance().addFragment();
|
||||
break;
|
||||
case OnTheWayToEndStation:
|
||||
mIsArriveAtStartStation = true;
|
||||
mIsArriveAtEndStation = false;
|
||||
mIsOnTheWay2EndStation = true;
|
||||
OCHTaxiUiController.getInstance().addFragment();
|
||||
break;
|
||||
case OnTheWayToStartStation:
|
||||
default:
|
||||
mIsArriveAtStartStation = false;
|
||||
mIsArriveAtEndStation = false;
|
||||
mIsOnTheWay2EndStation = false;
|
||||
mOrderMsgListener.onMsgReceived( mCurrentOCHOrder );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
if ( mRetryCounter++ > 3 ) {
|
||||
return;
|
||||
}
|
||||
queryOldOrder2RestoreOrderStatus( orderNo );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
Logger.w( TAG, "查询订单失败" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
private void convertCurrentOrder( OCHTaxiOrderResponse2 data ) {
|
||||
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.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;
|
||||
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;
|
||||
mCurrentOCHOrder.drivingRoutes.add( endStation );
|
||||
|
||||
cacheOrderInfo2Native( mCurrentOCHOrder );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,7 +230,7 @@ class MogoOCHTaxiModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* 位置变化时,通过围栏(5M)判断,是否到达起点
|
||||
* 位置变化时,通过围栏(5M)判断,是否到达x点
|
||||
*
|
||||
* @param location
|
||||
*/
|
||||
@@ -145,12 +245,39 @@ class MogoOCHTaxiModel {
|
||||
unregisterCarLocationListener();
|
||||
return;
|
||||
}
|
||||
OCHTaxiResponse.OCHTaxiStation station = mCurrentOCHOrder.drivingRoutes.get( 0 );//起点
|
||||
judgeStationStation( location );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否到达起点
|
||||
*
|
||||
* @param location
|
||||
*/
|
||||
private void judgeStationStation( Location location ) {
|
||||
OCHTaxiOrderResponse.OCHTaxiStation station = mCurrentOCHOrder.drivingRoutes.get( 0 );//起点
|
||||
double distance = CoordinateUtils.calculateLineDistance( station.lon, station.lat, location.getLongitude(), location.getLatitude() );
|
||||
if ( distance <= 5 ) {
|
||||
mIsArriveAtStartStation = true;
|
||||
unregisterCarLocationListener();
|
||||
OCHTaxiUiController.getInstance().onArriveAtStartStation();
|
||||
updateOCHOrderStatus( OCHOrderStatus.ArriveAtStartStation, new OCHOrderStatusCallback() {
|
||||
@Override
|
||||
public void onSuccess( Object data ) {
|
||||
Logger.d( TAG, "更新状态成功" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
Logger.d( TAG, "更新状态失败" );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
Logger.d( TAG, "更新状态失败2" );
|
||||
}
|
||||
} );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -162,21 +289,44 @@ class MogoOCHTaxiModel {
|
||||
return mIsArriveAtStartStation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否已到达终点站
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isArriveAtEndStation() {
|
||||
return mIsArriveAtEndStation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置去往终点状态
|
||||
*
|
||||
* @param isOnTheWay2EndStation
|
||||
*/
|
||||
public void setOnTheWay2EndStation( boolean isOnTheWay2EndStation ) {
|
||||
this.mIsOnTheWay2EndStation = isOnTheWay2EndStation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否在去往目的地的路上
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isOnTheWay2EndStation() {
|
||||
return mIsOnTheWay2EndStation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端长链推送通知新订单
|
||||
*/
|
||||
private class OrderMsgListener implements IMogoOnMessageListener< OCHTaxiResponse > {
|
||||
private class OrderMsgListener implements IMogoOnMessageListener< OCHTaxiOrderResponse > {
|
||||
@Override
|
||||
public Class< OCHTaxiResponse > target() {
|
||||
return OCHTaxiResponse.class;
|
||||
public Class< OCHTaxiOrderResponse > target() {
|
||||
return OCHTaxiOrderResponse.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( OCHTaxiResponse obj ) {
|
||||
if ( mCurrentOCHOrder != null ) {
|
||||
Logger.e( TAG, "有订单尚未结束" );
|
||||
return;
|
||||
}
|
||||
public void onMsgReceived( OCHTaxiOrderResponse obj ) {
|
||||
mCurrentOCHOrder = obj;
|
||||
cacheOrderInfo2Native( mCurrentOCHOrder );
|
||||
Location location = MogoApisHandler.getInstance()
|
||||
@@ -197,12 +347,11 @@ class MogoOCHTaxiModel {
|
||||
*
|
||||
* @param obj
|
||||
*/
|
||||
private void cacheOrderInfo2Native( OCHTaxiResponse obj ) {
|
||||
private void cacheOrderInfo2Native( OCHTaxiOrderResponse obj ) {
|
||||
if ( obj == null ) {
|
||||
return;
|
||||
}
|
||||
SharedPrefsMgr.getInstance( mContext )
|
||||
.putString( SP_KEY_OCH_TAXI_ORDER, GsonUtil.jsonFromObject( obj ) );
|
||||
SharedPrefsMgr.getInstance( mContext ).putString( SP_KEY_OCH_TAXI_ORDER, GsonUtil.jsonFromObject( obj ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -248,6 +397,7 @@ class MogoOCHTaxiModel {
|
||||
switch ( status ) {
|
||||
case Cancel:
|
||||
clearCurrentOCHOrder();
|
||||
OCHTaxiUiController.getInstance().removeFragment();
|
||||
break;
|
||||
default:
|
||||
Logger.d( TAG, "current order status: %s", status );
|
||||
@@ -296,20 +446,59 @@ class MogoOCHTaxiModel {
|
||||
public void onSuccess( BaseData o ) {
|
||||
super.onSuccess( o );
|
||||
if ( callback != null ) {
|
||||
callback.onSuccess();
|
||||
}
|
||||
if ( orderStatus == OCHOrderStatus.Completed ) {
|
||||
clearCurrentOCHOrder();
|
||||
callback.onSuccess( o );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
if ( callback != null ) {
|
||||
callback.onError();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
if ( callback != null ) {
|
||||
callback.onFail();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单状态
|
||||
*
|
||||
* @param orderNo 订单号
|
||||
*/
|
||||
public void queryOCHOrderStatus( String orderNo, OCHOrderStatusCallback< OCHTaxiOrderResponse2 > callback ) {
|
||||
if ( mCurrentOCHOrder == null ) {
|
||||
return;
|
||||
}
|
||||
if ( mOCHTaxiServiceApi == null ) {
|
||||
mOCHTaxiServiceApi = MogoApisHandler.getInstance().getApis().getNetworkApi().create( OCHTaxiServiceApi.class, HostConst.OCH_DOMAIN );
|
||||
}
|
||||
mOCHTaxiServiceApi.queryOrder( new OCHTaxiOrderStatus( orderNo, OCHOrderStatus.None.getCode() ) )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< OCHTaxiOrderResponse2 >( RequestOptions.create( mContext ) ) {
|
||||
@Override
|
||||
public void onSuccess( OCHTaxiOrderResponse2 o ) {
|
||||
super.onSuccess( o );
|
||||
if ( callback != null ) {
|
||||
callback.onSuccess( o );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
if ( callback != null ) {
|
||||
callback.onError();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
@@ -328,8 +517,8 @@ class MogoOCHTaxiModel {
|
||||
mCurrentOCHOrder = null;
|
||||
mIsArriveAtStartStation = false;
|
||||
mIsArriveAtEndStation = false;
|
||||
mIsOnTheWay2EndStation = false;
|
||||
SharedPrefsMgr.getInstance( mContext ).remove( SP_KEY_OCH_TAXI_ORDER );
|
||||
markAutoPilotStartedStatus( false );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -354,6 +543,7 @@ class MogoOCHTaxiModel {
|
||||
Logger.e( TAG, "no order or order is empty." );
|
||||
return;
|
||||
}
|
||||
|
||||
RemoteControlAutoPilotParameters parameters = new RemoteControlAutoPilotParameters();
|
||||
parameters.vehicleType = mCurrentOCHOrder.orderType;
|
||||
parameters.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 0 ).lat, mCurrentOCHOrder.drivingRoutes.get( 0 ).lon );
|
||||
@@ -362,34 +552,15 @@ class MogoOCHTaxiModel {
|
||||
.getApis()
|
||||
.getAdasControllerApi()
|
||||
.aiCloudToAdasData( parameters );
|
||||
markAutoPilotStartedStatus( true );
|
||||
Logger.d( TAG, "start autopilot with parameter: %s", GsonUtil.jsonFromObject( parameters ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记开启自动驾驶
|
||||
*
|
||||
* @param started
|
||||
*/
|
||||
private void markAutoPilotStartedStatus( boolean started ) {
|
||||
SharedPrefsMgr.getInstance( mContext ).putBoolean( SP_KEY_START_AUTO_PILOT, started );
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断已开启自动驾驶
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean isAutoPilotStarted() {
|
||||
return SharedPrefsMgr.getInstance( mContext ).getBoolean( SP_KEY_START_AUTO_PILOT, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前订单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public OCHTaxiResponse getCurrentOCHOrder() {
|
||||
public OCHTaxiOrderResponse getCurrentOCHOrder() {
|
||||
return mCurrentOCHOrder;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,13 @@ public
|
||||
*
|
||||
* 修改订单状态回调接口
|
||||
*/
|
||||
interface OCHOrderStatusCallback {
|
||||
interface OCHOrderStatusCallback< T > {
|
||||
|
||||
void onSuccess();
|
||||
void onSuccess( T data );
|
||||
|
||||
void onFail();
|
||||
|
||||
default void onError() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class OCHTaxiResponse implements Parcelable {
|
||||
class OCHTaxiOrderResponse implements Parcelable {
|
||||
|
||||
// 订单号
|
||||
public String orderNo;
|
||||
@@ -30,11 +30,14 @@ class OCHTaxiResponse implements Parcelable {
|
||||
public List< OCHTaxiStation > drivingRoutes;
|
||||
|
||||
public static class OCHTaxiStation implements Parcelable {
|
||||
public int siteId;
|
||||
public String siteId;
|
||||
public String siteName;
|
||||
public double lon;
|
||||
public double lat;
|
||||
|
||||
public OCHTaxiStation() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
@@ -42,17 +45,14 @@ class OCHTaxiResponse implements Parcelable {
|
||||
|
||||
@Override
|
||||
public void writeToParcel( Parcel dest, int flags ) {
|
||||
dest.writeInt( this.siteId );
|
||||
dest.writeString( this.siteId );
|
||||
dest.writeString( this.siteName );
|
||||
dest.writeDouble( this.lon );
|
||||
dest.writeDouble( this.lat );
|
||||
}
|
||||
|
||||
public OCHTaxiStation() {
|
||||
}
|
||||
|
||||
protected OCHTaxiStation( Parcel in ) {
|
||||
this.siteId = in.readInt();
|
||||
this.siteId = in.readString();
|
||||
this.siteName = in.readString();
|
||||
this.lon = in.readDouble();
|
||||
this.lat = in.readDouble();
|
||||
@@ -71,7 +71,7 @@ class OCHTaxiResponse implements Parcelable {
|
||||
};
|
||||
}
|
||||
|
||||
public OCHTaxiResponse() {
|
||||
public OCHTaxiOrderResponse() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,7 +90,7 @@ class OCHTaxiResponse implements Parcelable {
|
||||
dest.writeTypedList( this.drivingRoutes );
|
||||
}
|
||||
|
||||
protected OCHTaxiResponse( Parcel in ) {
|
||||
protected OCHTaxiOrderResponse( Parcel in ) {
|
||||
this.orderNo = in.readString();
|
||||
this.orderType = in.readInt();
|
||||
this.startStation = in.readString();
|
||||
@@ -100,15 +100,15 @@ class OCHTaxiResponse implements Parcelable {
|
||||
this.drivingRoutes = in.createTypedArrayList( OCHTaxiStation.CREATOR );
|
||||
}
|
||||
|
||||
public static final Creator< OCHTaxiResponse > CREATOR = new Creator< OCHTaxiResponse >() {
|
||||
public static final Creator< OCHTaxiOrderResponse > CREATOR = new Creator< OCHTaxiOrderResponse >() {
|
||||
@Override
|
||||
public OCHTaxiResponse createFromParcel( Parcel source ) {
|
||||
return new OCHTaxiResponse( source );
|
||||
public OCHTaxiOrderResponse createFromParcel( Parcel source ) {
|
||||
return new OCHTaxiOrderResponse( source );
|
||||
}
|
||||
|
||||
@Override
|
||||
public OCHTaxiResponse[] newArray( int size ) {
|
||||
return new OCHTaxiResponse[size];
|
||||
public OCHTaxiOrderResponse[] newArray( int size ) {
|
||||
return new OCHTaxiOrderResponse[size];
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class OCHTaxiOrderResponse2 extends BaseData {
|
||||
|
||||
public Result result;
|
||||
|
||||
public static class Result {
|
||||
public String _id;
|
||||
// 订单号
|
||||
public String orderNo;
|
||||
// 订单运营类型 (9出租车,10小巴)
|
||||
public int orderType;
|
||||
|
||||
// 当前订单状态
|
||||
public int orderDispatchType;
|
||||
// 起始站目的站距离km
|
||||
public double travelDistance;
|
||||
|
||||
public String userName;
|
||||
public String userPhone;
|
||||
|
||||
// 起始站名称
|
||||
public String startStation;
|
||||
// 起始站ID
|
||||
public String startStationId;
|
||||
// 起点站点
|
||||
public List< Double > startStationCoordinate;
|
||||
|
||||
// 目的站名称
|
||||
public String endStation;
|
||||
// 目的站ID
|
||||
public String endStationId;
|
||||
// 终点站点
|
||||
public List< Double > endStationCoordinate;
|
||||
|
||||
public String orderStartTime;
|
||||
public String cityCode;
|
||||
public String areaCode;
|
||||
public String createTime;
|
||||
public String updateTime;
|
||||
public int personNum;
|
||||
public String headImgUrl;
|
||||
public String lastBrandName;
|
||||
|
||||
public String arrivedStartStationTime;
|
||||
public String arrivedEndStationTime;
|
||||
|
||||
public String sn;
|
||||
public String carNum;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
|
||||
@@ -16,7 +16,22 @@ public
|
||||
*/
|
||||
interface OCHTaxiServiceApi {
|
||||
|
||||
/**
|
||||
* 更新订单状态
|
||||
*
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/order/updateOCHOrder/v1" )
|
||||
Observable< BaseData > updateOrderStatus( @Body OCHTaxiOrderStatus status );
|
||||
|
||||
/**
|
||||
* 查询订单状态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/order/queryOCHOrderDetails/v1" )
|
||||
Observable< OCHTaxiOrderResponse2 > queryOrder( @Body OCHTaxiOrderStatus status );
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.taxi.IMogoOCHTaxiArriveCallback;
|
||||
import com.mogo.och.taxi.MogoOCHTaxiModel;
|
||||
import com.mogo.och.taxi.OCHOrderStatus;
|
||||
import com.mogo.och.taxi.OCHOrderStatusCallback;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
@@ -51,7 +53,29 @@ class OCHTaxiFragment extends MvpFragment< OCHTaxiView, OCHTaxiPresenter > imple
|
||||
autoPilot = findViewById( R.id.autoPilot );
|
||||
orderInfo.setText( MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().toString() );
|
||||
autoPilot.setOnClickListener( view -> {
|
||||
if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) {
|
||||
Logger.w( TAG, "已到达终点" );
|
||||
return;
|
||||
}
|
||||
MogoOCHTaxiModel.getInstance().startAutoPilot();
|
||||
MogoOCHTaxiModel.getInstance().setOnTheWay2EndStation( true );
|
||||
MogoOCHTaxiModel.getInstance().updateOCHOrderStatus( OCHOrderStatus.OnTheWayToEndStation, new OCHOrderStatusCallback() {
|
||||
@Override
|
||||
public void onSuccess( Object data ) {
|
||||
Logger.d( TAG, "更新状态成功" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
Logger.d( TAG, "更新状态失败" );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
Logger.d( TAG, "更新状态失败2" );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
if ( MogoApisHandler.getInstance()
|
||||
@@ -63,6 +87,7 @@ class OCHTaxiFragment extends MvpFragment< OCHTaxiView, OCHTaxiPresenter > imple
|
||||
flatMode();
|
||||
}
|
||||
initListeners();
|
||||
initOrderStatus();
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
@@ -96,14 +121,51 @@ class OCHTaxiFragment extends MvpFragment< OCHTaxiView, OCHTaxiPresenter > imple
|
||||
|
||||
}
|
||||
|
||||
private void initOrderStatus() {
|
||||
if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) {
|
||||
Logger.d( TAG, "已经达到终点" );
|
||||
return;
|
||||
}
|
||||
if ( MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
|
||||
Logger.d( TAG, "已经去往终点" );
|
||||
return;
|
||||
}
|
||||
if ( MogoOCHTaxiModel.getInstance().isArriveAtStartStation() ) {
|
||||
Logger.d( TAG, "已经达到起点" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAtStartStation() {
|
||||
Logger.d( TAG, "达到起点" );
|
||||
Logger.d( TAG, "通知达到起点" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAtEndStation() {
|
||||
Logger.d( TAG, "达到终点" );
|
||||
Logger.d( TAG, "通知达到终点" );
|
||||
MogoOCHTaxiModel.getInstance().updateOCHOrderStatus( OCHOrderStatus.ArriveAtEndStation, new OCHOrderStatusCallback() {
|
||||
@Override
|
||||
public void onSuccess( Object data ) {
|
||||
Logger.d( TAG, "更新状态成功" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
Logger.d( TAG, "更新状态失败" );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
Logger.d( TAG, "更新状态失败2" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTheWay2EndStation() {
|
||||
Logger.d( TAG, "通知去往终点" );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
@@ -50,19 +51,11 @@ class OCHTaxiUiController implements IMogoOCHTaxiArriveCallback {
|
||||
public void init( FragmentActivity activity, int containerId ) {
|
||||
mActivity = activity;
|
||||
mContainerId = containerId;
|
||||
addFragment();
|
||||
}
|
||||
|
||||
public void addFragment() {
|
||||
|
||||
if ( Looper.myLooper() != Looper.getMainLooper() ) {
|
||||
UiThreadHandler.post( () -> {
|
||||
addFragmentImpl();
|
||||
} );
|
||||
} else {
|
||||
addFragmentImpl();
|
||||
}
|
||||
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
runOnUIThread( this::addFragmentImpl );
|
||||
}
|
||||
|
||||
private void addFragmentImpl() {
|
||||
@@ -84,36 +77,58 @@ class OCHTaxiUiController implements IMogoOCHTaxiArriveCallback {
|
||||
}
|
||||
|
||||
public void removeFragment() {
|
||||
Fragment fragment = null;
|
||||
FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
|
||||
fragment = fragmentManager.findFragmentByTag( OCHTaxiFragment.TAG );
|
||||
if ( fragment == null ) {
|
||||
return;
|
||||
}
|
||||
fragmentManager.beginTransaction()
|
||||
.remove( fragment )
|
||||
.commitNowAllowingStateLoss();
|
||||
runOnUIThread( () -> {
|
||||
Fragment fragment = null;
|
||||
FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
|
||||
fragment = fragmentManager.findFragmentByTag( OCHTaxiFragment.TAG );
|
||||
if ( fragment == null ) {
|
||||
return;
|
||||
}
|
||||
fragmentManager.beginTransaction()
|
||||
.remove( fragment )
|
||||
.commitNowAllowingStateLoss();
|
||||
} );
|
||||
}
|
||||
|
||||
public void setOCHTaxiArriveCallback( IMogoOCHTaxiArriveCallback OCHTaxiArriveCallback ) {
|
||||
this.mOCHTaxiArriveCallback = OCHTaxiArriveCallback;
|
||||
}
|
||||
|
||||
public IMogoOCHTaxiArriveCallback getOCHTaxiArriveCallback() {
|
||||
return mOCHTaxiArriveCallback;
|
||||
@Override
|
||||
public void onArriveAtStartStation() {
|
||||
runOnUIThread( () -> {
|
||||
if ( mOCHTaxiArriveCallback != null ) {
|
||||
mOCHTaxiArriveCallback.onArriveAtStartStation();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAtStartStation() {
|
||||
if ( mOCHTaxiArriveCallback != null ) {
|
||||
mOCHTaxiArriveCallback.onArriveAtEndStation();
|
||||
}
|
||||
public void onTheWay2EndStation() {
|
||||
runOnUIThread( () -> {
|
||||
if ( mOCHTaxiArriveCallback != null ) {
|
||||
mOCHTaxiArriveCallback.onTheWay2EndStation();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAtEndStation() {
|
||||
if ( mOCHTaxiArriveCallback != null ) {
|
||||
mOCHTaxiArriveCallback.onArriveAtEndStation();
|
||||
runOnUIThread( () -> {
|
||||
if ( mOCHTaxiArriveCallback != null ) {
|
||||
mOCHTaxiArriveCallback.onArriveAtEndStation();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
private void runOnUIThread( Runnable executor ) {
|
||||
if ( executor == null ) {
|
||||
return;
|
||||
}
|
||||
if ( Looper.myLooper() != Looper.getMainLooper() ) {
|
||||
UiThreadHandler.post( executor );
|
||||
} else {
|
||||
executor.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,8 @@ android {
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'true'
|
||||
// 是否需要使用工控机的rtk定位
|
||||
buildConfigField 'boolean', 'IS_USE_ADAS_RTK_LOCATION_INFO', 'true'
|
||||
}
|
||||
// f系列-网约车-小巴车
|
||||
fochbus {
|
||||
@@ -154,6 +156,8 @@ android {
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'true'
|
||||
// 是否需要使用工控机的rtk定位
|
||||
buildConfigField 'boolean', 'IS_USE_ADAS_RTK_LOCATION_INFO', 'true'
|
||||
}
|
||||
// f系列-分体机全系列,未细分
|
||||
f8xx {
|
||||
@@ -180,6 +184,8 @@ android {
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'true'
|
||||
// 是否需要使用工控机的rtk定位
|
||||
buildConfigField 'boolean', 'IS_USE_ADAS_RTK_LOCATION_INFO', 'true'
|
||||
}
|
||||
// f系列-分体机
|
||||
f80x {
|
||||
@@ -206,6 +212,8 @@ android {
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'true'
|
||||
// 是否需要使用工控机的rtk定位
|
||||
buildConfigField 'boolean', 'IS_USE_ADAS_RTK_LOCATION_INFO', 'true'
|
||||
}
|
||||
// f系列-分体机-高德
|
||||
f8Amap {
|
||||
@@ -232,6 +240,8 @@ android {
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'true'
|
||||
// 是否需要使用工控机的rtk定位
|
||||
buildConfigField 'boolean', 'IS_USE_ADAS_RTK_LOCATION_INFO', 'false'
|
||||
}
|
||||
// e系列,采用Launcher方案
|
||||
e8xx {
|
||||
@@ -258,6 +268,8 @@ android {
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'true'
|
||||
// 是否需要使用工控机的rtk定位
|
||||
buildConfigField 'boolean', 'IS_USE_ADAS_RTK_LOCATION_INFO', 'false'
|
||||
}
|
||||
// 同上
|
||||
em4 {
|
||||
@@ -284,6 +296,8 @@ android {
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'true'
|
||||
// 是否需要使用工控机的rtk定位
|
||||
buildConfigField 'boolean', 'IS_USE_ADAS_RTK_LOCATION_INFO', 'false'
|
||||
}
|
||||
// e系列-2+32,对标D系列2+32,采用独立app的形式
|
||||
em3 {
|
||||
@@ -310,6 +324,8 @@ android {
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'true'
|
||||
// 是否需要使用工控机的rtk定位
|
||||
buildConfigField 'boolean', 'IS_USE_ADAS_RTK_LOCATION_INFO', 'false'
|
||||
}
|
||||
// e系列-1+16,对标D系列1+16,采用独立app形式
|
||||
em1 {
|
||||
@@ -336,6 +352,8 @@ android {
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'false'
|
||||
// 是否需要使用工控机的rtk定位
|
||||
buildConfigField 'boolean', 'IS_USE_ADAS_RTK_LOCATION_INFO', 'false'
|
||||
}
|
||||
// e系列-1+16,对标D系列1+16,采用独立app形式
|
||||
em2 {
|
||||
@@ -362,6 +380,8 @@ android {
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'false'
|
||||
// 是否需要使用工控机的rtk定位
|
||||
buildConfigField 'boolean', 'IS_USE_ADAS_RTK_LOCATION_INFO', 'false'
|
||||
}
|
||||
// d系列
|
||||
d8xx {
|
||||
@@ -388,6 +408,8 @@ android {
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'true'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'true'
|
||||
// 是否需要使用工控机的rtk定位
|
||||
buildConfigField 'boolean', 'IS_USE_ADAS_RTK_LOCATION_INFO', 'false'
|
||||
}
|
||||
// d系列 2 + 32
|
||||
d80x {
|
||||
@@ -414,6 +436,8 @@ android {
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'true'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'true'
|
||||
// 是否需要使用工控机的rtk定位
|
||||
buildConfigField 'boolean', 'IS_USE_ADAS_RTK_LOCATION_INFO', 'false'
|
||||
}
|
||||
// d系列 1+16 版本
|
||||
d82x {
|
||||
@@ -440,6 +464,8 @@ android {
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'true'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'false'
|
||||
// 是否需要使用工控机的rtk定位
|
||||
buildConfigField 'boolean', 'IS_USE_ADAS_RTK_LOCATION_INFO', 'false'
|
||||
}
|
||||
// 比亚迪
|
||||
bydauto {
|
||||
@@ -466,6 +492,8 @@ android {
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'false'
|
||||
// 是否需要使用工控机的rtk定位
|
||||
buildConfigField 'boolean', 'IS_USE_ADAS_RTK_LOCATION_INFO', 'false'
|
||||
}
|
||||
qa {
|
||||
dimension "env"
|
||||
|
||||
@@ -12,7 +12,7 @@ afterEvaluate {
|
||||
&& taskName.contains("Independent")
|
||||
&& (taskName.endsWith("Debug") || taskName.endsWith("Release"))) {
|
||||
independent.forEach {
|
||||
if (taskName.toLowerCase().contains(it)) {
|
||||
if( taskName.toLowerCase().contains(it) ){
|
||||
task.group = "assembleIndependent"
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ afterEvaluate {
|
||||
&& taskName.contains("Launcher")
|
||||
&& (taskName.endsWith("Debug") || taskName.endsWith("Release"))) {
|
||||
launcher.forEach {
|
||||
if (taskName.toLowerCase().contains(it)) {
|
||||
if( taskName.toLowerCase().contains(it) ){
|
||||
task.group = "assembleLauncher"
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ afterEvaluate {
|
||||
&& taskName.contains("Independent")
|
||||
&& (taskName.endsWith("Debug") || taskName.endsWith("Release"))) {
|
||||
independent.forEach {
|
||||
if (taskName.toLowerCase().contains(it)) {
|
||||
if( taskName.toLowerCase().contains(it) ){
|
||||
task.group = "installIndependent"
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ afterEvaluate {
|
||||
&& taskName.contains("Launcher")
|
||||
&& (taskName.endsWith("Debug") || taskName.endsWith("Release"))) {
|
||||
launcher.forEach {
|
||||
if (taskName.toLowerCase().contains(it)) {
|
||||
if( taskName.toLowerCase().contains(it) ){
|
||||
task.group = "installLauncher"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,6 +144,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
DebugConfig.setNeedLoadGuideModule( BuildConfig.IS_NEED_LOAD_GUIDE_MODULE );
|
||||
DebugConfig.setNeedHideAdasWhenShare( BuildConfig.IS_NEED_HIDE_ADAS_WHEN_SHARE );
|
||||
DebugConfig.setNeedUploadCoordinatesInTime( BuildConfig.IS_NEED_UPLOAD_COORDINATES_IN_TIME );
|
||||
DebugConfig.setUseAdasRtkLocationInfo( BuildConfig.IS_USE_ADAS_RTK_LOCATION_INFO );
|
||||
DebugConfig.setObuType(SharedPrefsMgr.getInstance(this).getInt("OBU_TYPE", DebugConfig.OBU_TYPE_CIDI));
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
|
||||
@Override
|
||||
public void sendMsg(Object body, IMogoOnWebSocketMessageListener listener) {
|
||||
// Logger.d(TAG, "websocket sendMsg body = " + body);
|
||||
Logger.d(TAG, "websocket sendMsg body = " + body);
|
||||
if (handlerThread != null) {
|
||||
WebSocketData webSocketData = new WebSocketData();
|
||||
webSocketData.setSeq(computeSendMsgTime());
|
||||
@@ -148,7 +148,7 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
webSocketData.setCityCode(null);
|
||||
}
|
||||
String msg = GsonUtil.jsonFromObject(webSocketData);
|
||||
// Logger.d(TAG,"sendMsg : " + msg);
|
||||
Logger.d(TAG,"sendMsg : " + msg);
|
||||
handlerThread.sendMsg(msg);
|
||||
}
|
||||
}
|
||||
@@ -187,10 +187,10 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
|
||||
@Override
|
||||
public void handleMessage(String message) {
|
||||
// Logger.d(TAG, "websocket received msg = %s", message);
|
||||
Logger.d(TAG, "websocket received msg = %s", message);
|
||||
WebSocketData webSocketData = GsonUtil.objectFromJson(message, WebSocketData.class);
|
||||
int msgType = webSocketData.getMsgType();
|
||||
// Logger.d(TAG, "websocket received msg type = " + msgType);
|
||||
Logger.d(TAG, "websocket received msg type = " + msgType);
|
||||
//服务端下发数据返回,上传数据回执默认不返回
|
||||
if (msgType == MSG_TYPE_DOWNLINK_CAR_DATA.getMsgType()) {
|
||||
List<IMogoOnWebSocketMessageListener> listeners = mListeners.get(msgType);
|
||||
@@ -199,11 +199,11 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
while (iterator.hasNext()) {
|
||||
IMogoOnWebSocketMessageListener listener = iterator.next();
|
||||
if (listener != null) {
|
||||
// Logger.d(TAG, "received msgId = " + webSocketData.getSeq() + ", content = %s", webSocketData.getData());
|
||||
Logger.d(TAG, "received msgId = %s, content = %s", webSocketData.getSeq(),webSocketData.getData());
|
||||
Object receiveObj = GsonUtil.objectFromJson(webSocketData.getData(),listener.target());
|
||||
final long start = System.currentTimeMillis();
|
||||
listener.onMsgReceived(receiveObj);
|
||||
// Logger.d("WebSocketManager-sdk-timer", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
Logger.d("WebSocketManager-sdk-timer", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -211,11 +211,11 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
|
||||
if (webSocketData.getUtcTime() > 0) {
|
||||
serverTime = webSocketData.getUtcTime();
|
||||
receiveMsgTime = SystemClock.elapsedRealtime();
|
||||
// Logger.d(TAG, "设置serverTime");
|
||||
Logger.d(TAG, "设置serverTime");
|
||||
if (webSocketData.getUpUtcTime() > 0) {
|
||||
long nextDelay = webSocketData.getUpUtcTime() - serverTime;
|
||||
MogoApisHandler.getInstance().getApis().getRefreshStrategyControllerApi().resetLocationUpDelay(nextDelay);
|
||||
// Logger.d(TAG, "重置下次上报时机: " + nextDelay);
|
||||
Logger.d(TAG, "重置下次上报时机: " + nextDelay);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ public class DebugConfig {
|
||||
* {@link #NET_MODE_DEMO}
|
||||
* {@link #NET_MODE_RELEASE}
|
||||
*/
|
||||
public static void setNetMode(int netMode) {
|
||||
public static void setNetMode( int netMode ) {
|
||||
DebugConfig.sNetMode = netMode;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class DebugConfig {
|
||||
return sLaunchLocationService;
|
||||
}
|
||||
|
||||
public static void setLaunchLocationService(boolean launchLocationService) {
|
||||
public static void setLaunchLocationService( boolean launchLocationService ) {
|
||||
DebugConfig.sLaunchLocationService = launchLocationService;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public class DebugConfig {
|
||||
return sUseCustomNavi;
|
||||
}
|
||||
|
||||
public static void setUseCustomNavi(boolean sUseCustomNavi) {
|
||||
public static void setUseCustomNavi( boolean sUseCustomNavi ) {
|
||||
DebugConfig.sUseCustomNavi = sUseCustomNavi;
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public class DebugConfig {
|
||||
*
|
||||
* @param type {@link #CAR_MACHINE_TYPE_SELF_INNOVATE} {@link #CAR_MACHINE_TYPE_BYD}
|
||||
*/
|
||||
public static void setCarMachineType(int type) {
|
||||
public static void setCarMachineType( int type ) {
|
||||
sCarMachineType = type;
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ public class DebugConfig {
|
||||
return sIsLauncher;
|
||||
}
|
||||
|
||||
public static void setLauncher(boolean isLauncher) {
|
||||
public static void setLauncher( boolean isLauncher ) {
|
||||
DebugConfig.sIsLauncher = isLauncher;
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ public class DebugConfig {
|
||||
return sRequestOnlineCarData;
|
||||
}
|
||||
|
||||
public static void setRequestOnlineCarData(boolean sRequestOnlineCarData) {
|
||||
public static void setRequestOnlineCarData( boolean sRequestOnlineCarData ) {
|
||||
DebugConfig.sRequestOnlineCarData = sRequestOnlineCarData;
|
||||
}
|
||||
|
||||
@@ -194,6 +194,7 @@ public class DebugConfig {
|
||||
public static void setUseCustomMap( boolean sUseCustomMap ) {
|
||||
DebugConfig.sUseCustomMap = sUseCustomMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否支持临时激活小智
|
||||
*/
|
||||
@@ -258,7 +259,7 @@ public class DebugConfig {
|
||||
|
||||
private static boolean sLoadGuideModule = false;
|
||||
|
||||
public static void setLoadGuideModule(boolean sLoadGuideModule) {
|
||||
public static void setLoadGuideModule( boolean sLoadGuideModule ) {
|
||||
DebugConfig.sLoadGuideModule = sLoadGuideModule;
|
||||
}
|
||||
|
||||
@@ -327,7 +328,7 @@ public class DebugConfig {
|
||||
return obuType;
|
||||
}
|
||||
|
||||
public static void setObuType(int type) {
|
||||
public static void setObuType( int type ) {
|
||||
obuType = type;
|
||||
}
|
||||
|
||||
@@ -389,4 +390,17 @@ public class DebugConfig {
|
||||
public static void setNeedUploadCoordinatesInTime( boolean sIsNeedUploadCoordinatesInTime ) {
|
||||
DebugConfig.sIsNeedUploadCoordinatesInTime = sIsNeedUploadCoordinatesInTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否使用工控机定位数据作为自车上报数据
|
||||
*/
|
||||
private static boolean sIsUseAdasRtkLocationInfo = false;
|
||||
|
||||
public static boolean isUseAdasRtkLocationInfo() {
|
||||
return sIsUseAdasRtkLocationInfo;
|
||||
}
|
||||
|
||||
public static void setUseAdasRtkLocationInfo( boolean sIsUseAdasRtkLocationInfo ) {
|
||||
DebugConfig.sIsUseAdasRtkLocationInfo = sIsUseAdasRtkLocationInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ dependencies {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
}
|
||||
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.8.7'
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.9.5'
|
||||
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4'
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.os.Trace;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.IMogoMap;
|
||||
@@ -44,6 +48,7 @@ import com.zhidaoauto.map.sdk.open.location.MyLocationStyle;
|
||||
import com.zhidaoauto.map.sdk.open.location.RTKAutopilotLocationBean;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
import com.zhidaoauto.map.sdk.open.marker.OnInfoWindowClickListener;
|
||||
import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener;
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
import com.zhidaoauto.map.sdk.open.tools.MapTools;
|
||||
@@ -92,6 +97,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
private boolean mMapLoaded = false;
|
||||
private boolean mIsFirstLocated = true;
|
||||
private boolean mIsDelayed = false;
|
||||
private Marker mSelfMarker;
|
||||
|
||||
public AMapViewWrapper( MapAutoView mMapView ) {
|
||||
startTime = System.currentTimeMillis();
|
||||
@@ -252,6 +258,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
mMapView.setOnMapClickListener( null );
|
||||
mMapView.getLocationClient().unRegisterListener( this );
|
||||
mMapView.setMOnCameraChangeListener( null );
|
||||
mSelfMarker = null;
|
||||
Logger.d( TAG, "map onDestroy" );
|
||||
}
|
||||
}
|
||||
@@ -742,6 +749,47 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
MapStyleController.getInstance().onLocationChanged( location, this );
|
||||
}
|
||||
}
|
||||
|
||||
if ( mSelfMarker == null ) {
|
||||
try {
|
||||
mSelfMarker = mMapView.getMapAutoViewHelper().getMyLocationStyle().getSelfMarker();
|
||||
mSelfMarker.setInfoWindowEnable( true );
|
||||
mSelfMarker.setInfoWindowOffset( 0, -200 );
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
}
|
||||
showSelfSpeed( location.getSpeed() );
|
||||
}
|
||||
|
||||
private float mLastSpeed = 0;
|
||||
private TextView mSpeedView = null;
|
||||
|
||||
private void showSelfSpeed( float speed ) {
|
||||
|
||||
if ( !checkAMapView() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mSelfMarker == null ) {
|
||||
return;
|
||||
}
|
||||
if ( mCurrentUI != EnumMapUI.Type_VR ) {
|
||||
mSelfMarker.hideInfoWindow();
|
||||
return;
|
||||
}
|
||||
if ( Math.abs( mLastSpeed - speed ) > 0 ) {
|
||||
if ( mSpeedView == null ) {
|
||||
mSpeedView = new TextView( mMapView.getContext() );
|
||||
mSpeedView.setTextColor( Color.WHITE );
|
||||
mSpeedView.setTypeface( Typeface.defaultFromStyle( Typeface.BOLD ) );
|
||||
mSpeedView.setShadowLayer( 10f, 5F, 5F, Color.BLACK );
|
||||
mSpeedView.setLayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT ) );
|
||||
}
|
||||
mSpeedView.setText( String.valueOf( ( ( int ) ( speed * 3.6 ) ) ) );
|
||||
mSelfMarker.setInfoWindowView( mSpeedView );
|
||||
} else {
|
||||
mSelfMarker.hideInfoWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -854,7 +902,9 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
// vr 模式切换到普通模式下,保持之前的白天模式 wtf.
|
||||
if ( last == EnumMapUI.Type_VR && mCurrentUI != last ) {
|
||||
if ( last == EnumMapUI.Type_VR
|
||||
&& mCurrentUI != last
|
||||
&& mCurrentUI != EnumMapUI.Type_Light ) {
|
||||
if ( mIsLightStyle ) {
|
||||
changeMapMode( EnumMapUI.Type_Light );
|
||||
return;
|
||||
@@ -931,6 +981,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
double heading = data.optDouble( "heading", -1 );
|
||||
double acceleration = data.optDouble( "acceleration", -1 );
|
||||
double yawRate = data.optDouble( "yawRate", -1 );
|
||||
double speed = data.optDouble( "speed", -1 );
|
||||
if ( lon == -1 ) {
|
||||
return;
|
||||
}
|
||||
@@ -941,6 +992,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
bean.setAcceleration( acceleration );
|
||||
bean.setAlt( alt );
|
||||
bean.setLon( lon );
|
||||
bean.setGnss_speed( ( ( float ) speed ) );
|
||||
bean.setLat( lat );
|
||||
mMapView.getLocationClient().updateRTKAutoPilotLocation( bean );
|
||||
Logger.d( TAG, "使用rtk定位数据" );
|
||||
|
||||
@@ -27,7 +27,7 @@ public final class AMapInfoWindowAdapter implements InfoWindowAdapter, OnInfoWin
|
||||
IMogoMarker mogoMarker = ( ( IMogoMarker ) marker.getMObject() );
|
||||
IMogoInfoWindowAdapter delegate = mogoMarker.getInfoWindowAdapter();
|
||||
if ( delegate != null ) {
|
||||
final View infoView = delegate.getInfoWindow( mogoMarker );
|
||||
final View infoView = delegate.getInfoWindow( mogoMarker );
|
||||
marker.setOnInfoWindowClickListener( this );
|
||||
return infoView;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public final class AMapInfoWindowAdapter implements InfoWindowAdapter, OnInfoWin
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View getInfoContents(@Nullable Marker marker) {
|
||||
public View getInfoContents( @Nullable Marker marker ) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
@Override
|
||||
public void use3DResource( int model3D ) {
|
||||
try {
|
||||
mMarker.setMarkerOptions( mMarker.getMarkeOptions().anchorColor("#00FF00").marker3DIcon( model3D ) );
|
||||
mMarker.setMarkerOptions( mMarker.getMarkeOptions().anchorColor( "#00FF00" ).marker3DIcon( model3D ) );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "use3DResource" );
|
||||
}
|
||||
@@ -514,4 +514,13 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
public void setAnchorColor( String anchorColor ) {
|
||||
mMarker.setMarkerOptions( mMarker.getMarkeOptions().anchorColor( anchorColor ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInfoWindowView( View view ) {
|
||||
try {
|
||||
mMarker.setInfoWindowView( view );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.map.marker;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Point;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import androidx.annotation.RawRes;
|
||||
@@ -352,9 +353,14 @@ public interface IMogoMarker {
|
||||
|
||||
/**
|
||||
* 设置3D车模颜色
|
||||
*
|
||||
* @param anchorColor
|
||||
*/
|
||||
default void setAnchorColor(String anchorColor){
|
||||
default void setAnchorColor( String anchorColor ) {
|
||||
|
||||
}
|
||||
|
||||
default void updateInfoWindowView( View view ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
341604
map.log.txt
Normal file
341604
map.log.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -39,8 +39,6 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
}
|
||||
|
||||
private long mLastReceiveTime = 0L;
|
||||
|
||||
private Map< String, MogoLatLng > mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
public static AdasRecognizedResultDrawer getInstance() {
|
||||
@@ -124,10 +122,9 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
}
|
||||
mLastPositions.put( uniqueKey, endLatLon );
|
||||
if ( points.size() >= 1 ) {
|
||||
marker.startSmoothInMs( points, SystemClock.elapsedRealtime() - mLastReceiveTime );
|
||||
marker.startSmoothInMs( points, 100 );
|
||||
}
|
||||
}
|
||||
mLastReceiveTime = SystemClock.elapsedRealtime();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.map.CoordinatesTransformer;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.AdasRecognizedType;
|
||||
import com.mogo.module.common.constants.CarModelType;
|
||||
@@ -94,4 +101,31 @@ class BaseDrawer {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private float mLastSpeed = 0;
|
||||
private TextView mSpeedView = null;
|
||||
|
||||
protected void showSelfSpeed( Context context, IMogoMarker mogoMarker, double speed, boolean isVrMode ) {
|
||||
if ( mogoMarker == null || mogoMarker.isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
if ( !isVrMode ) {
|
||||
mogoMarker.hideInfoWindow();
|
||||
return;
|
||||
}
|
||||
if ( Math.abs( mLastSpeed - speed ) > 0 ) {
|
||||
if ( mSpeedView == null ) {
|
||||
mSpeedView = new TextView( context );
|
||||
mSpeedView.setTextColor( Color.WHITE );
|
||||
mSpeedView.setTypeface( Typeface.defaultFromStyle( Typeface.BOLD ) );
|
||||
mSpeedView.setShadowLayer( 10f, 5F, 5F, Color.BLACK );
|
||||
mSpeedView.setLayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT ) );
|
||||
}
|
||||
mSpeedView.setText( String.valueOf( ( ( int ) ( speed * 3.6 ) ) ) );
|
||||
mogoMarker.updateInfoWindowView( mSpeedView );
|
||||
} else {
|
||||
mogoMarker.hideInfoWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -12,6 +15,7 @@ import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
@@ -24,6 +28,7 @@ import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidao.carchattingprovider.ICarsChattingProvider;
|
||||
import com.zhidao.carchattingprovider.MogoDriverInfo;
|
||||
|
||||
@@ -141,6 +146,8 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
continue;
|
||||
}
|
||||
|
||||
Logger.d( TAG, "%s", GsonUtil.jsonFromObject( cloudRoadData ) );
|
||||
|
||||
// 暂时只显示车辆
|
||||
if ( TextUtils.isEmpty( cloudRoadData.getSn() ) ) {
|
||||
if ( isCarType( cloudRoadData.getType() ) ) {
|
||||
@@ -192,13 +199,16 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
}
|
||||
}
|
||||
Logger.d( TAG, "保持位置 - %s", uniqueKey );
|
||||
marker.setPosition( lastPosition.getLat(), lastPosition.getLon() );
|
||||
// marker.setPosition( lastPosition.getLat(), lastPosition.getLon() );
|
||||
} else {
|
||||
List< MogoLatLng > points = new ArrayList<>();
|
||||
points.add( new MogoLatLng( lastPosition.getLat(), lastPosition.getLon() ) );
|
||||
points.add( new MogoLatLng( cloudRoadData.getLat(), cloudRoadData.getLon() ) );
|
||||
marker.startSmoothInMs( points, cloudRoadData.getSystemTime() - lastPosition.getSystemTime() );
|
||||
Logger.d( TAG, "平滑移动 - %s duration = %s", uniqueKey, cloudRoadData.getSystemTime() - lastPosition.getSystemTime() );
|
||||
long interval = cloudRoadData.getSystemTime() - lastPosition.getSystemTime();
|
||||
long interval2 = cloudRoadData.getSatelliteTime() - lastPosition.getSatelliteTime();
|
||||
interval2 = interval < interval2 || interval2 == 0 ? interval : interval2;
|
||||
marker.startSmoothInMs( points, interval2 );
|
||||
Logger.d( TAG, "平滑移动 - %s duration = %s", uniqueKey, interval2 );
|
||||
}
|
||||
} else {
|
||||
MapCameraPosition position = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getMapCameraPosition();
|
||||
@@ -209,11 +219,13 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
}
|
||||
marker.setPosition( cloudRoadData.getLat(), cloudRoadData.getLon() );
|
||||
}
|
||||
showSelfSpeed( mContext, marker, cloudRoadData.getSpeed(), mIsVrMode );
|
||||
}
|
||||
mLastPositions.put( uniqueKey, cloudRoadData );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 过滤数据
|
||||
*
|
||||
|
||||
@@ -34,6 +34,7 @@ public class CloudRoadData implements Parcelable {
|
||||
private double heading;
|
||||
|
||||
private long systemTime;
|
||||
private long satelliteTime;
|
||||
|
||||
/**
|
||||
* 红绿灯状态 1红 2绿 3黄
|
||||
@@ -153,6 +154,14 @@ public class CloudRoadData implements Parcelable {
|
||||
this.heading = heading;
|
||||
}
|
||||
|
||||
public long getSatelliteTime() {
|
||||
return satelliteTime;
|
||||
}
|
||||
|
||||
public void setSatelliteTime( long satelliteTime ) {
|
||||
this.satelliteTime = satelliteTime;
|
||||
}
|
||||
|
||||
public String getUniqueKey() {
|
||||
if ( !TextUtils.isEmpty( uuid ) ) {
|
||||
return uuid;
|
||||
@@ -171,6 +180,20 @@ public class CloudRoadData implements Parcelable {
|
||||
public CloudRoadData() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o ) {
|
||||
if ( this == o ) {
|
||||
return true;
|
||||
}
|
||||
if ( o == null || getClass() != o.getClass() ) {
|
||||
return false;
|
||||
}
|
||||
CloudRoadData that = ( CloudRoadData ) o;
|
||||
return Double.compare( that.lat, lat ) == 0 &&
|
||||
Double.compare( that.lon, lon ) == 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
@@ -187,6 +210,7 @@ public class CloudRoadData implements Parcelable {
|
||||
dest.writeDouble( this.speed );
|
||||
dest.writeDouble( this.heading );
|
||||
dest.writeLong( this.systemTime );
|
||||
dest.writeLong( this.satelliteTime );
|
||||
dest.writeInt( this.lightStatus );
|
||||
dest.writeInt( this.lightLeftTime );
|
||||
dest.writeString( this.rtmpUrl );
|
||||
@@ -204,6 +228,7 @@ public class CloudRoadData implements Parcelable {
|
||||
this.speed = in.readDouble();
|
||||
this.heading = in.readDouble();
|
||||
this.systemTime = in.readLong();
|
||||
this.satelliteTime = in.readLong();
|
||||
this.lightStatus = in.readInt();
|
||||
this.lightLeftTime = in.readInt();
|
||||
this.rtmpUrl = in.readString();
|
||||
@@ -222,19 +247,4 @@ public class CloudRoadData implements Parcelable {
|
||||
return new CloudRoadData[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o ) {
|
||||
if ( this == o ) {
|
||||
return true;
|
||||
}
|
||||
if ( o == null || getClass() != o.getClass() ) {
|
||||
return false;
|
||||
}
|
||||
CloudRoadData that = ( CloudRoadData ) o;
|
||||
return Double.compare( that.lat, lat ) == 0 &&
|
||||
Double.compare( that.lon, lon ) == 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -50,6 +50,26 @@ public class CarStateInfo implements Serializable {
|
||||
private double heading;
|
||||
private double acceleration;
|
||||
private double yaw_rate;
|
||||
//惯导车速 m/s
|
||||
private float gnss_speed;
|
||||
//gps 时间
|
||||
private String satelliteTime;
|
||||
|
||||
public float getGnss_speed() {
|
||||
return gnss_speed;
|
||||
}
|
||||
|
||||
public void setGnss_speed( float gnss_speed ) {
|
||||
this.gnss_speed = gnss_speed;
|
||||
}
|
||||
|
||||
public String getSatelliteTime() {
|
||||
return satelliteTime;
|
||||
}
|
||||
|
||||
public void setSatelliteTime( String satelliteTime ) {
|
||||
this.satelliteTime = satelliteTime;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.carinfo.CarStateInfo;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.module.service.uploadintime.SnapshotUploadInTime;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import org.json.JSONObject;
|
||||
@@ -64,10 +65,13 @@ class ADASStatusIntentHandler implements IntentHandler {
|
||||
data.putOpt( "lon", stateInfo.getValues().getLon() );
|
||||
data.putOpt( "lat", stateInfo.getValues().getLat() );
|
||||
data.putOpt( "alt", stateInfo.getValues().getAlt() );
|
||||
data.putOpt( "speed", stateInfo.getValues().getGnss_speed() );
|
||||
data.putOpt( "satelliteTime", stateInfo.getValues().getSatelliteTime() );
|
||||
data.putOpt( "heading", stateInfo.getValues().getHeading() );
|
||||
data.putOpt( "acceleration", stateInfo.getValues().getAcceleration() );
|
||||
data.putOpt( "yawRate", stateInfo.getValues().getYaw_rate() );
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( data );
|
||||
SnapshotUploadInTime.getInstance().syncAdasLocationInfo( data );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.mogo.module.common.dialog.WMDialog;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.service.entrance.ButtonIndex;
|
||||
import com.mogo.utils.CoordinateUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -391,6 +392,86 @@ public class MockIntentHandler implements IntentHandler {
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
|
||||
.syncLocation2Map( null );
|
||||
break;
|
||||
case 40:
|
||||
|
||||
double[][] coors = new double[][]{{40.17511749267578, 116.74359130859375},
|
||||
{40.20258331298828, 116.74071502685547},
|
||||
{40.202598571777344, 116.74067687988281},
|
||||
{40.20256805419922, 116.74071502685547},
|
||||
{40.202598571777344, 116.74064636230469},
|
||||
{40.20258712768555, 116.74067687988281},
|
||||
{40.202579498291016, 116.74068450927734},
|
||||
{40.202545166015625, 116.7406005859375},
|
||||
{40.202571868896484, 116.74054718017578},
|
||||
{40.20256042480469, 116.74057006835938},
|
||||
{40.202510833740234, 116.74053192138672},
|
||||
{40.202552795410156, 116.74053955078125},
|
||||
{40.202537536621094, 116.74044799804688},
|
||||
{40.202552795410156, 116.74042510986328},
|
||||
{40.202510833740234, 116.74038696289062},
|
||||
{40.202537536621094, 116.74044799804688},
|
||||
{40.202552795410156, 116.74042510986328},
|
||||
{40.202518463134766, 116.74039459228516},
|
||||
{40.202537536621094, 116.74038696289062},
|
||||
{40.202552795410156, 116.74036407470703},
|
||||
{40.20252227783203, 116.7403335571289},
|
||||
{40.20253372192383, 116.74038696289062},
|
||||
{40.202552795410156, 116.74036407470703},
|
||||
{40.2025260925293, 116.7403335571289},
|
||||
{40.20253372192383, 116.74030303955078},
|
||||
{40.20254898071289, 116.74028778076172},
|
||||
{40.20252990722656, 116.7402572631836},
|
||||
{40.2025260925293, 116.740234375},
|
||||
{40.202545166015625, 116.74022674560547},
|
||||
{40.20252990722656, 116.74020385742188},
|
||||
{40.20254898071289, 116.74014282226562},
|
||||
{40.20253372192383, 116.74011993408203},
|
||||
{40.2025260925293, 116.74014282226562},
|
||||
{40.20254898071289, 116.74014282226562},
|
||||
{40.202537536621094, 116.74011993408203},
|
||||
{40.2025260925293, 116.74014282226562},
|
||||
{40.20255661010742, 116.74008178710938},
|
||||
{40.20254135131836, 116.74005889892578},
|
||||
{40.20252990722656, 116.74007415771484},
|
||||
{40.20254898071289, 116.74008178710938},
|
||||
{40.20254135131836, 116.74005889892578},
|
||||
{40.20252227783203, 116.74006652832031},
|
||||
{40.20254898071289, 116.74002838134766},
|
||||
{40.20254135131836, 116.74000549316406},
|
||||
{40.20252227783203, 116.73999786376953},
|
||||
{40.20269012451172, 116.73983001708984},
|
||||
{40.20265579223633, 116.73978424072266},
|
||||
{40.202667236328125, 116.7397689819336},
|
||||
{40.20264434814453, 116.73973083496094},
|
||||
{40.202632904052734, 116.7397689819336},
|
||||
{40.202613830566406, 116.73974609375},
|
||||
{40.2026252746582, 116.73970794677734},
|
||||
{40.202613830566406, 116.73968505859375},
|
||||
{40.202598571777344, 116.73970031738281},
|
||||
{40.20258712768555, 116.73969268798828},
|
||||
{40.20258712768555, 116.73961639404297},
|
||||
{40.202579498291016, 116.73960876464844},
|
||||
{40.20257568359375, 116.7396240234375},
|
||||
{40.20256805419922, 116.73960876464844},
|
||||
{40.20256042480469, 116.73941802978516},
|
||||
{40.20255661010742, 116.73941802978516},
|
||||
{40.20256042480469, 116.73941802978516},
|
||||
{40.20254898071289, 116.73941802978516},
|
||||
{40.20255661010742, 116.7393569946289},
|
||||
{40.20254898071289, 116.7393569946289},
|
||||
{40.20256042480469, 116.7393569946289},
|
||||
{40.20254898071289, 116.7393569946289},
|
||||
{40.20255661010742, 116.73928833007812},
|
||||
{40.202545166015625, 116.7392807006836},
|
||||
{40.20254898071289, 116.73928833007812},
|
||||
{40.20254135131836, 116.7392807006836}};
|
||||
for ( double[] coor : coors ) {
|
||||
double lat = coor[0], lon = coor[1];
|
||||
double[] translateCoor = CoordinateUtils.transformFromWGSToGCJ( lat, lon );
|
||||
double[] originCoor = CoordinateUtils.transformGcj02toWgs84( translateCoor[0], translateCoor[1] );
|
||||
double delta = CoordinateUtils.calculateLineDistance( lon, lat, originCoor[0], originCoor[1] );
|
||||
Logger.d( TAG, "偏差值:%s", delta );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,9 @@ import android.os.Message;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.module.common.entity.CloudLocationInfo;
|
||||
import com.mogo.module.service.uploadintime.SnapshotUploadInTime;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -63,13 +65,19 @@ public class MogoRTKLocation {
|
||||
|
||||
private void sendLocationData() {
|
||||
|
||||
if (rtkLocationListener != null) {
|
||||
List<CloudLocationInfo> list = new ArrayList<>(cacheList);
|
||||
rtkLocationListener.onLocationChanged(list);
|
||||
List<CloudLocationInfo> list = null;
|
||||
if ( DebugConfig.isUseAdasRtkLocationInfo() ) {
|
||||
list = new ArrayList<>(SnapshotUploadInTime.getInstance().getSendLocationData());
|
||||
}
|
||||
if ( list == null || list.isEmpty() ) {
|
||||
list = new ArrayList<>(cacheList);
|
||||
}
|
||||
if (cacheList != null && cacheList.size() > 0) {
|
||||
cacheList.clear();
|
||||
}
|
||||
if (rtkLocationListener != null) {
|
||||
rtkLocationListener.onLocationChanged(list);
|
||||
}
|
||||
}
|
||||
|
||||
public void registerRTKLocationListener(RTKLocationListener locationListener) {
|
||||
|
||||
@@ -176,9 +176,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
} );
|
||||
// adas 每隔一秒传递的数据
|
||||
MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback( resultList -> {
|
||||
if ( resultList == null || resultList.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
double speed = 0.0;
|
||||
if ( MogoServices.getInstance().getLastCarLocation() != null ) {
|
||||
speed = MogoServices.getInstance().getLastCarLocation().getSpeed();
|
||||
|
||||
@@ -14,6 +14,8 @@ import com.mogo.service.connection.IMogoOnWebSocketMessageListener;
|
||||
import com.mogo.service.connection.WebSocketMsgType;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -122,4 +124,46 @@ class SnapshotUploadInTime implements MogoRTKLocation.RTKLocationListener {
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
// adda 工控机数据缓存
|
||||
private List< CloudLocationInfo > cacheList = new ArrayList<>();
|
||||
|
||||
public void syncAdasLocationInfo( JSONObject data ) {
|
||||
if ( data == null ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "同步到rtk数据" );
|
||||
double lon = data.optDouble( "lon", -1 );
|
||||
double lat = data.optDouble( "lat", -1 );
|
||||
double alt = data.optDouble( "alt", -1 );
|
||||
double heading = data.optDouble( "heading", -1 );
|
||||
double acceleration = data.optDouble( "acceleration", -1 );
|
||||
double yawRate = data.optDouble( "yawRate", -1 );
|
||||
double speed = data.optDouble( "speed", -1 );
|
||||
long satelliteTime = 0L;
|
||||
try {
|
||||
satelliteTime = Long.valueOf( data.optString( "satelliteTime" ) );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
|
||||
cloudLocationInfo.setAlt( alt );
|
||||
cloudLocationInfo.setHeading( heading );
|
||||
cloudLocationInfo.setLat( lat );
|
||||
cloudLocationInfo.setLon( lon );
|
||||
cloudLocationInfo.setSpeed( speed );
|
||||
cloudLocationInfo.setSatelliteTime( satelliteTime );
|
||||
cloudLocationInfo.setSystemTime( System.currentTimeMillis() );
|
||||
cloudLocationInfo.convertCoor2GCJ02();
|
||||
cacheList.add( cloudLocationInfo );
|
||||
}
|
||||
|
||||
public List< CloudLocationInfo > getSendLocationData() {
|
||||
List< CloudLocationInfo > list = new ArrayList<>( cacheList );
|
||||
if ( cacheList != null && cacheList.size() > 0 ) {
|
||||
cacheList.clear();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class LocationResult {
|
||||
public CloudLocationInfo lastCoordinate;
|
||||
|
||||
/**
|
||||
* 1s 内的连续定位点
|
||||
* 内的连续定位点
|
||||
*/
|
||||
public List< CloudLocationInfo > coordinates;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ dependencies {
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.adasapi
|
||||
implementation rootProject.ext.dependencies.adasconfigapi
|
||||
implementation "com.zhidao.support.adas:high:1.1.4.6"
|
||||
implementation "com.zhidao.support.adas:high:1.1.5.2"
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.mogomap
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
|
||||
@@ -54,6 +54,7 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -114,7 +115,7 @@ public class MogoADASController implements IMogoADASController {
|
||||
@Override
|
||||
public void onRectData( RectInfo rectInfo ) {
|
||||
// 物体识别返回
|
||||
// Logger.d( TAG, "onRectData = %s", rectInfo.toString() );
|
||||
Logger.d( TAG, "onRectData = %s", rectInfo.toString() );
|
||||
mLastFrameData = rectInfo;
|
||||
// 仅在 vr 模式下显示 adas 识别车辆
|
||||
if ( !MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
@@ -171,25 +172,15 @@ public class MogoADASController implements IMogoADASController {
|
||||
if ( rectInfo == null
|
||||
|| rectInfo.getModels() == null
|
||||
|| rectInfo.getModels().isEmpty() ) {
|
||||
invokeCallbackPerSecond( null );
|
||||
return;
|
||||
}
|
||||
long curTime = System.currentTimeMillis() / 1000;
|
||||
if ( mLastRecordSeconds == 0L ) {
|
||||
mLastRecordSeconds = curTime;
|
||||
}
|
||||
if ( mLastRecordSeconds != curTime ) {
|
||||
invokeCallbackPerSecond( mCacheRecognizedDataSet );
|
||||
mCacheRecognizedDataSet = new ArrayList<>();
|
||||
}
|
||||
mCacheRecognizedDataSet.add( rectInfo );
|
||||
invokeCallbackPerSecond( Arrays.asList( rectInfo ) );
|
||||
}
|
||||
|
||||
private void invokeCallbackPerSecond( List< RectInfo > data ) {
|
||||
List< RectInfo > newRef = data;
|
||||
List< ADASRecognizedListResult > recognizedListResults = AdasObjectUtils.regroupData( newRef );
|
||||
if ( recognizedListResults == null || recognizedListResults.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
if ( !mMogoAdasRecognizedDataCallbacks.isEmpty() ) {
|
||||
for ( IMogoAdasRecognizedDataCallback callback : mMogoAdasRecognizedDataCallbacks ) {
|
||||
if ( callback == null ) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.service.impl.adas;
|
||||
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatus;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotWayArrive;
|
||||
import com.zhidao.support.adas.high.bean.CarLaneInfo;
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.LightStatueInfo;
|
||||
@@ -57,4 +58,9 @@ abstract class OnAdasListenerAdapter implements OnAdasListener {
|
||||
public void autopilotStatus( AutopilotStatus autopilotStatus ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autopilotArrive( AutopilotWayArrive autopilotWayArrive ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user