[sweeper-cloud] 接取云控任务确认弹窗逻辑处理
This commit is contained in:
@@ -16,8 +16,11 @@ import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop.StopTaskType
|
||||
*/
|
||||
interface ISweeperCloudTaskCallback {
|
||||
|
||||
fun onSweeperCloudTask(messageType: SweeperCloudTask.MessageType,taskInfo: SweeperTask.TaskInfo)
|
||||
fun onSweeperCloudTask(messageType: SweeperCloudTask.MessageType,taskInfo: SweeperTask.TaskInfo?)
|
||||
|
||||
/**
|
||||
* 云端下发子任务请求pad确认
|
||||
*/
|
||||
fun onSweeperCloudTaskConfirm(taskId:String,subTaskId:String)
|
||||
|
||||
fun onSweeperCloudTaskStatus(taskId:String,subTaskId:String,subTaskStatus: SweeperCommon.TaskStatus)
|
||||
@@ -43,4 +46,5 @@ interface ISweeperCloudTaskCallback {
|
||||
*/
|
||||
fun onSweeperFutianCleanSystemState(cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates)
|
||||
|
||||
|
||||
}
|
||||
@@ -19,9 +19,9 @@ public class WeltDataBean implements Serializable {
|
||||
|
||||
private int id;
|
||||
|
||||
@ColumnInfo(name = "subTaskId", typeAffinity = ColumnInfo.INTEGER)//子任务id
|
||||
@ColumnInfo(name = "subTaskId", typeAffinity = ColumnInfo.TEXT)//子任务id
|
||||
|
||||
private int subTaskId;
|
||||
private String subTaskId;
|
||||
|
||||
@ColumnInfo(name = "locLon", typeAffinity = ColumnInfo.REAL)
|
||||
|
||||
@@ -55,11 +55,11 @@ public class WeltDataBean implements Serializable {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getSubTaskId() {
|
||||
public String getSubTaskId() {
|
||||
return subTaskId;
|
||||
}
|
||||
|
||||
public void setSubTaskId(int subTaskId) {
|
||||
public void setSubTaskId(String subTaskId) {
|
||||
this.subTaskId = subTaskId;
|
||||
}
|
||||
|
||||
|
||||
@@ -437,6 +437,10 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前子任务终点
|
||||
* @param subTaskCoordinate
|
||||
*/
|
||||
public void setCurrentTaskEndMarker(LatLng subTaskCoordinate) {
|
||||
if (mMapWeltView != null) {
|
||||
mMapWeltView.setCurrentTaskCoordinatesLatLng(subTaskCoordinate);
|
||||
@@ -457,30 +461,15 @@ public abstract class BaseSweeperTabFragment<V extends IView, P extends Presente
|
||||
mTaskDataToFragmentCallback.clearAllMarkerAndPolyline();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航去目的地
|
||||
*/
|
||||
public void startNaviToStation(Boolean isVoicePlay, double startLat, double startLng, double endLat, double endLng) {
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).destroyAmaNavi();
|
||||
NaviLatLng startNaviLatLng = new NaviLatLng(startLat, startLng);
|
||||
NaviLatLng endNaviLatLng = new NaviLatLng(endLat, endLng);
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).initAMapNavi(startNaviLatLng, endNaviLatLng);
|
||||
AmapNaviToDestinationModel.getInstance(getContext()).setVoiceIsMute(isVoicePlay);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置任务轨迹点数据
|
||||
*/
|
||||
public void setTaskRouteList(ArrayList<SweeperRoutePlanningUpdateReqBean.Result> routeList) {
|
||||
mRouteList = routeList;
|
||||
ThreadUtils.getSinglePool().execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMapWeltView.setRouteList(routeList);
|
||||
if (mTaskDataToFragmentCallback != null) {
|
||||
mTaskDataToFragmentCallback.setRouteList(routeList);
|
||||
}
|
||||
ThreadUtils.getSinglePool().execute(() -> {
|
||||
mMapWeltView.setRouteList(routeList);
|
||||
if (mTaskDataToFragmentCallback != null) {
|
||||
mTaskDataToFragmentCallback.setRouteList(routeList);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,8 +15,10 @@ import com.mogo.och.sweepercloud.ui.dialog.SweeperCloudDialog
|
||||
import com.mogo.och.sweepercloud.util.SweeperCloudTaskMockUtils.sendCloudTaskInfo
|
||||
import com.mogo.och.sweepercloud.view.SweeperCurrentTaskInfoView
|
||||
import com.zhjt.mogo.adas.data.sweeper.SweeperCloudTask
|
||||
import com.zhjt.mogo.adas.data.sweeper.common.SweeperCommon
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask.SubTaskInfo
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.confirm.SweeperTaskConfirm
|
||||
import kotlinx.android.synthetic.main.fragment_och_sweeper.*
|
||||
import kotlinx.android.synthetic.main.sweeper_no_data_common_view.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -31,7 +33,6 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
const val TAG = "SweeperFragment"
|
||||
}
|
||||
|
||||
private var mCurrentSubPosition: Int = 0 //子任务下标
|
||||
private var mSubMutableList: MutableList<SubTaskInfo>? = null
|
||||
private var mCleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates? = null
|
||||
private var mLocation: MogoLocation? = null
|
||||
@@ -67,12 +68,13 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
private fun setShowCurrentTaskPanelView(isShow: Boolean) {
|
||||
if (isShow) {
|
||||
sweeper_current_task_view.visibility = View.VISIBLE
|
||||
noTaskDataView.visibility=View.GONE
|
||||
noTaskDataView.visibility = View.GONE
|
||||
} else {
|
||||
sweeper_current_task_view.visibility = View.GONE
|
||||
noTaskDataView.visibility=View.VISIBLE
|
||||
noTaskDataView.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* VR模式切换
|
||||
*
|
||||
@@ -89,13 +91,6 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
mPresenter?.debugAutoPilotStatus(status)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置子任务的状态
|
||||
*/
|
||||
fun setSubTaskState(isWorking: Boolean) {
|
||||
getCurrentView().setSubTaskState(isWorking)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置各种监听事件
|
||||
*/
|
||||
@@ -106,10 +101,8 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
}
|
||||
|
||||
fun onSweeperFutianCleanSystemState(cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates) {
|
||||
lifecycleScope.launch(Dispatchers.Main) {
|
||||
mCleanSystemState = cleanSystemState
|
||||
sweeper_cl_work_mode.setSweeperFutianCleanSystemState(mSubTaskType, cleanSystemState)
|
||||
}
|
||||
mCleanSystemState = cleanSystemState
|
||||
sweeper_cl_work_mode.setSweeperFutianCleanSystemState(mSubTaskType, cleanSystemState)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,7 +112,10 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
this.mLocation = location
|
||||
}
|
||||
|
||||
private fun addWeltData() {
|
||||
/**
|
||||
* 大任务中所有子任务起终点集合
|
||||
*/
|
||||
private fun addTaskData() {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
mSubMutableList?.let { subList ->
|
||||
if (subList.size <= 0) {
|
||||
@@ -135,7 +131,6 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
dataList.add(index + 1, endLatLng)
|
||||
}
|
||||
setTaskListCoordinatesLatLng(dataList)
|
||||
setEndStationMarker(subList)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,31 +138,78 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
/**
|
||||
* 设置当前子任务终点
|
||||
*/
|
||||
private fun setEndStationMarker(subList: MutableList<SubTaskInfo>) {
|
||||
val endPoint = subList[mCurrentSubPosition].endLocation
|
||||
val endLatLng = LatLng(endPoint.latitude, endPoint.longitude)
|
||||
super.mCurrentTaskEndStation = endLatLng
|
||||
setCurrentTaskEndMarker(endLatLng)
|
||||
private fun setEndStationMarker() {
|
||||
mSubMutableList?.let { subList ->
|
||||
val position = getCurrentPosition()
|
||||
if (position != -1) {
|
||||
val endPoint = subList[position].endLocation
|
||||
val endLatLng = LatLng(endPoint.latitude, endPoint.longitude)
|
||||
super.mCurrentTaskEndStation = endLatLng
|
||||
setCurrentTaskEndMarker(endLatLng)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置云端任务信息
|
||||
*/
|
||||
fun onSweeperCloudTask(messageType: SweeperCloudTask.MessageType, taskInfo: SweeperTask.TaskInfo) {
|
||||
fun onSweeperCloudTask(messageType: SweeperCloudTask.MessageType, taskInfo: SweeperTask.TaskInfo?) {
|
||||
this.mTaskInfo = taskInfo
|
||||
setShowCurrentTaskPanelView(true)
|
||||
this.mSubMutableList = taskInfo?.subListList
|
||||
if (messageType == SweeperCloudTask.MessageType.PadSendGetTaskReq) {//主动拉取云端正在执行的任务,则直接在任务列表展示
|
||||
getCurrentView().setData(taskInfo, mCurrentSubPosition)
|
||||
if (taskInfo == null) {
|
||||
setShowCurrentTaskPanelView(false)
|
||||
} else {
|
||||
getCurrentView().setData(taskInfo, getCurrentPosition())
|
||||
setShowCurrentTaskPanelView(true)
|
||||
}
|
||||
} else {//云端下发的任务信息需要弹窗接取
|
||||
setShowCurrentTaskPanelView(true)
|
||||
getCurrentView().setData(taskInfo)
|
||||
receivedTaskInfoDialog()
|
||||
}
|
||||
}
|
||||
|
||||
//模拟结束子任务
|
||||
override fun debugEndSubTask() {
|
||||
super.debugEndSubTask()
|
||||
mPresenter?.getCurrentTask()
|
||||
//sendCloudTaskInfo(SweeperCloudTask.MessageType.CloudPushTask)
|
||||
//super.debugEndSubTask()
|
||||
// TODO: 模拟云控获取任务
|
||||
//mPresenter?.getCurrentTask()
|
||||
sendCloudTaskInfo(SweeperCloudTask.MessageType.CloudPushTask)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前正在执行的子任务在列表中的位置
|
||||
*/
|
||||
private fun getCurrentPosition(): Int {
|
||||
mSubMutableList = mTaskInfo?.subListList
|
||||
mSubMutableList?.apply {
|
||||
for (index in 0 until size) {
|
||||
if (get(index).taskStatus == SweeperCommon.TaskStatus.RUNNING) {
|
||||
mSubTaskType = get(index).taskModel.number
|
||||
mPresenter?.setSubtask(get(index).subTaskId, get(index).taskModel.number, get(index).lineId)
|
||||
return index
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据子任务id获取子任务信息
|
||||
*/
|
||||
private fun bySubTaskIdFindSubTaskInfo(subTaskId: String): SubTaskInfo? {
|
||||
mSubMutableList = mTaskInfo?.subListList
|
||||
mSubMutableList?.apply {
|
||||
for (index in 0 until size) {
|
||||
if (get(index).subTaskId == subTaskId) {
|
||||
mSubTaskType = get(index).taskModel.number
|
||||
mPresenter?.setSubtask(get(index).subTaskId, get(index).taskModel.number, get(index).lineId)
|
||||
return get(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -179,11 +221,55 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
|
||||
private fun getCurrentView(): SweeperCurrentTaskInfoView = sweeper_current_task_view
|
||||
|
||||
/**
|
||||
* 云控下发子任务确认弹窗
|
||||
*/
|
||||
fun showSubTaskInfoDialog(taskId: String, subTaskId: String) {
|
||||
if (mTaskInfo == null) return
|
||||
if (mTaskInfo?.taskId != taskId) return
|
||||
val subInfo = bySubTaskIdFindSubTaskInfo(subTaskId)
|
||||
subInfo?.let {
|
||||
var builder: SweeperCloudDialog.Builder = SweeperCloudDialog.Builder()
|
||||
builder.titleStr = "任务确认"
|
||||
builder.contentStr = "请确认是否执行任务${it.subTaskName}"
|
||||
builder.tipStr = if (it.taskModel.number == 1) "[需手动驾驶至终点${it.endLocation.siteName}]" else "[自动驾驶至终点${it.endLocation.siteName}]"
|
||||
builder.leftStr = "确认"
|
||||
builder.middleStr = "下一个"
|
||||
builder.rightStr = "结束"
|
||||
builder.countDownTime = 15
|
||||
builder.listener = object : SweeperCloudDialog.SweeperCloudClickListener {
|
||||
override fun onConfirm() {
|
||||
ToastUtils.showLong("确认")
|
||||
mPresenter?.sendSweeperTaskConfirmResp(taskId, subTaskId, SweeperTaskConfirm.TaskConfirmCode.MANUAL_CONFIRM)
|
||||
}
|
||||
|
||||
override fun onRefuseOrEnd() {
|
||||
ToastUtils.showLong("结束")
|
||||
mPresenter?.sendSweeperTaskConfirmResp(taskId, subTaskId, SweeperTaskConfirm.TaskConfirmCode.MANUAL_REFUSE_ALL)
|
||||
}
|
||||
|
||||
override fun onCountDownStop() {
|
||||
ToastUtils.showLong("倒计时结束")
|
||||
mPresenter?.sendSweeperTaskConfirmResp(taskId, subTaskId, SweeperTaskConfirm.TaskConfirmCode.OVER_TIME)
|
||||
}
|
||||
|
||||
override fun onNext() {
|
||||
ToastUtils.showLong("下一个")
|
||||
mPresenter?.sendSweeperTaskConfirmResp(taskId, subTaskId, SweeperTaskConfirm.TaskConfirmCode.MANUAL_REFUSE_SINGLE)
|
||||
}
|
||||
|
||||
}
|
||||
val dialog = context?.let { it1 -> builder.build(it1) }
|
||||
dialog?.show()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接取云端任务弹窗
|
||||
*/
|
||||
private fun receivedTaskInfoDialog() {
|
||||
mTaskInfo?.apply {
|
||||
mPresenter?.sendSweeperStartTaskResp(taskId, SweeperTask.StartTaskCode.RECEIVED)
|
||||
var builder: SweeperCloudDialog.Builder = SweeperCloudDialog.Builder()
|
||||
val startCalendar = DateTimeUtil.formatLongToCalendar(taskStartTime)
|
||||
val endCalendar = DateTimeUtil.formatLongToCalendar(taskEndTime)
|
||||
@@ -202,17 +288,19 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
builder.listener = object : SweeperCloudDialog.SweeperCloudClickListener {
|
||||
override fun onConfirm() {
|
||||
ToastUtils.showLong("确认")
|
||||
setShowCurrentTaskPanelView(true)
|
||||
mPresenter?.sendSweeperStartTaskResp(taskId, SweeperTask.StartTaskCode.MANUAL_CONFIRM)
|
||||
}
|
||||
|
||||
override fun onRefuse() {
|
||||
override fun onRefuseOrEnd() {
|
||||
ToastUtils.showLong("拒绝")
|
||||
setShowCurrentTaskPanelView(false)
|
||||
mPresenter?.sendSweeperStartTaskResp(taskId, SweeperTask.StartTaskCode.MANUAL_REFUSE)
|
||||
}
|
||||
|
||||
override fun onCountDownStop() {
|
||||
ToastUtils.showLong("倒计时结束")
|
||||
setShowCurrentTaskPanelView(false)
|
||||
mPresenter?.sendSweeperStartTaskResp(taskId, SweeperTask.StartTaskCode.OVER_TIME)
|
||||
}
|
||||
|
||||
override fun onNext() {
|
||||
|
||||
@@ -21,19 +21,17 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02Lis
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerSweeperFutianCleanSystemListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerSweeperFutianCloudTaskListenerManager;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil;
|
||||
import com.mogo.och.sweepercloud.bean.SweeperRoutePlanningUpdateReqBean;
|
||||
import com.mogo.och.sweepercloud.callback.ISweeperControllerStatusCallback;
|
||||
import com.mogo.och.sweepercloud.callback.ISweeperCloudTaskCallback;
|
||||
import com.mogo.och.sweepercloud.callback.ISweeperControllerStatusCallback;
|
||||
import com.mogo.och.sweepercloud.constant.SweeperConst;
|
||||
import com.mogo.och.sweepercloud.database.MyDataBase;
|
||||
import com.mogo.och.sweepercloud.database.bean.WeltDataBean;
|
||||
import com.mogo.och.sweepercloud.util.SweeperCloudTaskMockUtils;
|
||||
import com.mogo.och.sweepercloud.util.SweeperFutianCmdUtil;
|
||||
import com.zhjt.mogo.adas.data.sweeper.SweeperCloudTask;
|
||||
import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask;
|
||||
@@ -46,6 +44,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -62,6 +61,7 @@ import planning.RoboSweeperTaskIndexOuterClass;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_SWEEPER;
|
||||
import static com.mogo.och.sweepercloud.util.SweeperCloudTaskMockUtils.printMessage;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -84,7 +84,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
//自动驾驶状态
|
||||
private int mAutopilotState = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE;
|
||||
//当前子任务id
|
||||
private int mSubTaskId = 0;
|
||||
private String mSubTaskId = "";
|
||||
// 清扫模式回调时间间隔
|
||||
private static final long VEHICLE_STATE_INTERVAL_MILLIS = 500L;
|
||||
// 清扫模式当前时间戳
|
||||
@@ -196,7 +196,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
|
||||
};
|
||||
|
||||
public void setSubtask(int subTaskId, int subTaskType, int currentLineId) {
|
||||
public void setSubtask(String subTaskId, int subTaskType, int currentLineId) {
|
||||
this.mSubTaskId = subTaskId;
|
||||
this.mSubTaskType = subTaskType;
|
||||
this.mCurrentLineId = currentLineId;
|
||||
@@ -296,8 +296,10 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianCloudTask(@NonNull SweeperCloudTask.MessageType messageType, @NonNull String reqNo, long sysTime,
|
||||
@NonNull SweeperTask.TaskInfo taskInfo) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCloudTask:" + GsonUtil.jsonFromObject(taskInfo));
|
||||
SweeperTask.TaskInfo taskInfo) {
|
||||
if (taskInfo != null) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCloudTask:" + printMessage(taskInfo));
|
||||
}
|
||||
if (mSweeperTaskCallback != null) {
|
||||
msgTypeAndReqNo.put(messageType.getNumber(), reqNo);
|
||||
mSweeperTaskCallback.onSweeperCloudTask(messageType, taskInfo);
|
||||
@@ -308,7 +310,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
public void onSweeperFutianCloudTaskConfirm(@NonNull SweeperCloudTask.MessageType messageType, @NonNull String reqNo, long sysTime,
|
||||
@NonNull SweeperTaskConfirm.TaskConfirm taskConfirm) {
|
||||
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCloudTaskConfirm:" + GsonUtil.jsonFromObject(taskConfirm));
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCloudTaskConfirm:" + printMessage(taskConfirm));
|
||||
if (mSweeperTaskCallback != null) {
|
||||
msgTypeAndReqNo.put(messageType.getNumber(), reqNo);
|
||||
mSweeperTaskCallback.onSweeperCloudTaskConfirm(taskConfirm.getTaskId(), taskConfirm.getSubTaskId());
|
||||
@@ -318,7 +320,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
@Override
|
||||
public void onSweeperFutianCloudTaskStatus(@NonNull SweeperCloudTask.MessageType messageType, @NonNull String reqNo, long sysTime,
|
||||
@NonNull SweeperTaskStatus.TaskStatusPush taskStatusPush) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCloudTaskStatus:" + GsonUtil.jsonFromObject(taskStatusPush));
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCloudTaskStatus:" + printMessage(taskStatusPush));
|
||||
if (mSweeperTaskCallback != null) {
|
||||
msgTypeAndReqNo.put(messageType.getNumber(), reqNo);
|
||||
mSweeperTaskCallback.onSweeperCloudTaskStatus(taskStatusPush.getTaskId(), taskStatusPush.getSubTaskId(), taskStatusPush.getTaskStatus());
|
||||
@@ -328,7 +330,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
@Override
|
||||
public void onSweeperFutianCloudTaskStop(@NonNull SweeperCloudTask.MessageType messageType, @NonNull String reqNo, long sysTime,
|
||||
@NonNull SweeperTaskStop.StopTaskReq stopTaskReq) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCloudTaskStop:" + GsonUtil.jsonFromObject(stopTaskReq));
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCloudTaskStop:" + printMessage(stopTaskReq));
|
||||
if (mSweeperTaskCallback != null) {
|
||||
msgTypeAndReqNo.put(messageType.getNumber(), reqNo);
|
||||
mSweeperTaskCallback.onSweeperCloudTaskStop(stopTaskReq.getTaskId(), stopTaskReq.getType());
|
||||
@@ -338,7 +340,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
@Override
|
||||
public void onSweeperFutianCloudTaskSuspendResume(@NonNull SweeperCloudTask.MessageType messageType, @NonNull String reqNo, long sysTime,
|
||||
@NonNull SweeperTaskSuspendResume.SuspendResumeTaskResp suspendResumeTaskResp) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCloudTaskSuspendResume:" + GsonUtil.jsonFromObject(suspendResumeTaskResp));
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCloudTaskSuspendResume:" + printMessage(suspendResumeTaskResp));
|
||||
if (mSweeperTaskCallback != null) {
|
||||
msgTypeAndReqNo.put(messageType.getNumber(), reqNo);
|
||||
mSweeperTaskCallback.onSweeperCloudTaskSuspendResume(messageType, suspendResumeTaskResp.getTaskId(),
|
||||
@@ -349,7 +351,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
@Override
|
||||
public void onSweeperFutianCloudBootable(@NonNull SweeperCloudTask.MessageType messageType, @NonNull String reqNo, long sysTime,
|
||||
@NonNull SweeperBootable.IsBootableResp isBootableResp) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCloudBootable:" + GsonUtil.jsonFromObject(isBootableResp));
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCloudBootable:" + printMessage(isBootableResp));
|
||||
if (mSweeperTaskCallback != null) {
|
||||
msgTypeAndReqNo.put(messageType.getNumber(), reqNo);
|
||||
mSweeperTaskCallback.onSweeperCloudBootable(isBootableResp.getTaskId(), isBootableResp.getSubTaskId(), isBootableResp.getCode());
|
||||
@@ -359,7 +361,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
@Override
|
||||
public void onSweeperFutianCloudBigTaskStatus(@NonNull SweeperCloudTask.MessageType messageType, @NonNull String reqNo, long sysTime,
|
||||
@NonNull SweeperBigTaskStatus.BigTaskStatusPush bigTaskStatusPush) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCloudBigTaskStatus:" + GsonUtil.jsonFromObject(bigTaskStatusPush));
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCloudBigTaskStatus:" + printMessage(bigTaskStatusPush));
|
||||
if (mSweeperTaskCallback != null) {
|
||||
msgTypeAndReqNo.put(messageType.getNumber(), reqNo);
|
||||
mSweeperTaskCallback.onSweeperCloudBigTaskStatus(bigTaskStatusPush.getTaskId(), bigTaskStatusPush.getTaskStatus());
|
||||
@@ -376,52 +378,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
return;
|
||||
}
|
||||
mVehicleStateCurrentTimeMillis = current;
|
||||
boolean clean_open_requirement = cleanSystemState.getSecuMotWorkSts();
|
||||
// 洗扫
|
||||
boolean clean_mode_wash_sweep = cleanSystemState.getSecuModWashSweepSts();
|
||||
// 纯洗
|
||||
boolean clean_mode_pure_wash = cleanSystemState.getSecuModWashSts();
|
||||
// 纯吸
|
||||
boolean clean_mode_pure_draw = cleanSystemState.getSecuWorkTonSts();
|
||||
// 左侧
|
||||
boolean clean_direction_left_side = cleanSystemState.getSecuWorkLeftSts();
|
||||
// 右侧
|
||||
boolean clean_direction_right_side = cleanSystemState.getSecuWorkRightSts();
|
||||
// 两侧
|
||||
boolean clean_direction_both_side = cleanSystemState.getSecuWorkOnBothsidesSts();
|
||||
// 作业强度状态
|
||||
boolean clean_intensity_standard = cleanSystemState.getSecuWorkStandSts();
|
||||
boolean clean_intensity_strong = cleanSystemState.getSecuWorkStrongSts();
|
||||
|
||||
// 纯扫 模式判断:不是另外其他3个模式,同时有清扫方向,说明开启了纯扫模式
|
||||
boolean clean_mode_pure_sweep = SweeperFutianCmdUtil.checkIfCleanModePureSweep(cleanSystemState);
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("开关:")
|
||||
.append(clean_open_requirement)
|
||||
.append("\n")
|
||||
.append("纯扫:")
|
||||
.append(clean_mode_wash_sweep)
|
||||
.append("纯洗:")
|
||||
.append(clean_mode_pure_wash)
|
||||
.append("纯吸:")
|
||||
.append(clean_mode_pure_draw)
|
||||
.append("纯扫:")
|
||||
.append("\n")
|
||||
.append(clean_mode_pure_sweep)
|
||||
.append("左侧:")
|
||||
.append(clean_direction_left_side)
|
||||
.append("右侧:")
|
||||
.append(clean_direction_right_side)
|
||||
.append("两侧:")
|
||||
.append("\n")
|
||||
.append(clean_direction_both_side)
|
||||
.append("标准:")
|
||||
.append(clean_intensity_standard)
|
||||
.append("强力:")
|
||||
.append(clean_intensity_strong);
|
||||
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCleanSystemState:" + stringBuilder);
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCleanSystemState:" + printMessage(cleanSystemState));
|
||||
if (mSweeperTaskCallback != null) {
|
||||
mSweeperTaskCallback.onSweeperFutianCleanSystemState(cleanSystemState);
|
||||
}
|
||||
@@ -437,20 +394,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
return;
|
||||
}
|
||||
mWeltDataCurrentTimeMillis = current;
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("清扫模式:")
|
||||
.append(roboSweeperTaskIndex.getCleanMode())
|
||||
.append("清扫方向:")
|
||||
.append(roboSweeperTaskIndex.getCleanDirection())
|
||||
.append("清扫强度:")
|
||||
.append(roboSweeperTaskIndex.getCleanIntensity())
|
||||
.append("贴边距离:")
|
||||
.append(roboSweeperTaskIndex.getDistToRefEdgePoint())
|
||||
.append("经度:")
|
||||
.append(roboSweeperTaskIndex.getLocLon())
|
||||
.append("纬度:")
|
||||
.append(roboSweeperTaskIndex.getLocLat());
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianTaskIndexData:" + stringBuilder);
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianTaskIndexData:" + printMessage(roboSweeperTaskIndex));
|
||||
handleWeltData(roboSweeperTaskIndex);
|
||||
|
||||
}
|
||||
@@ -510,8 +454,9 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
builder.setSn(getDriverSn());
|
||||
String reqNo = String.valueOf(System.currentTimeMillis());
|
||||
SweeperTask.GetTaskReq getTaskReq = builder.build();
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "getCurrentTask:" + GsonUtil.jsonFromObject(getTaskReq) + "reqNo:" + reqNo);
|
||||
getAutoPilotControlManager().sendSweeperGetTaskReq(reqNo, builder.build());
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "getCurrentTask:" + printMessage(getTaskReq) + " reqNo:" + reqNo);
|
||||
getAutoPilotControlManager().sendSweeperGetTaskReq(reqNo, getTaskReq);
|
||||
// TODO: 2023/5/5 模拟云控获取任务
|
||||
SweeperCloudTaskMockUtils.sendCloudTaskInfo(SweeperCloudTask.MessageType.PadSendGetTaskReq);
|
||||
}
|
||||
|
||||
@@ -524,9 +469,13 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
builder.setTaskId(taskId);
|
||||
builder.setCode(code);
|
||||
SweeperTask.StartTaskResp startTaskResp = builder.build();
|
||||
String reqNo = msgTypeAndReqNo.get(SweeperCloudTask.MessageType.CloudPushTask);
|
||||
String reqNo = msgTypeAndReqNo.get(SweeperCloudTask.MessageType.CloudPushTask.getNumber());
|
||||
getAutoPilotControlManager().sendSweeperStartTaskResp(reqNo, startTaskResp);
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "sendSweeperStartTaskResp:" + GsonUtil.jsonFromObject(startTaskResp) + "reqNo:" + reqNo);
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "sendSweeperStartTaskResp:" + printMessage(startTaskResp) + " reqNo:" + reqNo);
|
||||
// TODO: 2023/5/5 模拟 当云控收到pad接取任务成功的指令时, 云控下发子任务开始确认指令
|
||||
if (code == SweeperTask.StartTaskCode.MANUAL_CONFIRM) {
|
||||
SweeperCloudTaskMockUtils.sendCloudSubTaskConfirm();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -539,8 +488,8 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
builder.setSubTaskId(subTaskId);
|
||||
builder.setCode(code);
|
||||
SweeperTaskConfirm.TaskConfirmResp taskConfirmResp = builder.build();
|
||||
String reqNo = msgTypeAndReqNo.get(SweeperCloudTask.MessageType.CloudPushTaskConfirm);
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "sendSweeperStartTaskResp" + GsonUtil.jsonFromObject(taskConfirmResp) + "reqNo:" + reqNo);
|
||||
String reqNo = msgTypeAndReqNo.get(SweeperCloudTask.MessageType.CloudPushTaskConfirm.getNumber());
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "sendSweeperStartTaskResp" + printMessage(taskConfirmResp) + " reqNo:" + reqNo);
|
||||
getAutoPilotControlManager().sendSweeperTaskConfirmResp(reqNo, taskConfirmResp);
|
||||
}
|
||||
|
||||
@@ -556,8 +505,8 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
builder.setTaskId(taskId);
|
||||
builder.setCode(code);
|
||||
SweeperTaskStop.StopTaskResp stopTaskResp = builder.build();
|
||||
String reqNo = msgTypeAndReqNo.get(SweeperCloudTask.MessageType.CloudPushTaskStop);
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "sendSweeperStartTaskResp" + GsonUtil.jsonFromObject(stopTaskResp) + "reqNo:" + reqNo);
|
||||
String reqNo = msgTypeAndReqNo.get(SweeperCloudTask.MessageType.CloudPushTaskStop.getNumber());
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "sendSweeperStartTaskResp" + printMessage(stopTaskResp) + " reqNo:" + reqNo);
|
||||
getAutoPilotControlManager().sendSweeperStopTaskResp(reqNo, stopTaskResp);
|
||||
}
|
||||
|
||||
@@ -576,7 +525,7 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
builder.setLineId(lineId);
|
||||
SweeperBootable.IsBootable isBootable = builder.build();
|
||||
String reqNo = String.valueOf(System.currentTimeMillis());
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "sendSweeperAutopilotBootable" + GsonUtil.jsonFromObject(isBootable) + "reqNo:" + reqNo);
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "sendSweeperAutopilotBootable" + printMessage(isBootable) + " reqNo:" + reqNo);
|
||||
getAutoPilotControlManager().sendSweeperAutopilotBootable(reqNo, isBootable);
|
||||
}
|
||||
|
||||
@@ -634,4 +583,16 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
public void onAutopilotRouteLineId(long lineId) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 云控数据异常或者工控机传递数据异常
|
||||
*
|
||||
* @param bytes
|
||||
*/
|
||||
@Override
|
||||
public void onSweeperFutianCloudTaskUnknown(@NonNull byte[] bytes) {
|
||||
String string = new String(bytes, StandardCharsets.UTF_8);
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onSweeperFutianCloudTaskUnknown:" + string);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
/**
|
||||
* 设置当前子任务信息
|
||||
*/
|
||||
public void setSubtask(int subTaskId, int subTaskType, int currentLineId) {
|
||||
public void setSubtask(String subTaskId, int subTaskType, int currentLineId) {
|
||||
SweeperTaskModel.getInstance().setSubtask(subTaskId, subTaskType, currentLineId);
|
||||
}
|
||||
|
||||
@@ -167,18 +167,17 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperCloudTask(@NonNull SweeperCloudTask.MessageType messageType, @NonNull SweeperTask.TaskInfo taskInfo) {
|
||||
mView.onSweeperCloudTask(messageType,taskInfo);
|
||||
public void onSweeperCloudTask(@NonNull SweeperCloudTask.MessageType messageType,SweeperTask.TaskInfo taskInfo) {
|
||||
ThreadUtils.runOnUiThread(()-> mView.onSweeperCloudTask(messageType,taskInfo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperCloudTaskConfirm(@NonNull String taskId, @NonNull String subTaskId) {
|
||||
|
||||
ThreadUtils.runOnUiThread(()-> mView.showSubTaskInfoDialog(taskId,subTaskId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperCloudTaskStatus(@NonNull String taskId, @NonNull String subTaskId, @NonNull SweeperCommon.TaskStatus subTaskStatus) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -204,11 +203,11 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
|
||||
@Override
|
||||
public void setWeltDataToMap(@NonNull ArrayList<WeltDataBean> weltDataBeans, boolean isWeltData, @NonNull String distance) {
|
||||
mView.setWeltDataToMap(weltDataBeans, isWeltData, distance);
|
||||
ThreadUtils.runOnUiThread(()-> mView.setWeltDataToMap(weltDataBeans, isWeltData, distance));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianCleanSystemState(@NonNull ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) {
|
||||
mView.onSweeperFutianCleanSystemState(cleanSystemState);
|
||||
ThreadUtils.runOnUiThread(()-> mView.onSweeperFutianCleanSystemState(cleanSystemState));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.och.sweepercloud.ui.dialog
|
||||
import android.animation.ObjectAnimator
|
||||
import android.animation.ValueAnimator
|
||||
import android.content.Context
|
||||
import android.text.Html
|
||||
import android.view.View
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.ImageView
|
||||
@@ -29,7 +28,7 @@ class SweeperCloudDialog : BaseFloatDialog, LifecycleObserver {
|
||||
|
||||
constructor(builder: Builder, context: Context) : super(context) {
|
||||
commonTitle?.text = builder.titleStr
|
||||
commonContent?.text = Html.fromHtml(builder.contentStr)
|
||||
commonContent?.text = builder.contentStr
|
||||
if (builder.tipStr == "") {
|
||||
commonTip?.visibility = View.GONE
|
||||
} else {
|
||||
@@ -68,7 +67,7 @@ class SweeperCloudDialog : BaseFloatDialog, LifecycleObserver {
|
||||
dismiss()
|
||||
}
|
||||
commonRight?.setOnClickListener {
|
||||
builder.listener?.onRefuse()
|
||||
builder.listener?.onRefuseOrEnd()
|
||||
objectAnimator?.cancel()
|
||||
commonCountDown?.stopCountDown()
|
||||
dismiss()
|
||||
@@ -100,7 +99,7 @@ class SweeperCloudDialog : BaseFloatDialog, LifecycleObserver {
|
||||
|
||||
interface SweeperCloudClickListener {
|
||||
fun onConfirm()
|
||||
fun onRefuse()
|
||||
fun onRefuseOrEnd()
|
||||
fun onCountDownStop()
|
||||
fun onNext()
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.mogo.och.sweepercloud.util
|
||||
|
||||
import com.google.protobuf.MessageOrBuilder
|
||||
import com.google.protobuf.TextFormat
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.sweepercloud.model.SweeperTaskModel
|
||||
import com.zhjt.mogo.adas.data.sweeper.SweeperCloudTask.MessageType
|
||||
import com.zhjt.mogo.adas.data.sweeper.common.SweeperCommon
|
||||
@@ -8,6 +11,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask.Location
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask.SubTaskInfo
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask.TaskInfo
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask.TaskModel
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.confirm.SweeperTaskConfirm.TaskConfirm
|
||||
|
||||
object SweeperCloudTaskMockUtils {
|
||||
/**
|
||||
@@ -24,42 +28,42 @@ object SweeperCloudTaskMockUtils {
|
||||
builder.taskEndTime = 1682750562000
|
||||
//第一个子任务
|
||||
val subBuilder0 = SubTaskInfo.newBuilder()
|
||||
subBuilder0.subTaskId = "0"
|
||||
subBuilder0.subTaskId = "1"
|
||||
subBuilder0.subTaskName = "自动驾驶子任务0"
|
||||
subBuilder0.taskModel = TaskModel.AUTO
|
||||
subBuilder0.taskStatus = SweeperCommon.TaskStatus.TO_START
|
||||
subBuilder0.taskStatus = SweeperCommon.TaskStatus.FINISHED
|
||||
val startLocation0 = Location.newBuilder()
|
||||
startLocation0.siteName = "子任务起点0"
|
||||
startLocation0.siteName = "自动驾驶子任务起点0"
|
||||
startLocation0.wgsLongitude = 121.6421189511
|
||||
startLocation0.wgsLatitude = 37.4767125311
|
||||
startLocation0.longitude = 121.64693997741931
|
||||
startLocation0.longitude = 121.64693997741931
|
||||
startLocation0.latitude = 37.47740504453125
|
||||
subBuilder0.startLocation = startLocation0.build()
|
||||
val endLocation0 = Location.newBuilder()
|
||||
endLocation0.siteName = "子任务终点0"
|
||||
endLocation0.siteName = "自动驾驶子任务终点0"
|
||||
endLocation0.wgsLongitude = 121.6392313
|
||||
endLocation0.wgsLatitude = 37.4726471
|
||||
endLocation0.longitude = 121.64404710861349
|
||||
endLocation0.latitude = 37.47333410433059
|
||||
subBuilder0.startLocation = endLocation0.build()
|
||||
subBuilder0.endLocation = endLocation0.build()
|
||||
subBuilder0.lineId = 123
|
||||
subBuilder0.lineName = "测试路线0"
|
||||
builder.addSubList(subBuilder0.build())
|
||||
//第二个子任务
|
||||
val subBuilder1 = SubTaskInfo.newBuilder()
|
||||
subBuilder1.subTaskId = "1"
|
||||
subBuilder1.subTaskId = "2"
|
||||
subBuilder1.subTaskName = "自动驾驶子任务1"
|
||||
subBuilder1.taskModel = TaskModel.AUTO
|
||||
subBuilder1.taskStatus = SweeperCommon.TaskStatus.TO_START
|
||||
val startLocation1 = Location.newBuilder()
|
||||
startLocation1.siteName = "测试子任务站点1"
|
||||
startLocation1.siteName = "自动驾驶子任务起点1"
|
||||
startLocation1.wgsLongitude = 121.6421189511
|
||||
startLocation1.wgsLatitude = 37.47264711
|
||||
startLocation1.longitude = 121.6469395478903
|
||||
startLocation1.latitude = 37.47333856025812
|
||||
subBuilder1.startLocation=startLocation1.build()
|
||||
subBuilder1.startLocation = startLocation1.build()
|
||||
val endLocation1 = Location.newBuilder()
|
||||
endLocation1.siteName = "测试子任务站点1"
|
||||
endLocation1.siteName = "自动驾驶子任务终点1"
|
||||
endLocation1.wgsLongitude = 121.4261245286646
|
||||
endLocation1.wgsLatitude = 37.52885874483938
|
||||
endLocation1.longitude = 121.43138115208806
|
||||
@@ -68,22 +72,22 @@ object SweeperCloudTaskMockUtils {
|
||||
builder.addSubList(subBuilder1.build())
|
||||
//第三个子任务
|
||||
val subBuilder2 = SubTaskInfo.newBuilder()
|
||||
subBuilder2.subTaskId = "1"
|
||||
subBuilder2.subTaskId = "3"
|
||||
subBuilder2.subTaskName = "人工驾驶子任务路线2"
|
||||
subBuilder2.taskModel = TaskModel.MANUAL
|
||||
subBuilder2.taskStatus = SweeperCommon.TaskStatus.TO_START
|
||||
val startLocation2 = Location.newBuilder()
|
||||
startLocation2.siteName = "人工驾驶子任务站点2"
|
||||
startLocation2.siteName = "人工驾驶子任务起点2"
|
||||
startLocation2.wgsLongitude = 121.31344761929978
|
||||
startLocation2.wgsLatitude = 37.53205755535642
|
||||
startLocation2.longitude = 121.3185679517558
|
||||
startLocation2.latitude = 37.5329694887952
|
||||
subBuilder2.startLocation=startLocation2.build()
|
||||
subBuilder2.startLocation = startLocation2.build()
|
||||
val endLocation2 = Location.newBuilder()
|
||||
endLocation2.siteName = "人工驾驶子任务站点2"
|
||||
endLocation2.siteName = "人工驾驶子任务终点2"
|
||||
endLocation2.wgsLongitude = 121.4551205070834
|
||||
endLocation2.wgsLatitude =37.47936696980237
|
||||
endLocation2.longitude =121.46030960742117
|
||||
endLocation2.wgsLatitude = 37.47936696980237
|
||||
endLocation2.longitude = 121.46030960742117
|
||||
endLocation2.latitude = 37.48032689641474
|
||||
subBuilder2.endLocation = endLocation2.build()
|
||||
builder.addSubList(subBuilder2.build())
|
||||
@@ -95,7 +99,29 @@ object SweeperCloudTaskMockUtils {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟云控发送子任务开始确认信息
|
||||
*/
|
||||
@JvmStatic
|
||||
fun sendCloudSubTaskConfirm() {
|
||||
val builder = TaskConfirm.newBuilder()
|
||||
builder.sn = getDriverSn()
|
||||
builder.taskId = "10"
|
||||
builder.subTaskId = "1"
|
||||
ThreadUtils.runOnUiThreadDelayed({
|
||||
SweeperTaskModel.getInstance().onSweeperFutianCloudTaskConfirm(
|
||||
MessageType.CloudPushTaskConfirm, "${System.currentTimeMillis()}",
|
||||
System.currentTimeMillis(), builder.build()
|
||||
)
|
||||
}, 10000)
|
||||
}
|
||||
|
||||
fun getDriverSn(): String? {
|
||||
return MoGoAiCloudClientConfig.getInstance().sn
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun printMessage(message: MessageOrBuilder): String {
|
||||
return TextFormat.printer().escapingNonAscii(false).printToString(message)
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.och.sweepercloud.R
|
||||
import com.zhjt.mogo.adas.data.sweeper.common.SweeperCommon
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask.SubTaskInfo
|
||||
import kotlinx.android.synthetic.main.sweeper_subtask_view.view.*
|
||||
|
||||
@@ -28,15 +29,15 @@ class SubTaskView : ConstraintLayout {
|
||||
/**
|
||||
* 设置子任务信息
|
||||
*/
|
||||
fun setData(taskInfo: SubTaskInfo, isSelect: Boolean = false, isLastTask: Boolean = false) {
|
||||
fun setData(taskInfo: SubTaskInfo, isLastTask: Boolean = false) {
|
||||
tvSubTaskName.text = taskInfo.subTaskName
|
||||
tvSubTaskName.setTextColor(if (isSelect) Color.parseColor("#3BD2FF") else Color.parseColor("#FFFFFF"))
|
||||
tvSubTaskName.setTextColor(if (taskInfo.taskStatus==SweeperCommon.TaskStatus.RUNNING) Color.parseColor("#3BD2FF") else Color.parseColor("#FFFFFF"))
|
||||
if (taskInfo.taskModel.number == 1) {//人工驾驶子任务
|
||||
ivManualDriving.visibility = View.VISIBLE
|
||||
} else {
|
||||
ivManualDriving.visibility = View.GONE
|
||||
}
|
||||
if (isSelect) {
|
||||
if (taskInfo.taskStatus==SweeperCommon.TaskStatus.RUNNING) {
|
||||
ivSubTask.setImageResource(R.drawable.sweeper_icon_select_subtask)
|
||||
} else {
|
||||
ivSubTask.setImageResource(R.drawable.sweeper_icon_not_select_subtask)
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.sweepercloud.R
|
||||
import com.zhjt.mogo.adas.data.sweeper.common.SweeperCommon.TaskStatus
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask.SubTaskInfo
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask.TaskInfo
|
||||
import kotlinx.android.synthetic.main.sweeper_current_task_info.view.*
|
||||
@@ -18,10 +19,7 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
|
||||
private val TAG: String = "SweeperCurrentTaskInfoView"
|
||||
|
||||
//当前任务操作菜单
|
||||
private var mCurrentPosition = 0
|
||||
private var listTask: List<SubTaskInfo>? = null
|
||||
private var mSubTaskType: Int=0
|
||||
private var mSubTaskStatus: Int = 1
|
||||
|
||||
constructor(context: Context) : super(context) {}
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
|
||||
@@ -41,9 +39,8 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
|
||||
*/
|
||||
fun setData(
|
||||
subTaskBean: TaskInfo?,
|
||||
currentPosition: Int,
|
||||
currentPosition:Int=-1
|
||||
) {
|
||||
this.mCurrentPosition = currentPosition
|
||||
subTaskBean?.apply {
|
||||
this@SweeperCurrentTaskInfoView.listTask = subListList
|
||||
tvTaskName.text = taskName
|
||||
@@ -51,16 +48,22 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
|
||||
tvTaskTime.text = DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.HH_mm)
|
||||
}
|
||||
listTask?.let {
|
||||
mSubTaskStatus = it[currentPosition].taskStatus.number
|
||||
setSubTaskState(mSubTaskStatus == 1)
|
||||
//特殊处理当前暂无执行中任务的情况
|
||||
var position=currentPosition
|
||||
if (position==-1){
|
||||
position += 1
|
||||
setSubTaskState(false)
|
||||
}else{
|
||||
setSubTaskState(it[position].taskStatus==TaskStatus.RUNNING)
|
||||
}
|
||||
setCurrentData(position)
|
||||
}
|
||||
setCurrentData(currentPosition)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置子任务的状态
|
||||
*/
|
||||
fun setSubTaskState(isWorking: Boolean) {
|
||||
private fun setSubTaskState(isWorking: Boolean) {
|
||||
if (isWorking) {
|
||||
tvTaskState.text = "正在作业"
|
||||
tvTaskState.setBackgroundResource(R.drawable.bg_shape_task_state_working)
|
||||
@@ -69,23 +72,23 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
|
||||
tvTaskState.setBackgroundResource(R.drawable.bg_shape_task_state_not_ready)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充数据
|
||||
*/
|
||||
fun setCurrentData(mCurrentPosition: Int) {
|
||||
private fun setCurrentData(currentPosition:Int) {
|
||||
listTask?.let {
|
||||
mSubTaskType = it[mCurrentPosition].taskModel.number
|
||||
if (it.size == 1) {
|
||||
preSubTask.setData(it[mCurrentPosition], isSelect = true, isLastTask = true)
|
||||
preSubTask.setData(it[currentPosition], isLastTask = true)
|
||||
currentSubTask.visibility = View.INVISIBLE
|
||||
lastSubTask.visibility = View.INVISIBLE
|
||||
} else if (it.size == 2) {
|
||||
if (mCurrentPosition == 0) {
|
||||
preSubTask.setData(it[mCurrentPosition], isSelect = true)
|
||||
if (currentPosition == 0) {
|
||||
preSubTask.setData(it[currentPosition])
|
||||
currentSubTask.setData(it[1], isLastTask = true)
|
||||
} else {
|
||||
preSubTask.setData(it[mCurrentPosition - 1])
|
||||
currentSubTask.setData(it[mCurrentPosition], isSelect = true, isLastTask = true)
|
||||
preSubTask.setData(it[currentPosition - 1])
|
||||
currentSubTask.setData(it[currentPosition], isLastTask = true)
|
||||
}
|
||||
preSubTask.visibility = View.VISIBLE
|
||||
currentSubTask.visibility = View.VISIBLE
|
||||
@@ -95,19 +98,19 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
|
||||
currentSubTask.visibility = View.VISIBLE
|
||||
lastSubTask.visibility = View.VISIBLE
|
||||
//当前正在执行的任务是第一个子任务
|
||||
if (mCurrentPosition == 0) {
|
||||
preSubTask.setData(it[mCurrentPosition], isSelect = true)
|
||||
if (currentPosition == 0) {
|
||||
preSubTask.setData(it[currentPosition])
|
||||
currentSubTask.setData(it[1])
|
||||
lastSubTask.setData(it[2], isLastTask = true)
|
||||
//当前正在执行的任务是最后一个子任务
|
||||
} else if (mCurrentPosition == it.size - 1) {
|
||||
preSubTask.setData(it[mCurrentPosition - 2])
|
||||
currentSubTask.setData(it[mCurrentPosition - 1])
|
||||
lastSubTask.setData(it[mCurrentPosition], isSelect = true, isLastTask = true)
|
||||
} else if (currentPosition == it.size - 1) {
|
||||
preSubTask.setData(it[currentPosition - 2])
|
||||
currentSubTask.setData(it[currentPosition - 1])
|
||||
lastSubTask.setData(it[currentPosition], isLastTask = true)
|
||||
} else {
|
||||
preSubTask.setData(it[mCurrentPosition - 1])
|
||||
currentSubTask.setData(it[mCurrentPosition], isSelect = true)
|
||||
lastSubTask.setData(it[mCurrentPosition + 1], isLastTask = true)
|
||||
preSubTask.setData(it[currentPosition - 1])
|
||||
currentSubTask.setData(it[currentPosition])
|
||||
lastSubTask.setData(it[currentPosition + 1], isLastTask = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,39 +199,15 @@ class WeltSmallMapView : ConstraintLayout, IMoGoChassisLocationGCJ02Listener {
|
||||
return colorList
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加起点和终点的marker
|
||||
*/
|
||||
private fun addStartAndEndMarker(startPoint: LatLng, endPoint: LatLng) {
|
||||
// for (i in mLineMarkers.indices) {
|
||||
// mLineMarkers[i]?.isVisible = false
|
||||
// mLineMarkers[i]?.remove()
|
||||
// }
|
||||
// mLineMarkers.clear()
|
||||
// val startMarker = mAMap?.addMarker(MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.sweeper_small_start_marker_icon)))
|
||||
// startMarker?.position = startPoint
|
||||
// mLineMarkers.add(startMarker)
|
||||
// val endMarker = mAMap?.addMarker(MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.sweeper_small_end_marker_icon)))
|
||||
// endMarker?.position = endPoint
|
||||
// mLineMarkers.add(endMarker)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前大任务的所有子任务起终点集合
|
||||
*/
|
||||
fun setTaskListCoordinatesLatLng(coordinatesLatLng: MutableList<LatLng>) {
|
||||
this.mTaskCoordinatesLatLng = coordinatesLatLng
|
||||
// if (mTaskCoordinatesLatLng.size > 0) {
|
||||
// d(
|
||||
// SceneConstant.M_SWEEPER + TAG,
|
||||
// "startPoint:${mTaskCoordinatesLatLng[0]} endPoint:${mTaskCoordinatesLatLng[mTaskCoordinatesLatLng.size - 1]}"
|
||||
// )
|
||||
// addStartAndEndMarker(mTaskCoordinatesLatLng[0], mTaskCoordinatesLatLng[mTaskCoordinatesLatLng.size - 1])
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前大任务的所有子任务起终点集合
|
||||
* 设置当前子任务的终点
|
||||
*/
|
||||
fun setCurrentTaskCoordinatesLatLng(coordinatesLatLng: LatLng) {
|
||||
endStationMarker?.remove()
|
||||
@@ -243,28 +219,12 @@ class WeltSmallMapView : ConstraintLayout, IMoGoChassisLocationGCJ02Listener {
|
||||
* 清除所有标记和路线
|
||||
*/
|
||||
fun clearAllMarkerAndPolyline() {
|
||||
// for (i in mLineMarkers.indices) {
|
||||
// mLineMarkers[i]?.isVisible = false
|
||||
// mLineMarkers[i]?.remove()
|
||||
// }
|
||||
endStationMarker?.remove()
|
||||
mWeltPolylines?.remove()
|
||||
// mLineMarkers.clear()
|
||||
mRoutePolylines?.remove()
|
||||
//mFirst = false
|
||||
//showOrHiddenWelt(false)
|
||||
}
|
||||
|
||||
fun getSwitchToBig(): ImageView = sweeperSwitchToBig
|
||||
|
||||
/**
|
||||
* 显示或隐藏贴边
|
||||
*/
|
||||
private fun showOrHiddenWelt(isShow: Boolean) {
|
||||
taskProgressTv.visibility = if (isShow) View.VISIBLE else View.GONE
|
||||
taskWeltDistanceTv.visibility = if (isShow) View.VISIBLE else View.GONE
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置贴边数据
|
||||
*/
|
||||
@@ -273,10 +233,6 @@ class WeltSmallMapView : ConstraintLayout, IMoGoChassisLocationGCJ02Listener {
|
||||
ThreadUtils.runOnUiThread {
|
||||
setWeltDistance(distance)
|
||||
}
|
||||
//if (!mFirst&&isWeltData) {
|
||||
// showOrHiddenWelt(true)
|
||||
// mFirst = true
|
||||
//}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
android:layout_gravity="center">
|
||||
<ImageView
|
||||
android:id="@+id/sweeper_cloud_imageview"
|
||||
android:layout_width="@dimen/dp_70"
|
||||
android:layout_height="@dimen/dp_70"
|
||||
android:layout_width="@dimen/dp_75"
|
||||
android:layout_height="@dimen/dp_75"
|
||||
android:layout_marginStart="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
@@ -19,16 +19,16 @@
|
||||
/>
|
||||
<com.mogo.och.sweepercloud.view.CountDownView
|
||||
android:id="@+id/sweeper_cloud_countdown"
|
||||
android:layout_width="@dimen/dp_65"
|
||||
android:layout_height="@dimen/dp_65"
|
||||
android:layout_marginStart="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:text="15"
|
||||
android:layout_width="@dimen/dp_75"
|
||||
android:layout_height="@dimen/dp_75"
|
||||
tools:text="15"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_32"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintLeft_toLeftOf="@+id/sweeper_cloud_imageview"
|
||||
app:layout_constraintTop_toTopOf="@+id/sweeper_cloud_imageview"
|
||||
app:layout_constraintEnd_toEndOf="@+id/sweeper_cloud_imageview"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/sweeper_cloud_imageview"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sweeper_cloud_title"
|
||||
@@ -36,7 +36,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:gravity="center"
|
||||
android:text="任务领取"
|
||||
tools:text="任务领取"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_56"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -51,7 +51,7 @@
|
||||
android:layout_marginTop="@dimen/dp_49"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:gravity="center"
|
||||
android:text="请确认是否接取任务AAAAAAA"
|
||||
tools:text="请确认是否接取任务AAAAAAA"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="@dimen/dp_50"
|
||||
app:layout_constraintTop_toBottomOf="@+id/sweeper_cloud_title"
|
||||
@@ -65,7 +65,7 @@
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:gravity="center"
|
||||
android:text="(任务时间09:00-12:00)"
|
||||
tools:text="(任务时间09:00-12:00)"
|
||||
android:textColor="#A6CEFF"
|
||||
android:textSize="@dimen/dp_40"
|
||||
app:layout_constraintTop_toBottomOf="@+id/sweeper_cloud_content"
|
||||
@@ -97,7 +97,7 @@
|
||||
android:layout_weight="1"
|
||||
android:background="#3769B5"
|
||||
android:gravity="center"
|
||||
android:text="下一个"
|
||||
tools:text="下一个"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="@dimen/dp_50" />
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_shape_right_bottom_round"
|
||||
android:gravity="center"
|
||||
android:text="拒绝"
|
||||
tools:text="拒绝"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="@dimen/dp_50" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
android:id="@+id/sweeper_current_task_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible" />
|
||||
android:visibility="gone" />
|
||||
<include
|
||||
layout="@layout/sweeper_no_data_common_view"
|
||||
/>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="@drawable/bg_shape_task_panel">
|
||||
|
||||
<TextView
|
||||
@@ -15,7 +16,7 @@
|
||||
android:textSize="@dimen/dp_38"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:text="惠新西街南口地铁站公交站" />
|
||||
tools:text="惠新西街南口地铁站公交站" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTaskTime"
|
||||
@@ -33,7 +34,7 @@
|
||||
android:gravity="center"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvTaskName"
|
||||
android:text="9:00" />
|
||||
tools:text="9:00" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTaskState"
|
||||
@@ -103,7 +104,7 @@
|
||||
android:layout_height="@dimen/dp_116"
|
||||
android:background="@drawable/sweeper_upload_autopoiltstate"
|
||||
android:gravity="center"
|
||||
android:text="启动自驾"
|
||||
android:text="请求进入自动驾驶"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/module_mogo_och_sweeper_station_notice_text_size"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_shape_task_panel"
|
||||
android:visibility="gone">
|
||||
android:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivNoTaskData"
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
>
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<TextView
|
||||
android:id="@+id/tvSubTaskName"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="惠新西街南口地铁站公交站"
|
||||
tools:text="惠新西街南口地铁站公交站"
|
||||
android:textSize="@dimen/dp_38"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
Reference in New Issue
Block a user