[6.7.0]
[fea] [taxi无人化、自驾信息]
This commit is contained in:
@@ -133,12 +133,13 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
}else {
|
||||
setAutopilotControlParameters()
|
||||
}
|
||||
OchChainLogManager.writeChainLogAutopilot("自驾参数", "${startStation}---${endStation}")
|
||||
OchChainLogManager.writeChainLogAutopilot("自驾参数", "站点信息:${startStation}---${endStation}")
|
||||
}
|
||||
|
||||
fun setContraiInfo(contraiInfo: ContraiInfo?){
|
||||
this._contraiInfo = contraiInfo
|
||||
setAutopilotControlParameters()
|
||||
OchChainLogManager.writeChainLogAutopilot("自驾参数", "轨迹信息:${contraiInfo}")
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -159,6 +160,7 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
CallerEagleBaseFunctionCall4OchManager.updateOrderLine(sb.toString())
|
||||
}
|
||||
}
|
||||
OchChainLogManager.writeChainLogAutopilot("自驾参数", "线路信息:${contraiInfo}")
|
||||
}
|
||||
|
||||
fun getStations(): Pair<BusStationBean?, BusStationBean?> {
|
||||
|
||||
@@ -33,4 +33,5 @@ data class ContraiInfo(
|
||||
|
||||
var passPoints: MutableList<BusStationBean>?=null, // 用于算路的经停点
|
||||
var blackPoints: MutableList<BusStationBean>?=null, // 用于算路的黑名單點
|
||||
val source:Int = 1, //轨迹来源:1 录制;2 自主计算
|
||||
)
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.och.data.taxi.BaseOrderBean
|
||||
import com.mogo.och.unmanned.taxi.constant.TaskStatusEnum
|
||||
import com.mogo.och.common.module.biz.order.TaxiOrderStatusEnum
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.data.bean.ContraiInfo
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
@@ -73,6 +75,17 @@ data class Site(
|
||||
if (wgs84Lat != other.wgs84Lat) return false
|
||||
return true
|
||||
}
|
||||
fun toCommonStation(): BusStationBean {
|
||||
val result = BusStationBean()
|
||||
result.siteId = siteId.toInt()
|
||||
result.name = siteName
|
||||
result.gcjLat = gcjLat
|
||||
result.gcjLon = gcjLon
|
||||
result.lat = wgs84Lat
|
||||
result.lon = wgs84Lon
|
||||
result.isLeaving = true
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
data class QueryCurrentTaskRespBean(var data: Result?) : BaseData() {
|
||||
@@ -254,6 +267,11 @@ data class TrajectoryListRespBean(var data: MutableList<Result>?) : BaseData() {
|
||||
var txtFileUrlDPQP: String,
|
||||
var txtFileMd5DPQP: String,
|
||||
var contrailSaveTimeDPQP: Long
|
||||
)
|
||||
){
|
||||
fun toCommonContraiInfo(): ContraiInfo {
|
||||
val result = ContraiInfo(lineId,csvFileUrl,csvFileMd5,txtFileUrl,txtFileMd5,contrailSaveTime,source = source)
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,23 +6,5 @@ package com.mogo.och.unmanned.taxi.callback;
|
||||
* Model->Presenter回调:ADAS相关(自动驾驶状态回调,到达终点等等)
|
||||
*/
|
||||
public interface ITaxiADASStatusCallback {
|
||||
// 自动驾驶触发的已到达目的地:暂未用到
|
||||
void onAutopilotArriveEnd();
|
||||
|
||||
// 自动驾驶可用状态
|
||||
void onAutopilotEnable(boolean canStartAuto);
|
||||
|
||||
// 自动驾驶不可用状态
|
||||
void onAutopilotDisable(boolean canStartAuto);
|
||||
|
||||
// 自动驾驶运行中
|
||||
void onAutopilotRunning(boolean canStartAuto);
|
||||
|
||||
//人机共驾
|
||||
void onParallelDrivingStatus(boolean canStartAuto);
|
||||
|
||||
//自驾返回失败
|
||||
void onStartAdasFailure();
|
||||
|
||||
void updateAutopilotStatus(boolean canStartAuto);
|
||||
}
|
||||
|
||||
@@ -9,9 +9,6 @@ import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
*/
|
||||
public interface ITaxiControllerStatusCallback {
|
||||
|
||||
//开始开启自动驾驶
|
||||
void startOpenAutopilot();
|
||||
|
||||
//自动开启自动驾驶
|
||||
void startOpenAutopilotNonManual();
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ import com.mogo.och.unmanned.taxi.ui.navi.auto.TaxiRoutingNaviFragment
|
||||
import com.mogo.och.unmanned.taxi.ui.operational.TaxiOperationalDialogFragment
|
||||
import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel
|
||||
import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskTabFragment
|
||||
import com.mogo.och.unmanned.taxi.ui.task.itinerarycurrent.ItineraryCurrentView
|
||||
import com.mogo.och.unmanned.taxi.utils.TPRouteDataTestUtils
|
||||
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.unmannedMapCL
|
||||
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.module_mogo_och_navi_panel_container
|
||||
@@ -86,11 +87,6 @@ class TaxiFragment :MvpFragment<TaxiFragment?, TaxiPresenter?>(),
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
override fun initViews() {
|
||||
|
||||
onAutopilotStatusChanged(
|
||||
getState(),
|
||||
CallerAutoPilotControlManager.isCanStartAutopilot(false)
|
||||
)
|
||||
|
||||
CallerHmiViewControlListenerManager.invokeMainPageViewVisible(View.VISIBLE)
|
||||
|
||||
taxi_close_navi_icon.setOnClickListener {
|
||||
@@ -200,92 +196,8 @@ class TaxiFragment :MvpFragment<TaxiFragment?, TaxiPresenter?>(),
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
/**
|
||||
* 改变自动驾驶状态
|
||||
*
|
||||
* @param status 2 - running 1 - enable 2 - disable
|
||||
*/
|
||||
fun onAutopilotStatusChanged(status: Int, canStartAuto: Boolean) {
|
||||
activity?.runOnUiThread(Runnable runOnUiThread@{
|
||||
if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != status) {
|
||||
// 1. 主动开启自动驾驶中,不为2(为0、1)则继续loading
|
||||
return@runOnUiThread
|
||||
}
|
||||
if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status
|
||||
) {
|
||||
// 2. 主动开启自动驾驶中,为2则停止loading,并isStarting = false
|
||||
startAutopilotDone(true)
|
||||
return@runOnUiThread
|
||||
}
|
||||
// 3. 其他过程直接更新
|
||||
startOrStopLoadingAnim(false)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止【开启自动驾驶按钮】动画,并更新按钮状态
|
||||
*/
|
||||
fun stopAnimAndUpdateBtnStatus() {
|
||||
startOrStopLoadingAnim(false)
|
||||
startAutopilotDone(false)
|
||||
}
|
||||
|
||||
|
||||
var isStarting = false
|
||||
|
||||
@SuppressLint("ObjectAnimatorBinding")
|
||||
fun startOrStopLoadingAnim(start: Boolean) {
|
||||
if (start) {
|
||||
isStarting = true
|
||||
startingAutopilotCountDown()
|
||||
} else {
|
||||
isStarting = false
|
||||
}
|
||||
}
|
||||
|
||||
private fun startAutopilotDone(success: Boolean) {
|
||||
UiThreadHandler.postDelayed({
|
||||
startOrStopLoadingAnim(false)
|
||||
onAutopilotStatusChanged(
|
||||
getState(),
|
||||
CallerAutoPilotControlManager.isCanStartAutopilot(false)
|
||||
)
|
||||
}, 1000L)
|
||||
}
|
||||
|
||||
private fun startingAutopilotCountDown() {
|
||||
UiThreadHandler.postDelayed({
|
||||
//未启动成功10s后做处理
|
||||
if (isStarting) { //判断动画是否在进行
|
||||
//并且根据状态来设置自动驾驶启动成功还是失败
|
||||
if (getState()
|
||||
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
) {
|
||||
startAutopilotDone(true)
|
||||
} else {
|
||||
startAutopilotDone(false)
|
||||
}
|
||||
}
|
||||
}, TaxiUnmannedConst.TIMER_START_AUTOPILOT_INTERVAL)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 重新开启自动驾驶
|
||||
*/
|
||||
|
||||
fun startAutopilot() {
|
||||
// 在自动驾驶中,或者自己确认车辆环境可开启自动驾驶 则可点击
|
||||
if (!isStarting) {
|
||||
d(SceneConstant.M_TAXI + TAG, "startAutopilot")
|
||||
mPresenter?.startAutoPilot()
|
||||
}
|
||||
}
|
||||
|
||||
fun changeOperationViewVisible(visible: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onMapVisualAngleChanged(visualAngleMode: VisualAngleMode?) {
|
||||
}
|
||||
|
||||
@@ -401,9 +313,6 @@ class TaxiFragment :MvpFragment<TaxiFragment?, TaxiPresenter?>(),
|
||||
fun setGuidHide() {
|
||||
}
|
||||
|
||||
fun updateAutopilotStatus(status: Int, canStartAuto: Boolean) {
|
||||
onAutopilotStatusChanged(status, canStartAuto)
|
||||
}
|
||||
/**
|
||||
* 状态变更
|
||||
* @param inOperation true 可以接单 false 暂停接单
|
||||
@@ -423,9 +332,8 @@ class TaxiFragment :MvpFragment<TaxiFragment?, TaxiPresenter?>(),
|
||||
if (MogoStatusManager.getInstance().isTaxiUnmanedDriverLineRoutingVerifyMode) {
|
||||
showAmapNaviToStationFragment(isShow)
|
||||
} else {
|
||||
// TODO: 需要复原
|
||||
// if (null == taskTabFragment || taskTabFragment!!.get() == null) return
|
||||
// taskTabFragment!!.get()!!.onNaviToEndStationByAMap(isShow)
|
||||
val currentItinerary = findViewById<ItineraryCurrentView>(R.id.currentItinerary)
|
||||
currentItinerary?.onNaviToEndStationByAMap(isShow)
|
||||
}
|
||||
} else if (isShow) { //使用routing数据
|
||||
showRoutingToStationFragment(true)
|
||||
|
||||
@@ -79,7 +79,7 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
TaxiTaskModel.INSTANCE.startAutopilotByClick();
|
||||
}
|
||||
|
||||
private OchTransformDispatch ochTransform = new OchTransformDispatch(){
|
||||
private final OchTransformDispatch ochTransform = new OchTransformDispatch(){
|
||||
@Override
|
||||
public void logout() {
|
||||
TaxiTaskModel.INSTANCE.logout();
|
||||
@@ -92,82 +92,6 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveEnd() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotEnable(boolean canStartAuto) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(mView!=null) {
|
||||
mView.updateAutopilotStatus(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE,canStartAuto);
|
||||
}
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDisable(boolean canStartAuto) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(mView!=null) {
|
||||
mView.updateAutopilotStatus(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE,canStartAuto);
|
||||
}
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRunning(boolean canStartAuto) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(mView!=null) {
|
||||
mView.updateAutopilotStatus(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING,canStartAuto);
|
||||
}
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onParallelDrivingStatus(boolean canStartAuto) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartAdasFailure() {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(mView!=null) {
|
||||
mView.stopAnimAndUpdateBtnStatus();
|
||||
}
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAutopilotStatus(boolean canStartAuto) {
|
||||
if(mView!=null) {
|
||||
mView.updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getState(), canStartAuto);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviToEnd(boolean isAmap, boolean isShow) {
|
||||
@@ -182,18 +106,6 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startOpenAutopilot() {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(mView!=null) {
|
||||
mView.startOrStopLoadingAnim(true);
|
||||
}
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startOpenAutopilotNonManual() {
|
||||
@@ -201,7 +113,6 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
@Override
|
||||
public void run() {
|
||||
if(mView!=null) {
|
||||
mView.startOrStopLoadingAnim(true);
|
||||
mView.showStartAutopilotBlinkAnimation();
|
||||
}
|
||||
}
|
||||
@@ -215,8 +126,6 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
@Override
|
||||
public void run() {
|
||||
if(mView!=null) {
|
||||
mView.startOrStopLoadingAnim(false);
|
||||
mView.updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getState(),canStartAuto);
|
||||
mView.stopAutopilotBlinkAnimation();
|
||||
}
|
||||
}
|
||||
@@ -230,8 +139,6 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
@Override
|
||||
public void run() {
|
||||
if(mView!=null) {
|
||||
mView.startOrStopLoadingAnim(false);
|
||||
mView.updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getState(),canStartAuto);
|
||||
mView.pauseAutopilotBlinkAnimation();
|
||||
}
|
||||
}
|
||||
@@ -245,7 +152,6 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
@Override
|
||||
public void run() {
|
||||
if(mView!=null) {
|
||||
mView.startOrStopLoadingAnim(true);
|
||||
mView.resumeAutopilotBlinkAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +311,6 @@ object TaxiTaskModel {
|
||||
i(TAG, "onAutopilotStatusResponse autopilotsState= $state")
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
DebugView.printInfoMsg("[自驾状态变化] afterValue=STATUS_AUTOPILOT_RUNNING,meaning=自动驾驶中")
|
||||
mADASStatusCallback?.onAutopilotRunning(CallerAutoPilotControlManager.isCanStartAutopilot(false))
|
||||
if ((QueryCurrentTaskRespBean.isTaskStartTaskType(mCurrentTaskWithOrder))) {
|
||||
OchAutopilotAnalytics.triggerStartAutopilotEvent(
|
||||
isRestartAutopilot,
|
||||
@@ -334,7 +333,6 @@ object TaxiTaskModel {
|
||||
// 当美化模式(演示模式)开启时:且有订单、且为去往目的地状态,维持自动驾驶icon开启状态
|
||||
return
|
||||
}
|
||||
mADASStatusCallback?.onAutopilotEnable(CallerAutoPilotControlManager.isCanStartAutopilot(false))
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
DebugView.printInfoMsg("[自驾状态变化] afterValue=STATUS_AUTOPILOT_DISABLE,meaning=不可自动驾驶")
|
||||
if ((FunctionBuildConfig.isDemoMode
|
||||
@@ -345,7 +343,6 @@ object TaxiTaskModel {
|
||||
// 当美化模式(演示模式)开启时:且有订单、且为去往目的地状态,维持自动驾驶icon开启状态
|
||||
return
|
||||
}
|
||||
mADASStatusCallback?.onAutopilotDisable(CallerAutoPilotControlManager.isCanStartAutopilot(false))
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING) {
|
||||
DebugView.printInfoMsg("[自驾状态变化] afterValue=STATUS_PARALLEL_DRIVING,meaning=平行驾驶中")
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
@@ -357,11 +354,9 @@ object TaxiTaskModel {
|
||||
) { //订单中
|
||||
// 当美化模式(演示模式)开启时:且有订单、且为去往目的地状态,维持自动驾驶icon开启状态
|
||||
} else { //美化模式下没订单,显示人工驾驶
|
||||
mADASStatusCallback?.onAutopilotDisable(CallerAutoPilotControlManager.isCanStartAutopilot(false))
|
||||
}
|
||||
return
|
||||
}
|
||||
mADASStatusCallback?.onParallelDrivingStatus(CallerAutoPilotControlManager.isCanStartAutopilot(false))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,7 +412,6 @@ object TaxiTaskModel {
|
||||
|
||||
override fun canStartAutopilot(canStart: Boolean) {
|
||||
super.canStartAutopilot(canStart)
|
||||
mADASStatusCallback?.updateAutopilotStatus(CallerAutoPilotControlManager.isCanStartAutopilot(false))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -487,7 +481,6 @@ object TaxiTaskModel {
|
||||
TAG,
|
||||
"onStartAutopilotFailure: startFailedMessage=$startFailedMessage"
|
||||
)
|
||||
mADASStatusCallback?.onStartAdasFailure()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -778,6 +771,7 @@ object TaxiTaskModel {
|
||||
}
|
||||
clearCurrentOCHOrder()
|
||||
clearLocalCalculateStation()
|
||||
LineManager.setStartAndEndStation(null,null)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -789,13 +783,16 @@ object TaxiTaskModel {
|
||||
listener.onTaskStarted(result)
|
||||
}
|
||||
}
|
||||
if (result.startSite!=null && result.endSite!=null) {
|
||||
LineManager.setStartAndEndStation(result.startSite!!.toCommonStation(),result.endSite!!.toCommonStation())
|
||||
}
|
||||
|
||||
|
||||
//当前任务完成且订单状态到达乘客上车点, 则立马去拉取任务 不再等120s,否则送驾任务要等120s后才能去执行(8.29废)
|
||||
//8.29更新: 当前任务完成且订单状态为乘客已上车, 则立马去拉取任务 不再等120s,否则送驾任务要等120s后才能去执行
|
||||
// 主要是解决A-B演练任务同时接到A-B订单状态流转的问题
|
||||
//注意: 需要去除到达乘客上车点的节点, 这个节点不拉取任务
|
||||
if (QueryCurrentTaskRespBean.isTaskCompleteTaskType(result)) {
|
||||
mADASStatusCallback?.updateAutopilotStatus(CallerAutoPilotControlManager.isCanStartAutopilot(false))
|
||||
mTaxiTaskWithOrderCallbackMap.forEach {
|
||||
val listener = it.value
|
||||
listener.onTaskCompleted(result)
|
||||
@@ -1095,6 +1092,7 @@ object TaxiTaskModel {
|
||||
mCurrentTaskTrajectory = it.first { currentTaskLineId == it.lineId }
|
||||
mCurrentTaskTrajectory?.let {traj->
|
||||
LineManager.setLineInfo(LineInfo(traj.lineId,traj.lineName))
|
||||
LineManager.setContraiInfo(traj.toCommonContraiInfo())
|
||||
}
|
||||
}
|
||||
mTaxiTaskWithOrderCallbackMap.forEach {
|
||||
@@ -1221,15 +1219,6 @@ object TaxiTaskModel {
|
||||
|
||||
fun startAutoPilot() {
|
||||
|
||||
/**
|
||||
* 存在Session
|
||||
*/
|
||||
if (!OchAutoPilotManager.canStartAutopilotBySessionId()) {
|
||||
return
|
||||
}
|
||||
|
||||
OchAutopilotAnalytics.triggerClickStartAutopilotTime(System.currentTimeMillis())
|
||||
|
||||
DebugView.printInfoMsg("[启自驾] startAutoPilot")
|
||||
if (!checkCurrentTaskCondition()) {
|
||||
e(TAG, "no order or order is empty.")
|
||||
@@ -1264,81 +1253,7 @@ object TaxiTaskModel {
|
||||
TAG, "isPassStartAutopilotCommand = " +
|
||||
FunctionBuildConfig.isPassStartAutopilotCommand
|
||||
)
|
||||
//2、6个条件判断
|
||||
if (!CallerAutoPilotControlManager.isCanStartAutopilot(true)) {
|
||||
return
|
||||
}
|
||||
// 3、距离轨迹15m计算
|
||||
mCurrentTaskWithOrder?.let {
|
||||
var resion = OchAutoPilotManager.canStartAutoPilotByDistance(it.lineId)
|
||||
if (TrajectoryAndDistanceManager.errorTypeNoneLineId == resion) {
|
||||
val curTaskAndOrder = getCurrentTaskWithOrder()
|
||||
if (curTaskAndOrder!=null) {
|
||||
if (curTaskAndOrder.startSite != null && curTaskAndOrder.endSite != null) {
|
||||
val startStation = MogoLocation()
|
||||
startStation.longitude = curTaskAndOrder.startSite!!.gcjLon
|
||||
startStation.latitude = curTaskAndOrder.startSite!!.gcjLat
|
||||
val endStation = MogoLocation()
|
||||
endStation.longitude = curTaskAndOrder.endSite!!.gcjLon
|
||||
endStation.latitude = curTaskAndOrder.endSite!!.gcjLat
|
||||
TrajectoryAndDistanceManager.setStationPoint(
|
||||
startStation,
|
||||
endStation,
|
||||
curTaskAndOrder.lineId
|
||||
)
|
||||
}
|
||||
}
|
||||
resion = OchAutoPilotManager.canStartAutoPilotByDistance(it.lineId)
|
||||
}
|
||||
if(!StringUtils.isEmpty(resion)){
|
||||
ToastUtils.showShort(resion)
|
||||
VoiceNotice.showNotice(resion)
|
||||
return
|
||||
}
|
||||
}
|
||||
// 4、ssm 给出数据
|
||||
if (!OchAutoPilotManager.canStartAutoPilotSSM()) {
|
||||
DebugView.printErrorMsg("[启自驾] ${OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason}")
|
||||
val orderNo = mCurrentTaskWithOrder?.order?.orderNo
|
||||
OchAutopilotAnalytics.triggerUnableStartAPReasonEvent(
|
||||
mCurrentTaskWithOrder!!.startSite!!.siteName,
|
||||
mCurrentTaskWithOrder!!.endSite!!.siteName,
|
||||
mCurrentTaskWithOrder!!.lineId.toString(), // todo 这里原来传的是订单号, 现在是任务没有订单号,传了路线id
|
||||
orderNo?:"",
|
||||
OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
//点击开始自动驾驶按钮订单状态去流转, 不再与自动驾驶是否启动成功挂钩
|
||||
isRestartAutopilot = mCurrentTaskWithOrder!!.currentStatus != TaskStatusEnum.StartTask.code
|
||||
|
||||
val parameters = initAutopilotControlParameters()
|
||||
if (null == parameters) {
|
||||
e(TAG, "AutopilotControlParameters is empty.")
|
||||
return
|
||||
}
|
||||
|
||||
val sessionId = OchAutoPilotManager.startAutoPilot(parameters)
|
||||
DebugView.printInfoMsg("[启自驾] 调用成功")
|
||||
d(
|
||||
TAG, "start autopilot with parameter: %s",
|
||||
GsonUtil.jsonFromObject(parameters)
|
||||
+ " ,startSiteName=" + mCurrentTaskWithOrder?.startSite?.siteName
|
||||
+ " ,endSiteName=" + mCurrentTaskWithOrder?.endSite?.siteName
|
||||
+ "isRestartAutopilot = " + isRestartAutopilot
|
||||
)
|
||||
OchAutopilotAnalytics.triggerStartAutopilotEvent(
|
||||
isRestartAutopilot,
|
||||
false,
|
||||
mCurrentTaskWithOrder!!.startSite!!.siteName,
|
||||
mCurrentTaskWithOrder!!.endSite!!.siteName,
|
||||
mCurrentTaskWithOrder!!.lineId.toInt(),
|
||||
if (mCurrentTaskWithOrder!!.order != null) mCurrentTaskWithOrder!!.order!!.orderNo else "",
|
||||
System.currentTimeMillis(),0
|
||||
)
|
||||
OchAutopilotAnalytics.triggerUpdateStartAutoPilotSessionId(sessionId)
|
||||
mControllerStatusCallback?.startOpenAutopilot()
|
||||
LineManager.startAutopilot()
|
||||
}
|
||||
|
||||
fun initAutopilotControlParameters(): AutopilotControlParameters? {
|
||||
|
||||
@@ -58,6 +58,7 @@ import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.aciv_task_
|
||||
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.aciv_task_type_order
|
||||
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_distance_end
|
||||
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_end_order
|
||||
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_order_phone
|
||||
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_submit_task
|
||||
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.cancelOrder
|
||||
import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.commonSlideViewStartServer
|
||||
@@ -145,12 +146,13 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
||||
updateNextTaskFragment(currentTaskWithOrder)
|
||||
}
|
||||
|
||||
// 全程距离和时间
|
||||
is TaskWithOrderUIState.UpdateOrderTripInfo -> {
|
||||
dialog?.setOrderMileage(taskAndOrderUiState.mileage*1000)
|
||||
actv_distance_end.text = TaskUtils.getCurrentTaskDistance(taskAndOrderUiState.mileage.toLong())
|
||||
actv_time_end.text = TaskUtils.getCurrentTaskTime(taskAndOrderUiState.duration.toLong())
|
||||
}
|
||||
|
||||
// 根据轨迹计算剩余距离和时间
|
||||
is TaskWithOrderUIState.UpdateTaskTripLocalCalculateInfo -> {
|
||||
actv_distance_end.text = TaskUtils.getCurrentTaskDistance(taskAndOrderUiState.meters.toLong())
|
||||
actv_time_end.text = TaskUtils.getCurrentTaskTime(taskAndOrderUiState.timeInSecond.toLong())
|
||||
@@ -299,6 +301,11 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
||||
group_itinerary_info.visibility = GONE
|
||||
include_empty.visibility = VISIBLE
|
||||
prepareTaskCountdownTv.visibility = GONE
|
||||
|
||||
actv_end_order.visibility = GONE
|
||||
commonSlideViewStartServer.visibility = GONE
|
||||
actv_submit_task.visibility = GONE
|
||||
|
||||
}
|
||||
|
||||
private fun initOnClickListener() {
|
||||
@@ -410,7 +417,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
||||
|
||||
naviToStart.id,
|
||||
naviToEnd.id -> {
|
||||
showNaviToEndStationFragment(true)
|
||||
showNaviToEndStationFragment()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -420,10 +427,9 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
||||
*
|
||||
* @param isShow
|
||||
*/
|
||||
private fun showNaviToEndStationFragment(isShow: Boolean) {
|
||||
private fun showNaviToEndStationFragment() {
|
||||
fragment?.let {
|
||||
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_START_NAVI_TO_END_STATION)
|
||||
.post(it.lifecycleScope, isShow)
|
||||
TaxiTaskModel.startNaviToEndStation(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,6 +461,12 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
||||
aciv_task_type_exercise.visibility = View.GONE
|
||||
// 轨迹标识
|
||||
trajectoryType.visibility = View.GONE
|
||||
|
||||
|
||||
actv_end_order.visibility = GONE
|
||||
commonSlideViewStartServer.visibility = GONE
|
||||
actv_submit_task.visibility = GONE
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,6 +517,21 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
||||
order.bookingUserPhone,
|
||||
order.passengerSize
|
||||
)
|
||||
|
||||
var tempPhone = order.bookingUserPhone
|
||||
tempPhone.let {
|
||||
if (it.length > 8) {
|
||||
//截取电话号码前三位
|
||||
val phoneNumPre = it.substring(0, 3)
|
||||
//截取电话号码后四位
|
||||
val phoneNumFix = it.substring(7)
|
||||
tempPhone = "$phoneNumPre****$phoneNumFix"
|
||||
}
|
||||
}
|
||||
actv_order_phone.text = tempPhone
|
||||
orderPhoneAndNum.text = "${ order.passengerSize}人"
|
||||
|
||||
|
||||
startStationName.text = order.orderStartSite?.siteName
|
||||
endStationName.text = order.orderEndSite?.siteName
|
||||
TaxiTaskModel.getCurrentOrderTrajectoryList().also {
|
||||
@@ -518,6 +545,9 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
||||
dismissDialog()
|
||||
initContainerView(false)
|
||||
removeAllMapMarker()
|
||||
actv_end_order.visibility = GONE
|
||||
commonSlideViewStartServer.visibility = GONE
|
||||
actv_submit_task.visibility = GONE
|
||||
}
|
||||
|
||||
TaxiOrderStatusEnum.ArriveAtEnd.code -> { //到达目的地
|
||||
@@ -549,15 +579,14 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
||||
taskStatus.text = resources.getString(R.string.arrived_start_site)
|
||||
|
||||
actv_end_order.visibility = GONE
|
||||
commonSlideViewStartServer.visibility = GONE
|
||||
actv_submit_task.visibility = VISIBLE
|
||||
|
||||
if (order.orderStatus == TaxiOrderStatusEnum.UserArriveAtStart.code) {
|
||||
actv_submit_task.text =
|
||||
ResourcesUtils.getString(R.string.module_och_taxi_order_server_start)
|
||||
commonSlideViewStartServer.visibility = VISIBLE
|
||||
actv_submit_task.visibility = GONE
|
||||
}
|
||||
else {
|
||||
actv_submit_task.text =
|
||||
ResourcesUtils.getString(R.string.module_och_taxi_order_server_start_wait_check)
|
||||
commonSlideViewStartServer.visibility = GONE
|
||||
actv_submit_task.visibility = VISIBLE
|
||||
}
|
||||
hideNaviBtns()
|
||||
actv_time_end.text = TaskUtils.getCurrentTaskWaitTimeHtml()
|
||||
@@ -567,7 +596,12 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
||||
dismissDialog()
|
||||
taskStatus.text = resources.getString(R.string.task_start_start_site)
|
||||
actv_end_order.visibility = GONE
|
||||
commonSlideViewStartServer.visibility = VISIBLE
|
||||
commonSlideViewStartServer.visibility = GONE
|
||||
actv_submit_task.visibility = GONE
|
||||
}
|
||||
else ->{
|
||||
actv_end_order.visibility = GONE
|
||||
commonSlideViewStartServer.visibility = GONE
|
||||
actv_submit_task.visibility = GONE
|
||||
}
|
||||
}
|
||||
@@ -597,6 +631,10 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
||||
// 演练单标识
|
||||
aciv_task_type_exercise.visibility = View.VISIBLE
|
||||
|
||||
actv_end_order.visibility = GONE
|
||||
commonSlideViewStartServer.visibility = GONE
|
||||
actv_submit_task.visibility = GONE
|
||||
|
||||
naviToStart.visibility = View.GONE
|
||||
naviToEnd.visibility = if (currentStatus >= TaskStatusEnum.StartTask.code) View.VISIBLE else View.GONE
|
||||
|
||||
@@ -719,9 +757,11 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
||||
} else if (currentTaskWithOrder.currentStatus == TaskStatusEnum.CompleteTask.code &&
|
||||
currentTaskWithOrder.taskType <= TaskTypeEnum.ToOrderStartTask.code
|
||||
) {
|
||||
actv_distance_end.text = "已到达 ${currentTaskWithOrder.endSite?.siteName}"
|
||||
actv_distance_end.text = ""
|
||||
actv_time_end.text = ""
|
||||
} else {
|
||||
actv_distance_end.text = "距离 -- 公里, 用时 -- 分钟"
|
||||
actv_distance_end.text = "-- 公里"
|
||||
actv_time_end.text = "-- 分钟"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -815,4 +855,23 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
fun onNaviToEndStationByAMap(isShow: Boolean) {
|
||||
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() ?: return
|
||||
fragment?.let {
|
||||
if (currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code)
|
||||
isShow else true
|
||||
FlowBus.with<Boolean>(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_AMAP_NAVI_TO_STATION_FRAGMENT)
|
||||
.post(it.lifecycleScope,
|
||||
if (currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code)
|
||||
isShow
|
||||
else
|
||||
true
|
||||
)
|
||||
updateRemainDistanceAndTime(
|
||||
if (currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code)
|
||||
isShow else true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -298,14 +298,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_itinerary_actions"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="actv_submit_task,commonSlideViewStartServer,actv_end_order"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
<com.mogo.och.common.module.wigets.commonview.EmptyView
|
||||
android:id="@+id/include_empty"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user