[sweeper-cloud]模拟获取当前正在执行的的任务逻辑处理
This commit is contained in:
@@ -6,8 +6,9 @@ import androidx.lifecycle.lifecycleScope
|
||||
import chassis.ChassisStatesOuterClass
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.sweepercloud.R
|
||||
import com.mogo.och.sweepercloud.bean.SweeperRoutePlanningUpdateReqBean
|
||||
import com.mogo.och.sweepercloud.callback.SweeperCloudDialogClickListener
|
||||
@@ -16,6 +17,7 @@ import com.mogo.och.sweepercloud.ui.dialog.SweeperCloudLoadingDialog
|
||||
import com.mogo.och.sweepercloud.util.SweeperCloudTaskUtils.createConfirmStartSubTaskDialog
|
||||
import com.mogo.och.sweepercloud.util.SweeperCloudTaskUtils.createReceivedTaskInfoDialog
|
||||
import com.mogo.och.sweepercloud.util.SweeperCloudTaskUtils.createSweeperTaskEndDialog
|
||||
import com.mogo.och.sweepercloud.util.SweeperCloudTaskUtils.printMessage
|
||||
import com.mogo.och.sweepercloud.view.SweeperCurrentTaskInfoView
|
||||
import com.zhjt.mogo.adas.data.sweeper.SweeperCloudTask
|
||||
import com.zhjt.mogo.adas.data.sweeper.common.SweeperCommon
|
||||
@@ -160,12 +162,13 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
fun onSweeperCloudTask(messageType: SweeperCloudTask.MessageType, taskInfo: SweeperTask.TaskInfo?) {
|
||||
this.mTaskInfo = taskInfo
|
||||
this.mSubMutableList = taskInfo?.subListList
|
||||
CallerLogger.d(SceneConstant.M_SWEEPER + TAG, taskInfo?.let { printMessage(it) })
|
||||
if (taskInfo == null) {
|
||||
setShowCurrentTaskPanelView(false)
|
||||
return
|
||||
}
|
||||
//主动拉取云端正在执行的任务,有则直接在任务列表展示
|
||||
if (messageType == SweeperCloudTask.MessageType.PadSendGetTaskReq) {
|
||||
if (taskInfo == null) {
|
||||
setShowCurrentTaskPanelView(false)
|
||||
return
|
||||
}
|
||||
getCurrentView().setData(taskInfo, getCurrentPosition())
|
||||
setShowCurrentTaskPanelView(true)
|
||||
addTaskData()
|
||||
@@ -212,6 +215,7 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
* 云端请求结束大任务
|
||||
*/
|
||||
fun onSweeperCloudTaskStop(taskId: String, stopTaskType: SweeperTaskStop.StopTaskType) {
|
||||
mLoadingDialog.hideLoading()
|
||||
mTaskInfo?.let {
|
||||
//如果云端要更新的任务和本地缓存任务不是同一个,在无法结束任务
|
||||
if (taskId != it.taskId) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.och.sweepercloud.model;
|
||||
import android.content.Context;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.elegant.utils.UiThreadHandler;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.module.status.IMogoStatusChangedListener;
|
||||
@@ -210,13 +211,12 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
mSubTaskType = SweeperTask.TaskModel.UNRECOGNIZED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存自动驾驶状态
|
||||
*
|
||||
* @param autopilotState
|
||||
* 获取自动开始状态
|
||||
*/
|
||||
public void setAutopilotState(int autopilotState) {
|
||||
this.mAutopilotState = autopilotState;
|
||||
public int getAutopilotState() {
|
||||
return this.mAutopilotState;
|
||||
}
|
||||
|
||||
public static List<SweeperRoutePlanningUpdateReqBean.Result> coordinateConverterWgsToGcjList(Context mContext,
|
||||
@@ -298,7 +298,8 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
public void onSweeperFutianCloudTask(@NonNull SweeperCloudTask.MessageType messageType, @NonNull String reqNo, long sysTime,
|
||||
SweeperTask.TaskInfo taskInfo) {
|
||||
if (taskInfo != null) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCloudTask:" + printMessage(taskInfo));
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG,
|
||||
"onSweeperFutianCloudTask:" + printMessage(taskInfo) + "mSweeperTaskCallback:" + mSweeperTaskCallback);
|
||||
}
|
||||
if (mSweeperTaskCallback != null) {
|
||||
msgTypeAndReqNo.put(messageType.getNumber(), reqNo);
|
||||
@@ -456,8 +457,11 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
SweeperTask.GetTaskReq getTaskReq = builder.build();
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "getCurrentTask:" + printMessage(getTaskReq) + " reqNo:" + reqNo);
|
||||
getAutoPilotControlManager().sendSweeperGetTaskReq(reqNo, getTaskReq);
|
||||
// TODO: 2023/5/5 模拟云控获取任务
|
||||
SweeperCloudTaskUtils.mockSendCloudTaskInfo(SweeperCloudTask.MessageType.PadSendGetTaskReq);
|
||||
// TODO: 2023/5/5 模拟云控获取任务
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
SweeperCloudTaskUtils.mockSendCloudTaskInfo(SweeperCloudTask.MessageType.PadSendGetTaskReq);
|
||||
}, 1000);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -536,6 +540,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onAutopilotStatusResponse state:" + autoPilotStatusInfo.getState());
|
||||
this.mAutopilotState = autoPilotStatusInfo.getState();
|
||||
switch (autoPilotStatusInfo.getState()) {
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE://不可自动驾驶
|
||||
break;
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.och.sweepercloud.presenter;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerSweeperFutianCleanSystemListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
@@ -83,6 +82,14 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自动驾驶状态
|
||||
* @return
|
||||
*/
|
||||
public int getAutopilotState() {
|
||||
return SweeperTaskModel.getInstance().getAutopilotState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startOpenAutopilot() {
|
||||
|
||||
@@ -102,16 +109,6 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
SweeperTaskModel.getInstance().setSubtask(subTaskId, subTaskType, currentLineId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试使用
|
||||
*
|
||||
* @param status
|
||||
*/
|
||||
public void debugAutoPilotStatus(int status) {
|
||||
AutopilotStatusInfo info = new AutopilotStatusInfo();
|
||||
info.setState(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前正在执行的任务
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,8 @@ import android.content.Context
|
||||
import com.google.protobuf.MessageOrBuilder
|
||||
import com.google.protobuf.TextFormat
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.sweepercloud.callback.SweeperCloudDialogClickListener
|
||||
import com.mogo.och.sweepercloud.model.SweeperTaskModel
|
||||
@@ -16,6 +18,8 @@ import com.zhjt.mogo.adas.data.sweeper.task.status.SweeperTaskStatus
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop
|
||||
|
||||
object SweeperCloudTaskUtils {
|
||||
const val TAG = "SweeperCloudTaskUtils"
|
||||
|
||||
/**
|
||||
* 模拟云控发送任务给pad
|
||||
*/
|
||||
@@ -99,6 +103,7 @@ object SweeperCloudTaskUtils {
|
||||
System.currentTimeMillis(),
|
||||
builder.build()
|
||||
)
|
||||
CallerLogger.d(SceneConstant.M_SWEEPER + TAG, "messageType:"+messageType+"taskInfo:"+printMessage(builder.build()))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -100,22 +100,23 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:roundLayoutRadius="@dimen/dp_16">
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.SweeperVideoView
|
||||
android:id="@+id/sweeper_video_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_401"
|
||||
android:src="#999999"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<!-- <com.mogo.eagle.core.function.hmi.ui.widget.MogoVideoView
|
||||
android:id="@+id/sweeper_video_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_401"
|
||||
android:src="#999999"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<com.mogo.och.sweepercloud.view.WeltSmallMapView
|
||||
android:id="@+id/sweeper_task_welt_small_map"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_401"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/sweeper_video_view" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</com.mogo.och.common.module.wigets.OCHRoundConstraintLayout>
|
||||
|
||||
<ImageView
|
||||
@@ -198,12 +199,12 @@
|
||||
android:id="@+id/btnSendTask"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_200"
|
||||
android:background="#f00"
|
||||
android:text="发送任务"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_200"/>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSendSubTaskConfirm"
|
||||
@@ -221,8 +222,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00f"
|
||||
android:text="结束大任务"
|
||||
android:textSize="30sp"
|
||||
android:textColor="#fff"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintRight_toRightOf="@id/btnSendTask"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnSendSubTaskConfirm" />
|
||||
|
||||
@@ -242,8 +243,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#000000"
|
||||
android:text="大任务状态"
|
||||
android:textSize="30sp"
|
||||
android:textColor="#fff"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintRight_toRightOf="@id/btnSendSubtaskStatus"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnSendSubtaskStatus" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user