[Routing dev]
1、增加代码注释
This commit is contained in:
@@ -4,14 +4,59 @@ import com.mogo.och.taxi.bean.GrayLineBean
|
||||
import com.mogo.och.taxi.bean.StartGrayAndQueryContrailRsp
|
||||
|
||||
interface ITaxiRoutingCallback {
|
||||
/**
|
||||
* 查询灰度路线列表--成功✅
|
||||
*/
|
||||
fun onQueryRoutingGrayLineListSuccess(data: MutableList<GrayLineBean>)
|
||||
|
||||
/**
|
||||
* 查询灰度路线列表--失败❌
|
||||
* @param errorStr 错误信息
|
||||
*/
|
||||
fun onQueryRoutingGrayLineListFailed(errorStr: String)
|
||||
|
||||
/**
|
||||
* 灰度任务&查询轨迹详情--成功✅
|
||||
*/
|
||||
fun onStartGrayTaskAndQueryContrailSuccess(data: StartGrayAndQueryContrailRsp)
|
||||
|
||||
/**
|
||||
* 灰度任务&查询轨迹详情--失败❌
|
||||
* @param errorStr 错误信息
|
||||
*/
|
||||
fun onStartGrayTaskAndQueryContrailFailed(errorStr: String)
|
||||
|
||||
/**
|
||||
* 灰度任务过程中,上报问题打点--成功✅
|
||||
*/
|
||||
fun onSubmitGrayLineIssueLocationSuccess()
|
||||
|
||||
/**
|
||||
* 灰度任务过程中,上报问题打点--失败❌
|
||||
* @param errorStr 错误信息
|
||||
*/
|
||||
fun onSubmitGrayLineIssueLocationFailed(errorStr: String)
|
||||
|
||||
/**
|
||||
* 结束灰度任务--成功✅
|
||||
*/
|
||||
fun onSubmitEndTaskSuccess()
|
||||
|
||||
/**
|
||||
* 结束灰度任务--成功❌
|
||||
* @param errorStr 错误信息
|
||||
*/
|
||||
fun onSubmitEndTaskFailed(errorStr: String)
|
||||
|
||||
/**
|
||||
* MAP到站通知
|
||||
* @param grayId 灰度路线ID
|
||||
*/
|
||||
fun onAutoPilotArriveAtEndStation(grayId: Long?)
|
||||
|
||||
/**
|
||||
* 自车定位围栏
|
||||
* @param grayId 灰度路线ID
|
||||
*/
|
||||
fun onGDMapArriveAtEndStation(grayId: Long?)
|
||||
}
|
||||
|
||||
@@ -105,6 +105,9 @@ object TaxiRoutingServiceManager {
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "dot/list"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记灰度任务被启动验证
|
||||
*/
|
||||
fun startGrayTaskAndQueryRoutingContrail(
|
||||
context: Context,
|
||||
sn: String,
|
||||
|
||||
@@ -73,9 +73,12 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
* 开启自动驾驶 自驾模式
|
||||
*/
|
||||
public void startAutoPilot() {
|
||||
// 这里区分是订单还是灰度测试
|
||||
if (MogoStatusManager.getInstance().isTaxiUnmanedDriverLineRoutingVerifyMode()) {
|
||||
// 灰度测试
|
||||
TaxiRoutingModel.INSTANCE.startAutoPilotByClick();
|
||||
} else {
|
||||
// 订单
|
||||
TaxiTaskModel.INSTANCE.startAutopilotByClick();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +90,8 @@ class TaxiRoutingChooseLineActivity : AppCompatActivity() {
|
||||
btnClose.setOnClickListener {
|
||||
finish()
|
||||
}
|
||||
|
||||
// 选择路线后,「确认」按钮
|
||||
btnChooseLineSubmit.setOnClickListener {
|
||||
if (mCurrentChosenPosition == -1) {
|
||||
ToastUtils.showLong("请先选择任务")
|
||||
@@ -99,6 +101,7 @@ class TaxiRoutingChooseLineActivity : AppCompatActivity() {
|
||||
mLoadingDialog.showLoading()
|
||||
val chosenItem = mRoutingLineList[mCurrentChosenPosition]
|
||||
mViewModel.sendUiIntent(
|
||||
// 调用查询接口获取路线详情
|
||||
TaxiRoutingUiIntent.StartTaskAndQueryContrail(chosenItem)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class TaxiRoutingChooseLineAdapter(
|
||||
override fun onBindViewHolder(holder: SwitchLineViewHolder, position: Int) {
|
||||
val currentPosition = holder.bindingAdapterPosition
|
||||
val data = mData[currentPosition]
|
||||
// 区分Routing和循迹
|
||||
|
||||
holder.lineNameTextView.text = data.lineName
|
||||
holder.todayVerifyNumTextView.text = "本车今日已验证:${data.carVerificationCount}次"
|
||||
holder.historyVerifyNumTextView.text =
|
||||
|
||||
@@ -122,6 +122,9 @@ class TaxiRoutingFragment : BaseFragment(), ICommonNaviChangedCallback {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示选择任务视图
|
||||
*/
|
||||
private fun showChooseTaskView() {
|
||||
noDataContainer.visibility = View.VISIBLE
|
||||
mCurrentTaskLayout.visibility = View.GONE
|
||||
@@ -134,6 +137,9 @@ class TaxiRoutingFragment : BaseFragment(), ICommonNaviChangedCallback {
|
||||
removeAllMapMarker()
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示当前路线任务信息
|
||||
*/
|
||||
private fun showCurrentLineTaskContentView(data: RoutingUIState.RoutingTask) {
|
||||
noDataContainer.visibility = View.GONE
|
||||
mCurrentTaskLayout.visibility = View.VISIBLE
|
||||
@@ -143,6 +149,7 @@ class TaxiRoutingFragment : BaseFragment(), ICommonNaviChangedCallback {
|
||||
|
||||
btnChooseTask.visibility = View.GONE
|
||||
btnStartTask.visibility = View.VISIBLE
|
||||
// 开始任务,按钮
|
||||
btnStartTask.setOnClickListener {
|
||||
mViewModel.sendUiIntent(TaxiRoutingUiIntent.StartTaskAction(data))
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ class TaxiRoutingFragmentViewModel : BaseViewModel<TaxiRoutingUiState, TaxiRouti
|
||||
.setTaxiUnmanedDriverLineRoutingPerformTask(TAG, true)
|
||||
}
|
||||
|
||||
// 启动自动驾驶
|
||||
is TaxiRoutingUiIntent.StartTaskAction -> {
|
||||
DebugView.printInfoMsg("[开始任务] 准备开始任务")
|
||||
val grayLineBean = intent.routingTask.grayLineBean
|
||||
|
||||
@@ -88,7 +88,9 @@ object TaxiRoutingModel {
|
||||
OchAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
//MAP到站监听
|
||||
/**
|
||||
* MAP到站监听
|
||||
*/
|
||||
private val mMogoAutopilotStatusListener: IOchAutopilotStatusListener =
|
||||
object : IOchAutopilotStatusListener {
|
||||
|
||||
@@ -128,7 +130,9 @@ object TaxiRoutingModel {
|
||||
}
|
||||
}
|
||||
|
||||
// 自车定位监听
|
||||
/**
|
||||
* 自车定位监听
|
||||
*/
|
||||
private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener =
|
||||
object : IMoGoChassisLocationGCJ02Listener {
|
||||
override fun onChassisLocationGCJ02(currentLocation: MogoLocation?) {
|
||||
@@ -199,6 +203,9 @@ object TaxiRoutingModel {
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询灰度路线
|
||||
*/
|
||||
fun queryRoutingGrayLineList() {
|
||||
DebugView.printInfoMsg("[查询灰度路线] 准备发送请求,sn=${SharedPrefsMgr.getInstance().sn}")
|
||||
TaxiRoutingServiceManager.queryRoutingGrayLineList(mContext,
|
||||
@@ -255,6 +262,9 @@ object TaxiRoutingModel {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始灰度任务&查询轨迹详情
|
||||
*/
|
||||
fun startGrayTaskAndQueryRoutingContrail(contrailId: Long, grayLineBean: GrayLineBean) {
|
||||
DebugView.printInfoMsg("[开始灰度任务&查询轨迹详情] 准备发送请求,contrailId=${contrailId}, lineId=${grayLineBean.lineId}")
|
||||
TaxiRoutingServiceManager.startGrayTaskAndQueryRoutingContrail(
|
||||
@@ -275,6 +285,7 @@ object TaxiRoutingModel {
|
||||
DebugView.printInfoMsg("[开始灰度任务&查询轨迹详情] 请求success,taskId=${data.taskId}, contrailId=${contrailId}, lineId=${grayLineBean.lineId}")
|
||||
mTaxiRoutingCallbackMap.forEach {
|
||||
val listener = it.value
|
||||
//TODO Routing 从这里解析出经停信息,并和订单一样调用下载轨迹接口
|
||||
listener.onStartGrayTaskAndQueryContrailSuccess(data)
|
||||
}
|
||||
}
|
||||
@@ -315,6 +326,9 @@ object TaxiRoutingModel {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 灰度任务过程中,上报问题打点
|
||||
*/
|
||||
fun submitGrayLineIssueLocation(grayId: Long, gcjLon: Double, gcjLat: Double) {
|
||||
DebugView.printInfoMsg("[上报打点] 准备发送请求,grayId=$grayId, gcjLon=$gcjLon, gcjLat=$gcjLat")
|
||||
val submit = SubmitGrayLineIssueLocationReq(grayId, gcjLon, gcjLat)
|
||||
@@ -374,6 +388,9 @@ object TaxiRoutingModel {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束灰度任务
|
||||
*/
|
||||
fun endGrayTask(grayId: Long, type: EndGrayTaskFeedbackType, occurrenceTime:Long,) {
|
||||
DebugView.printInfoMsg("[结束灰度任务] 准备发送请求,grayId=$grayId, type=${type.type}, typeName=${type.name}")
|
||||
val submit = EndGrayContrailTaskReq(grayId, type.type,occurrenceTime)
|
||||
@@ -432,6 +449,9 @@ object TaxiRoutingModel {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新灰度路线信息
|
||||
*/
|
||||
fun updateCurrentGrayLineAndContrail(
|
||||
grayLineBean: GrayLineBean?,
|
||||
contrailBean: ContrailBean?,
|
||||
@@ -442,6 +462,9 @@ object TaxiRoutingModel {
|
||||
currentGrayId = grayId
|
||||
}
|
||||
|
||||
/**
|
||||
* 灰度测试路线,启动自动驾驶
|
||||
*/
|
||||
fun startAutoPilotByClick() {
|
||||
if (currentGrayLineBean == null || currentContrailBean == null) {
|
||||
CallerLogger.e(
|
||||
@@ -454,6 +477,9 @@ object TaxiRoutingModel {
|
||||
startAutoPilot(currentGrayLineBean!!, currentContrailBean!!)
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动自动驾驶
|
||||
*/
|
||||
fun startAutoPilot(grayLineBean: GrayLineBean, contrailBean: ContrailBean) {
|
||||
if (grayLineBean.startSite == null || grayLineBean.endSite == null) {
|
||||
CallerLogger.e(TAG, "start site or end site is null")
|
||||
@@ -487,12 +513,14 @@ object TaxiRoutingModel {
|
||||
return
|
||||
}
|
||||
|
||||
// 初始化自动驾驶需要的参数
|
||||
val parameters = initAutopilotControlParameters(grayLineBean, contrailBean)
|
||||
if (null == parameters) {
|
||||
CallerLogger.e(TAG, "AutopilotControlParameters is empty.")
|
||||
return
|
||||
}
|
||||
|
||||
// 开启自动驾驶
|
||||
OchAutoPilotManager.startAutoPilot(parameters);
|
||||
|
||||
DebugView.printInfoMsg("[启自驾] 调用成功")
|
||||
|
||||
Reference in New Issue
Block a user