[sweeper-cloud]pb回调部分代码修改
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
package com.mogo.och.sweepercloud.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
public class BaseResponse<T> extends BaseData {
|
||||
private T data;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.mogo.och.sweepercloud.bean
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
|
||||
data class SubStartRequest(
|
||||
var carSn:String=MoGoAiCloudClientConfig.getInstance().sn,
|
||||
var taskId:Int,
|
||||
var startTime:Long,
|
||||
var isFirst:Boolean,
|
||||
var isEnd:Boolean
|
||||
)
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.och.sweepercloud.bean
|
||||
|
||||
/**
|
||||
*
|
||||
* 清扫车任务信息
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
data class SweeperMainTaskBean(
|
||||
var mainTaskId:Int = 0,
|
||||
var mainTaskName: String? = null,
|
||||
var subTaskTotal:Int = 0,
|
||||
var mainTaskStartTime: Long = 0
|
||||
)
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.mogo.och.sweepercloud.bean
|
||||
|
||||
/**
|
||||
* 子任务信息
|
||||
*/
|
||||
data class SweeperSubTaskBean(
|
||||
var taskId: Int = 0,
|
||||
var taskName: String?,
|
||||
var taskStartTime: Long = 0,
|
||||
var sort: Int = 1,
|
||||
var subList: MutableList<SubInfo>?
|
||||
)
|
||||
|
||||
data class SubInfo(
|
||||
var taskId: Int = 0,
|
||||
var taskName: String?,
|
||||
var mileage: Int = 0,
|
||||
var taskStatus: Int,// 状态1未执行 2执行中 3结束 4跳过
|
||||
var taskType: Int,//1自动驾驶 2人工驾驶
|
||||
var timeSpent: String,
|
||||
var startSiteName: String,//起点名称
|
||||
var startWgs84Lon: Double,//起点经度
|
||||
var startWgs84Lat: Double,//起点纬度
|
||||
var endSiteName: String,//终点名称
|
||||
var endWgs84Lon: Double,//终点经度
|
||||
var endWgs84Lat: Double,//终点纬度
|
||||
var sort: Int = 0,
|
||||
)
|
||||
@@ -1,314 +0,0 @@
|
||||
package com.mogo.och.sweepercloud.bean;
|
||||
|
||||
public class SweeperSubTaskDetailBean {
|
||||
private int id; //子任务id
|
||||
private int lineId; //线路id
|
||||
private String lineName;//线路名称
|
||||
private int sort;
|
||||
private int status;
|
||||
private int startSiteId; //子任务起点id
|
||||
private String startSiteName; //子任务起点名称
|
||||
private double startSiteLon; //子任务起点高德经度
|
||||
private double startSiteLat; //子任务起点高德纬度
|
||||
private double startSiteWgs64Lon;//子任务起点高精经度
|
||||
private double startSiteWgs64Lat;//子任务起点高精纬度
|
||||
private int endSiteId;//子任务终点id
|
||||
private String endSiteName;//子任务终点名称
|
||||
private double endSiteLon; //子任务终点高德经度
|
||||
private double endSiteLat;//子任务终点高德纬度
|
||||
private double endSiteWgs64Lon;//子任务终点高精经度
|
||||
private double endSiteWgs64Lat;//子任务终点高精纬度
|
||||
private String brand; //品牌
|
||||
private String carModel; //车辆型号
|
||||
private String csvFileUrl = ""; //轨迹文件csv文件url地址
|
||||
private String csvFileMd5 = ""; //轨迹文件csv md5
|
||||
private String csvFileName = "";//轨迹文件cvs名称
|
||||
private String txtFileUrl = ""; //轨迹文件txt url地址
|
||||
private String txtFileMd5 = ""; //轨迹文件txt md5
|
||||
private String txtFileName; //轨迹文件txt名称
|
||||
private long publishTime;
|
||||
private String contrailFileType; //轨迹文件类型
|
||||
private String publishStatus;//发布状态 1发布 2未发布 3 发布中
|
||||
private String csvFileUrlDPQP = ""; //轨迹文件下载的cos url,默认“”
|
||||
private String csvFileMd5DPQP = ""; //轨迹文件md5,默认“”
|
||||
private String txtFileUrlDPQP = ""; //打点文件下载的cos url,默认“”
|
||||
private String txtFileMd5DPQP = ""; //轨迹文件md5,默认“”
|
||||
private long publishTimeDPQP; //上传轨迹完成时间戳ms:用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
|
||||
private long taskCreateTime;
|
||||
private String brandDPQP;
|
||||
private String carModelDPQP;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getLineId() {
|
||||
return lineId;
|
||||
}
|
||||
|
||||
public void setLineId(int lineId) {
|
||||
this.lineId = lineId;
|
||||
}
|
||||
|
||||
public String getLineName() {
|
||||
return lineName;
|
||||
}
|
||||
|
||||
public void setLineName(String lineName) {
|
||||
this.lineName = lineName;
|
||||
}
|
||||
|
||||
public int getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(int sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public int getStartSiteId() {
|
||||
return startSiteId;
|
||||
}
|
||||
|
||||
public void setStartSiteId(int startSiteId) {
|
||||
this.startSiteId = startSiteId;
|
||||
}
|
||||
|
||||
public String getStartSiteName() {
|
||||
return startSiteName;
|
||||
}
|
||||
|
||||
public void setStartSiteName(String startSiteName) {
|
||||
this.startSiteName = startSiteName;
|
||||
}
|
||||
|
||||
public double getStartSiteLon() {
|
||||
return startSiteLon;
|
||||
}
|
||||
|
||||
public void setStartSiteLon(double startSiteLon) {
|
||||
this.startSiteLon = startSiteLon;
|
||||
}
|
||||
|
||||
public double getStartSiteLat() {
|
||||
return startSiteLat;
|
||||
}
|
||||
|
||||
public void setStartSiteLat(double startSiteLat) {
|
||||
this.startSiteLat = startSiteLat;
|
||||
}
|
||||
|
||||
public double getStartSiteWgs64Lon() {
|
||||
return startSiteWgs64Lon;
|
||||
}
|
||||
|
||||
public void setStartSiteWgs64Lon(double startSiteWgs64Lon) {
|
||||
this.startSiteWgs64Lon = startSiteWgs64Lon;
|
||||
}
|
||||
|
||||
public double getStartSiteWgs64Lat() {
|
||||
return startSiteWgs64Lat;
|
||||
}
|
||||
|
||||
public void setStartSiteWgs64Lat(double startSiteWgs64Lat) {
|
||||
this.startSiteWgs64Lat = startSiteWgs64Lat;
|
||||
}
|
||||
|
||||
public int getEndSiteId() {
|
||||
return endSiteId;
|
||||
}
|
||||
|
||||
public void setEndSiteId(int endSiteId) {
|
||||
this.endSiteId = endSiteId;
|
||||
}
|
||||
|
||||
public String getEndSiteName() {
|
||||
return endSiteName;
|
||||
}
|
||||
|
||||
public void setEndSiteName(String endSiteName) {
|
||||
this.endSiteName = endSiteName;
|
||||
}
|
||||
|
||||
public double getEndSiteLon() {
|
||||
return endSiteLon;
|
||||
}
|
||||
|
||||
public void setEndSiteLon(double endSiteLon) {
|
||||
this.endSiteLon = endSiteLon;
|
||||
}
|
||||
|
||||
public double getEndSiteLat() {
|
||||
return endSiteLat;
|
||||
}
|
||||
|
||||
public void setEndSiteLat(double endSiteLat) {
|
||||
this.endSiteLat = endSiteLat;
|
||||
}
|
||||
|
||||
public double getEndSiteWgs64Lon() {
|
||||
return endSiteWgs64Lon;
|
||||
}
|
||||
|
||||
public void setEndSiteWgs64Lon(double endSiteWgs64Lon) {
|
||||
this.endSiteWgs64Lon = endSiteWgs64Lon;
|
||||
}
|
||||
|
||||
public double getEndSiteWgs64Lat() {
|
||||
return endSiteWgs64Lat;
|
||||
}
|
||||
|
||||
public void setEndSiteWgs64Lat(double endSiteWgs64Lat) {
|
||||
this.endSiteWgs64Lat = endSiteWgs64Lat;
|
||||
}
|
||||
|
||||
public long getTaskCreateTime() {
|
||||
return taskCreateTime;
|
||||
}
|
||||
|
||||
public void setTaskCreateTime(long taskCreateTime) {
|
||||
this.taskCreateTime = taskCreateTime;
|
||||
}
|
||||
|
||||
public String getBrand() {
|
||||
return brand;
|
||||
}
|
||||
|
||||
public void setBrand(String brand) {
|
||||
this.brand = brand;
|
||||
}
|
||||
|
||||
public String getCarModel() {
|
||||
return carModel;
|
||||
}
|
||||
|
||||
public void setCarModel(String carModel) {
|
||||
this.carModel = carModel;
|
||||
}
|
||||
|
||||
public String getCsvFileUrl() {
|
||||
return csvFileUrl;
|
||||
}
|
||||
|
||||
public void setCsvFileUrl(String csvFileUrl) {
|
||||
this.csvFileUrl = csvFileUrl;
|
||||
}
|
||||
|
||||
public String getCsvFileMd5() {
|
||||
return csvFileMd5;
|
||||
}
|
||||
|
||||
public void setCsvFileMd5(String csvFileMd5) {
|
||||
this.csvFileMd5 = csvFileMd5;
|
||||
}
|
||||
|
||||
public String getCsvFileName() {
|
||||
return csvFileName;
|
||||
}
|
||||
|
||||
public void setCsvFileName(String csvFileName) {
|
||||
this.csvFileName = csvFileName;
|
||||
}
|
||||
|
||||
public String getTxtFileUrl() {
|
||||
return txtFileUrl;
|
||||
}
|
||||
|
||||
public void setTxtFileUrl(String txtFileUrl) {
|
||||
this.txtFileUrl = txtFileUrl;
|
||||
}
|
||||
|
||||
public String getTxtFileMd5() {
|
||||
return txtFileMd5;
|
||||
}
|
||||
|
||||
public void setTxtFileMd5(String txtFileMd5) {
|
||||
this.txtFileMd5 = txtFileMd5;
|
||||
}
|
||||
|
||||
public String getTxtFileName() {
|
||||
return txtFileName;
|
||||
}
|
||||
|
||||
public void setTxtFileName(String txtFileName) {
|
||||
this.txtFileName = txtFileName;
|
||||
}
|
||||
|
||||
public long getPublishTime() {
|
||||
return publishTime;
|
||||
}
|
||||
|
||||
public void setPublishTime(long publishTime) {
|
||||
this.publishTime = publishTime;
|
||||
}
|
||||
|
||||
public String getBrandDPQP() {
|
||||
return brandDPQP;
|
||||
}
|
||||
|
||||
public void setBrandDPQP(String brandDPQP) {
|
||||
this.brandDPQP = brandDPQP;
|
||||
}
|
||||
|
||||
public String getCarModelDPQP() {
|
||||
return carModelDPQP;
|
||||
}
|
||||
|
||||
public void setCarModelDPQP(String carModelDPQP) {
|
||||
this.carModelDPQP = carModelDPQP;
|
||||
}
|
||||
|
||||
public String getCsvFileUrlDPQP() {
|
||||
return csvFileUrlDPQP;
|
||||
}
|
||||
|
||||
public void setCsvFileUrlDPQP(String csvFileUrlDPQP) {
|
||||
this.csvFileUrlDPQP = csvFileUrlDPQP;
|
||||
}
|
||||
|
||||
public String getCsvFileMd5DPQP() {
|
||||
return csvFileMd5DPQP;
|
||||
}
|
||||
|
||||
public void setCsvFileMd5DPQP(String csvFileMd5DPQP) {
|
||||
this.csvFileMd5DPQP = csvFileMd5DPQP;
|
||||
}
|
||||
|
||||
public String getTxtFileUrlDPQP() {
|
||||
return txtFileUrlDPQP;
|
||||
}
|
||||
|
||||
public void setTxtFileUrlDPQP(String txtFileUrlDPQP) {
|
||||
this.txtFileUrlDPQP = txtFileUrlDPQP;
|
||||
}
|
||||
|
||||
public String getTxtFileMd5DPQP() {
|
||||
return txtFileMd5DPQP;
|
||||
}
|
||||
|
||||
public void setTxtFileMd5DPQP(String txtFileMd5DPQP) {
|
||||
this.txtFileMd5DPQP = txtFileMd5DPQP;
|
||||
}
|
||||
|
||||
public long getPublishTimeDPQP() {
|
||||
return publishTimeDPQP;
|
||||
}
|
||||
|
||||
public void setPublishTimeDPQP(long publishTimeDPQP) {
|
||||
this.publishTimeDPQP = publishTimeDPQP;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.mogo.och.sweepercloud.callback
|
||||
|
||||
import chassis.ChassisStatesOuterClass
|
||||
import com.mogo.och.sweepercloud.bean.SweeperRoutePlanningUpdateReqBean
|
||||
import com.mogo.och.sweepercloud.database.bean.WeltDataBean
|
||||
import com.zhjt.mogo.adas.data.sweeper.SweeperCloudTask
|
||||
import com.zhjt.mogo.adas.data.sweeper.common.SweeperCommon
|
||||
import com.zhjt.mogo.adas.data.sweeper.common.SweeperCommon.Code
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.big.SweeperBigTaskStatus
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop.StopTaskType
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/22
|
||||
*/
|
||||
interface ISweeperCloudTaskCallback {
|
||||
|
||||
fun onSweeperCloudTask(messageType: SweeperCloudTask.MessageType,taskInfo: SweeperTask.TaskInfo)
|
||||
|
||||
fun onSweeperCloudTaskConfirm(taskId:String,subTaskId:String)
|
||||
|
||||
fun onSweeperCloudTaskStatus(taskId:String,subTaskId:String,subTaskStatus: SweeperCommon.TaskStatus)
|
||||
|
||||
fun onSweeperCloudTaskStop(taskId:String,stopTaskType: StopTaskType)
|
||||
|
||||
fun onSweeperCloudTaskSuspendResume(messageType: SweeperCloudTask.MessageType,taskId:String,subTaskId:String,code:Code)
|
||||
|
||||
fun onSweeperCloudBootable(taskId:String,subTaskId:String,code:Code)
|
||||
|
||||
fun onSweeperCloudBigTaskStatus(taskId:String,subTaskStatus: SweeperBigTaskStatus.BigTaskStatus)
|
||||
/**
|
||||
* 设置轨迹坐标点集合
|
||||
*/
|
||||
fun setRouteList(routeList: java.util.ArrayList<SweeperRoutePlanningUpdateReqBean.Result>)
|
||||
/**
|
||||
* 贴边数据回传
|
||||
*/
|
||||
fun setWeltDataToMap(weltDataBeans: ArrayList<WeltDataBean?>, isWeltData: Boolean, distance: String)
|
||||
|
||||
/**
|
||||
* 底盘清扫模式数据回传
|
||||
*/
|
||||
fun onSweeperFutianCleanSystemState(cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates)
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.mogo.och.sweepercloud.callback
|
||||
|
||||
import com.mogo.och.sweepercloud.bean.SweeperMainTaskBean
|
||||
import com.mogo.och.sweepercloud.bean.SweeperRoutePlanningUpdateReqBean
|
||||
import com.mogo.och.sweepercloud.bean.SweeperSubTaskBean
|
||||
import com.mogo.och.sweepercloud.bean.SweeperSubTaskDetailBean
|
||||
import com.mogo.och.sweepercloud.constant.SubTaskTypeEnum
|
||||
import com.mogo.och.sweepercloud.constant.TaskStatusEnum
|
||||
import java.util.ArrayList
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/22
|
||||
*/
|
||||
interface ISweeperTaskCallback {
|
||||
/**
|
||||
* 获取主任务列表
|
||||
*/
|
||||
fun setMainTaskList(mainTaskBeanList: MutableList<SweeperMainTaskBean>?,refresh:Boolean)
|
||||
|
||||
/**
|
||||
* 获取子任务列表
|
||||
*/
|
||||
fun setSubTaskBean(subTaskBean: SweeperSubTaskBean,isWorkingSubTask:Boolean)
|
||||
|
||||
/**
|
||||
* 更新子任务状态
|
||||
*/
|
||||
fun updateSubTaskStatus(typeEnum: TaskStatusEnum, isLastSubTask: Boolean)
|
||||
|
||||
/**
|
||||
* 主任务重置
|
||||
*/
|
||||
fun setMainTaskReset(isSuccess: Boolean)
|
||||
|
||||
/**
|
||||
* 获取子任务详情包括轨迹信息
|
||||
*/
|
||||
fun setSubTakDetail(subTaskDetailBean: SweeperSubTaskDetailBean, subTaskTypeEnum: SubTaskTypeEnum)
|
||||
|
||||
/**
|
||||
* 设置轨迹坐标点集合
|
||||
*/
|
||||
fun setRouteList(routeList: ArrayList<SweeperRoutePlanningUpdateReqBean.Result>)
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.mogo.och.sweepercloud.constant
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
enum class SubTaskTypeEnum(val code: Int) {
|
||||
AUTOPILOT_SUBTYPE(1),//自动驾驶子任务
|
||||
MANUAL_DRIVING_SUBTYPE(2),//人工驾驶
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.mogo.och.sweepercloud.constant
|
||||
|
||||
/**
|
||||
* 当前任务操作菜单
|
||||
*/
|
||||
enum class TaskStatusEnum(val code: Int) {
|
||||
JUMP_OVER_SUBTASK( 1),//跳过子任务
|
||||
END_TASK( 2),//结束主任务
|
||||
CANCEL_TASK( 3),//取消
|
||||
START_SUBTASK(4),//开始子任务
|
||||
END_SUBTASK(5),//结束子任务
|
||||
}
|
||||
@@ -5,18 +5,13 @@ import android.view.View
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import chassis.ChassisStatesOuterClass
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
|
||||
import com.mogo.och.sweepercloud.R
|
||||
import com.mogo.och.sweepercloud.bean.SubInfo
|
||||
import com.mogo.och.sweepercloud.bean.SweeperMainTaskBean
|
||||
import com.mogo.och.sweepercloud.bean.SweeperRoutePlanningUpdateReqBean
|
||||
import com.mogo.och.sweepercloud.bean.SweeperSubTaskBean
|
||||
import com.mogo.och.sweepercloud.constant.SubTaskTypeEnum
|
||||
import com.mogo.och.sweepercloud.presenter.SweeperPresenter
|
||||
import com.mogo.och.sweepercloud.ui.dialog.SweeperCloudDialog
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask.SubTaskInfo
|
||||
import kotlinx.android.synthetic.main.fragment_och_sweeper.*
|
||||
import kotlinx.android.synthetic.main.sweeper_no_data_common_view.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -31,13 +26,10 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
const val TAG = "SweeperFragment"
|
||||
}
|
||||
private var mCurrentSubPosition: Int = 0 //子任务下标
|
||||
private var mSubMutableList: MutableList<SubInfo>? = null
|
||||
private var mSubTaskBean: SweeperSubTaskBean? = null
|
||||
private var mSubTaskType: SubTaskTypeEnum = SubTaskTypeEnum.AUTOPILOT_SUBTYPE //1:自动驾驶子任务 2:人工驾驶子任务
|
||||
private var mSubMutableList: MutableList<SubTaskInfo>? = null
|
||||
private var mCleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates? = null
|
||||
private var mMainTask: SweeperMainTaskBean? = null
|
||||
private var mLocation: MogoLocation? = null
|
||||
private var mSubInfo: SubInfo? = null
|
||||
private var mSubTaskType:Int=0 //0:自动驾驶子任务 1:人工驾驶子任务
|
||||
|
||||
override fun getTagName(): String {
|
||||
return "SweepersFragment"
|
||||
@@ -144,46 +136,33 @@ class SweeperFragment : BaseSweeperTabFragment<SweeperFragment?, SweeperPresente
|
||||
}
|
||||
val dataList = ArrayList<LatLng>()
|
||||
for (index in subList.indices) {
|
||||
val startPoint = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(
|
||||
AbsMogoApplication.getApp(),
|
||||
subList[index].startWgs84Lon,
|
||||
subList[index].startWgs84Lat
|
||||
)
|
||||
val startLatLng = LatLng(startPoint.latitude, startPoint.longitude)
|
||||
val startLocation=subList[index].startLocation
|
||||
val startLatLng = LatLng(startLocation.latitude, startLocation.longitude)
|
||||
dataList.add(index, startLatLng)
|
||||
val endPoint = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(
|
||||
AbsMogoApplication.getApp(),
|
||||
subList[index].endWgs84Lon,
|
||||
subList[index].endWgs84Lat
|
||||
)
|
||||
val endLatLng = LatLng(endPoint.latitude, endPoint.longitude)
|
||||
val endLocation=subList[index].endLocation
|
||||
val endLatLng = LatLng(endLocation.latitude, endLocation.longitude)
|
||||
dataList.add(index + 1, endLatLng)
|
||||
}
|
||||
setTaskListCoordinatesLatLng(dataList)
|
||||
setEndStationMarker()
|
||||
setEndStationMarker(subList)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setEndStationMarker() {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
mSubInfo?.let {
|
||||
val endPoint = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(
|
||||
AbsMogoApplication.getApp(),
|
||||
it.endWgs84Lon,
|
||||
it.endWgs84Lat
|
||||
)
|
||||
super.mCurrentTaskEndStation = endPoint
|
||||
setCurrentTaskEndMarker(endPoint)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 设置当前子任务终点
|
||||
*/
|
||||
private fun setEndStationMarker(subList:MutableList<SubTaskInfo>) {
|
||||
val endPoint= subList[mCurrentSubPosition].endLocation
|
||||
val endLatLng = LatLng(endPoint.latitude, endPoint.longitude)
|
||||
super.mCurrentTaskEndStation = endLatLng
|
||||
setCurrentTaskEndMarker(endLatLng)
|
||||
}
|
||||
|
||||
|
||||
//模拟结束子任务
|
||||
override fun debugEndSubTask() {
|
||||
mPresenter?.onArriveTaskEnd(null)
|
||||
//super.debugEndSubTask()
|
||||
super.debugEndSubTask()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,103 +0,0 @@
|
||||
package com.mogo.och.sweepercloud.net;
|
||||
import com.mogo.och.sweepercloud.bean.BaseResponse;
|
||||
import com.mogo.och.sweepercloud.bean.SubInfo;
|
||||
import com.mogo.och.sweepercloud.bean.SubStartRequest;
|
||||
import com.mogo.och.sweepercloud.bean.SweeperSubTaskBean;
|
||||
import com.mogo.och.sweepercloud.bean.SweeperMainTaskBean;
|
||||
import com.mogo.och.sweepercloud.bean.SweeperSubTaskDetailBean;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Header;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
import retrofit2.http.QueryMap;
|
||||
|
||||
/**
|
||||
* 清扫车相关接口
|
||||
*/
|
||||
public interface ISweeperApiService {
|
||||
/**
|
||||
* 获取当前正在执行的任务
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param carSn
|
||||
* @return
|
||||
*/
|
||||
@GET("/och-sweep/api/task/v1/currentTask")
|
||||
Observable<BaseResponse<SweeperSubTaskBean>> getCurrentTask(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("carSn") String carSn);
|
||||
/**
|
||||
* 清扫车任务列表
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param carSn
|
||||
* @return
|
||||
*/
|
||||
@GET("/och-sweep/api/task/v1/mainTaskList")
|
||||
Observable<BaseResponse<List<SweeperMainTaskBean>>> getMainTaskList(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("carSn") String carSn);
|
||||
/**
|
||||
* 清扫车子任务列表
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@GET("/och-sweep/api/task/v1/subTaskList")
|
||||
Observable<BaseResponse<List<SubInfo>>> getSubTaskList(@Header ("appId") String appId, @Header("ticket") String ticket, @QueryMap Map<String, String> map);
|
||||
/**
|
||||
* 子任务详情 包括子任务轨迹信息
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@GET("/och-sweep/api/task/v1/subTaskInfo")
|
||||
Observable<BaseResponse<SweeperSubTaskDetailBean>> getSubTaskDetail(@Header ("appId") String appId, @Header("ticket") String ticket, @QueryMap Map<String, String> map);
|
||||
|
||||
/**
|
||||
* 子任务开始
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param subStartRequest
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
@POST("/och-sweep/api/task/v1/subTaskStart")
|
||||
Observable<BaseResponse<Boolean>> subTaskStart(@Header ("appId") String appId, @Header("ticket") String ticket, @Body SubStartRequest subStartRequest);
|
||||
|
||||
/**
|
||||
* 子任务结束
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param subStartRequest
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
@POST("/och-sweep/api/task/v1/subTaskEnd")
|
||||
Observable<BaseResponse<Boolean>> subTaskEnd(@Header ("appId") String appId, @Header("ticket") String ticket, @Body SubStartRequest subStartRequest);
|
||||
/**
|
||||
* 子任务跳过
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param subStartRequest
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
@POST("/och-sweep/api/task/v1/subTaskSkip")
|
||||
Observable<BaseResponse<Boolean>> subTaskSkip(@Header ("appId") String appId, @Header("ticket") String ticket, @Body SubStartRequest subStartRequest);
|
||||
|
||||
/**
|
||||
* 主任务重置
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @return
|
||||
*/
|
||||
@GET("/och-sweep/api/task/v1/mainTaskReset")
|
||||
Observable<BaseResponse<Boolean>> mainTaskReset(@Header ("appId") String appId, @Header("ticket") String ticket,@QueryMap Map<String, String> map);
|
||||
}
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
package com.mogo.och.sweepercloud.net
|
||||
|
||||
import android.content.Context
|
||||
import com.elegant.network.utils.GsonUtil
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.biz.network.OchCommonSubscribeImpl
|
||||
import com.mogo.och.common.module.biz.network.interceptor.transformTry
|
||||
import com.mogo.och.sweepercloud.bean.*
|
||||
import com.mogo.och.sweepercloud.model.SweeperTaskModel
|
||||
|
||||
object SweeperServiceManager {
|
||||
private val TAG = SweeperTaskModel::class.java.simpleName
|
||||
private val mService: ISweeperApiService = MoGoRetrofitFactory.getInstance(OchCommonConst.getSweeperUrl()).create(
|
||||
ISweeperApiService::class.java
|
||||
)
|
||||
|
||||
/**
|
||||
* 获取当前正在执行的任务
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getCurrentTask(context: Context, callback: OchCommonServiceCallback<BaseResponse<SweeperSubTaskBean>>?) {
|
||||
val map = hashMapOf<String, String>()
|
||||
map["serviceAppId"] = getServiceAppId()
|
||||
map["token"] = getToken()
|
||||
map["sn"] = getCarSN()
|
||||
d(SceneConstant.M_SWEEPER + TAG, "getCurrentTask:" + GsonUtil.jsonFromObject(map))
|
||||
mService.getCurrentTask(
|
||||
getServiceAppId(),
|
||||
getToken(),
|
||||
getCarSN()
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "getCurrentTask"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主任务列表
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getMainTaskList(context: Context, callback: OchCommonServiceCallback<BaseResponse<MutableList<SweeperMainTaskBean>>>?) {
|
||||
val map = hashMapOf<String, String>()
|
||||
map["serviceAppId"] = getServiceAppId()
|
||||
map["token"] = getToken()
|
||||
map["sn"] = getCarSN()
|
||||
d(SceneConstant.M_SWEEPER + TAG, "getMainTaskList:" + GsonUtil.jsonFromObject(map))
|
||||
mService.getMainTaskList(
|
||||
getServiceAppId(),
|
||||
getToken(),
|
||||
getCarSN()
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "getMainTaskList"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子任务列表
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getSubTaskList(taskId: Int, context: Context, callback: OchCommonServiceCallback<BaseResponse<MutableList<SubInfo>>>?) {
|
||||
val map = hashMapOf<String, String>()
|
||||
map["carSn"] = getCarSN()
|
||||
map["taskId"] = taskId.toString()
|
||||
d(SceneConstant.M_SWEEPER + TAG, "getSubTaskList:" + GsonUtil.jsonFromObject(map))
|
||||
mService.getSubTaskList(
|
||||
getServiceAppId(),
|
||||
getToken(),
|
||||
map
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "getSubTaskList"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子任务详情包括轨迹文件信息
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getSubTaskDetail(subTaskId: Int, context: Context, callback: OchCommonServiceCallback<BaseResponse<SweeperSubTaskDetailBean>>?) {
|
||||
val map = hashMapOf<String, String>()
|
||||
map["carSn"] = getCarSN()
|
||||
map["taskId"] = subTaskId.toString()
|
||||
d(SceneConstant.M_SWEEPER + TAG, "getSubTaskDetail:" + GsonUtil.jsonFromObject(map))
|
||||
mService.getSubTaskDetail(
|
||||
getServiceAppId(),
|
||||
getToken(),
|
||||
map
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "getSubTaskList"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 子任务开始上报
|
||||
*/
|
||||
@JvmStatic
|
||||
fun subTaskStart(isFirst: Boolean, isEnd: Boolean, subTaskId: Int, context: Context, callback: OchCommonServiceCallback<BaseResponse<Boolean>>?) {
|
||||
val subStartRequest = SubStartRequest(getCarSN(), subTaskId, System.currentTimeMillis(), isFirst, isEnd)
|
||||
d(SceneConstant.M_SWEEPER + TAG, "subTaskStart:" + GsonUtil.jsonFromObject(subStartRequest))
|
||||
mService.subTaskStart(
|
||||
getServiceAppId(),
|
||||
getToken(),
|
||||
subStartRequest
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "subTaskStart"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 子任务结束上报
|
||||
*/
|
||||
@JvmStatic
|
||||
fun subTaskEnd(isFirst: Boolean, isEnd: Boolean, subTaskId: Int, context: Context, callback: OchCommonServiceCallback<BaseResponse<Boolean>>?) {
|
||||
val subStartRequest = SubStartRequest(getCarSN(), subTaskId, System.currentTimeMillis(), isFirst, isEnd)
|
||||
d(SceneConstant.M_SWEEPER + TAG, "subTaskEnd:" + GsonUtil.jsonFromObject(subStartRequest))
|
||||
mService.subTaskEnd(
|
||||
getServiceAppId(),
|
||||
getToken(),
|
||||
subStartRequest
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "subTaskEnd"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 子任务跳过上报
|
||||
*/
|
||||
@JvmStatic
|
||||
fun subTaskSkip(isFirst: Boolean, isEnd: Boolean, subTaskId: Int, context: Context, callback: OchCommonServiceCallback<BaseResponse<Boolean>>?) {
|
||||
val subStartRequest = SubStartRequest(getCarSN(), subTaskId, System.currentTimeMillis(), isFirst, isEnd)
|
||||
d(SceneConstant.M_SWEEPER + TAG, "subTaskSkip:" + GsonUtil.jsonFromObject(subStartRequest))
|
||||
mService.subTaskSkip(
|
||||
getServiceAppId(),
|
||||
getToken(),
|
||||
subStartRequest
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "subTaskSkip"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 主任务重置
|
||||
*/
|
||||
@JvmStatic
|
||||
fun mainTaskReset(taskId: Int, context: Context, callback: OchCommonServiceCallback<BaseResponse<Boolean>>?) {
|
||||
val map = hashMapOf<String, String>()
|
||||
map["carSn"] = getCarSN()
|
||||
map["taskId"] = taskId.toString()
|
||||
d(SceneConstant.M_SWEEPER + TAG, "mainTaskReset:" + GsonUtil.jsonFromObject(map))
|
||||
mService.mainTaskReset(
|
||||
getServiceAppId(),
|
||||
getToken(),
|
||||
map
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "mainTaskReset"))
|
||||
}
|
||||
|
||||
private fun getCarSN(): String {
|
||||
return MoGoAiCloudClientConfig.getInstance().sn
|
||||
}
|
||||
|
||||
private fun getServiceAppId(): String {
|
||||
return MoGoAiCloudClientConfig.getInstance().serviceAppId
|
||||
}
|
||||
|
||||
private fun getToken(): String {
|
||||
return MoGoAiCloudClientConfig.getInstance().token
|
||||
}
|
||||
}
|
||||
@@ -1,58 +1,32 @@
|
||||
package com.mogo.och.sweepercloud.presenter;
|
||||
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_SWEEPER;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
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.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianCleanSystemListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerSweeperFutianCleanSystemListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
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.SweeperMainTaskBean;
|
||||
import com.mogo.och.sweepercloud.bean.SweeperRoutePlanningUpdateReqBean;
|
||||
import com.mogo.och.sweepercloud.bean.SweeperSubTaskBean;
|
||||
import com.mogo.och.sweepercloud.bean.SweeperSubTaskDetailBean;
|
||||
import com.mogo.och.sweepercloud.callback.ISweeperADASStatusCallback;
|
||||
import com.mogo.och.sweepercloud.callback.ISweeperControllerStatusCallback;
|
||||
import com.mogo.och.sweepercloud.callback.ISweeperTaskCallback;
|
||||
import com.mogo.och.sweepercloud.callback.ISweeperCloudTaskCallback;
|
||||
import com.mogo.och.sweepercloud.callback.ISweeperTaskRouteCallback;
|
||||
import com.mogo.och.sweepercloud.constant.SubTaskTypeEnum;
|
||||
import com.mogo.och.sweepercloud.constant.SweeperConst;
|
||||
import com.mogo.och.sweepercloud.constant.TaskStatusEnum;
|
||||
import com.mogo.och.sweepercloud.database.MyDataBase;
|
||||
import com.mogo.och.sweepercloud.database.bean.WeltDataBean;
|
||||
import com.mogo.och.sweepercloud.fragment.SweeperFragment;
|
||||
import com.mogo.och.sweepercloud.model.SweeperTaskModel;
|
||||
import com.mogo.och.sweepercloud.util.SweeperFutianCmdUtil;
|
||||
import com.mogo.och.sweepercloud.util.SweeperTrajectoryManager;
|
||||
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.big.SweeperBigTaskStatus;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import chassis.ChassisStatesOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import planning.RoboSweeperTaskIndexOuterClass;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
* 网约车小巴
|
||||
@@ -60,31 +34,13 @@ import system_master.SystemStatusInfo;
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
implements IMoGoAutopilotStatusListener, ISweeperControllerStatusCallback, ISweeperADASStatusCallback,
|
||||
IMoGoSweeperFutianCleanSystemListener, ISweeperTaskCallback, ISweeperTaskRouteCallback {
|
||||
implements ISweeperControllerStatusCallback,
|
||||
ISweeperCloudTaskCallback, ISweeperTaskRouteCallback {
|
||||
|
||||
private static final String TAG = "SweeperPresenter";
|
||||
//当前子任务id
|
||||
private int mSubTaskId = 0;
|
||||
// 清扫模式回调时间间隔
|
||||
private static final long VEHICLE_STATE_INTERVAL_MILLIS = 500L;
|
||||
// 清扫模式当前时间戳
|
||||
private long mVehicleStateCurrentTimeMillis;
|
||||
|
||||
// 贴边数据回调时间间隔
|
||||
private static final long WELT_DATA_INTERVAL_MILLIS = 1000L;
|
||||
// 贴边数据当前时间戳
|
||||
private long mWeltDataCurrentTimeMillis;
|
||||
|
||||
private String longitude;//经度
|
||||
private String latitude;//纬度
|
||||
|
||||
public SweeperPresenter(SweeperFragment view) {
|
||||
super(view);
|
||||
//2021.11.1 鹰眼架构整合,由IMoGoAutopilotStatusListener逐步替代IMogoAdasOCHCallback接口
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
//清扫车模式和贴边数据回调监听
|
||||
CallerSweeperFutianCleanSystemListenerManager.INSTANCE.addListener(TAG, this);
|
||||
SweeperTaskModel.getInstance().init();
|
||||
OCHAdasAbilityManager.getInstance().init(AbsMogoApplication.getApp());
|
||||
}
|
||||
@@ -104,69 +60,15 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
|
||||
public void initModelListener() {
|
||||
SweeperTaskModel.getInstance().setControllerStatusCallback(this);
|
||||
SweeperTaskModel.getInstance().setAdasStatusCallback(this);
|
||||
SweeperTaskModel.getInstance().setSweeperTaskCallback(this);
|
||||
}
|
||||
|
||||
public void releaseListener() {
|
||||
SweeperTaskModel.getInstance().setControllerStatusCallback(null);
|
||||
SweeperTaskModel.getInstance().setAdasStatusCallback(null);
|
||||
SweeperTaskModel.getInstance().setSweeperTaskCallback(null);
|
||||
CallerSweeperFutianCleanSystemListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRouteLineId(long lineId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
|
||||
if (autopilotStatusInfo == null) return;
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onAutopilotStatusResponse state:" + autopilotStatusInfo.getState());
|
||||
SweeperTaskModel.getInstance().setAutopilotState(autopilotStatusInfo.getState());
|
||||
switch (autopilotStatusInfo.getState()) {
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE://不可自动驾驶
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE://人工驾驶
|
||||
if (SweeperTaskModel.getInstance().getSubWorking()) {
|
||||
if (FunctionBuildConfig.isDemoMode) {//美化模式开启时
|
||||
SweeperTaskModel.getInstance().startBeautificationMode();
|
||||
}
|
||||
} else {
|
||||
if (FunctionBuildConfig.isDemoMode) {//美化模式开启时
|
||||
//关闭美化模式
|
||||
SweeperTaskModel.getInstance().closeBeautificationMode();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING://自动驾驶中
|
||||
SweeperTaskModel.getInstance().triggerStartServiceEvent(
|
||||
SweeperTaskModel.getInstance().isRestartAutopilot(), true);
|
||||
if (SweeperTaskModel.getInstance().getSubWorking()) {
|
||||
if (FunctionBuildConfig.isDemoMode) {//美化模式开启时
|
||||
SweeperTaskModel.getInstance().startBeautificationMode();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING://平行驾驶
|
||||
if (SweeperTaskModel.getInstance().getSubWorking()) {
|
||||
if (FunctionBuildConfig.isDemoMode) {//美化模式开启时
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true;//是否强制绘制引导线
|
||||
CallerAutoPilotControlManager.INSTANCE.setIPCDemoMode(false);//是否自动启动自驾
|
||||
}
|
||||
} else {
|
||||
if (FunctionBuildConfig.isDemoMode) {//美化模式开启时
|
||||
//关闭美化模式
|
||||
SweeperTaskModel.getInstance().closeBeautificationMode();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVRModeChanged(boolean isVRMode) {
|
||||
ThreadUtils.runOnUiThread(() -> mView.onVRModeChanged(isVRMode));
|
||||
@@ -184,26 +86,21 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
public void startOpenAutopilot() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除路线缓存数据
|
||||
*/
|
||||
public void clearRouteList(){
|
||||
public void clearRouteList() {
|
||||
SweeperTaskModel.getInstance().clearRouteList();
|
||||
}
|
||||
public void startAutopilot() {
|
||||
SweeperTaskModel.getInstance().startAutopilot();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前子任务信息
|
||||
*/
|
||||
public void setSubtask(boolean isFirstSubtask, boolean isLastSubtask, int subTaskId,int subTaskType) {
|
||||
this.mSubTaskId = subTaskId;
|
||||
SweeperTaskModel.getInstance().setSubtask(isFirstSubtask, isLastSubtask, subTaskId,subTaskType);
|
||||
}
|
||||
public void setWorking(boolean isWorking){
|
||||
SweeperTaskModel.getInstance().setWorking(isWorking);
|
||||
public void setSubtask(int subTaskId, int subTaskType, int currentLineId) {
|
||||
SweeperTaskModel.getInstance().setSubtask(subTaskId, subTaskType, currentLineId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试使用
|
||||
*
|
||||
@@ -212,165 +109,7 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
public void debugAutoPilotStatus(int status) {
|
||||
AutopilotStatusInfo info = new AutopilotStatusInfo();
|
||||
info.setState(status);
|
||||
onAutopilotStatusResponse(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
SweeperTrajectoryManager.getInstance().onAutopilotGuardian(guardianInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(@Nullable MessagePad.ArrivalNotification arrivalNotification) {
|
||||
SweeperTaskModel.getInstance().onArriveTaskEnd(arrivalNotification);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartAdasFailure() {
|
||||
|
||||
}
|
||||
|
||||
public void onArriveTaskEnd(@Nullable MessagePad.ArrivalNotification arrivalNotification) {
|
||||
SweeperTaskModel.getInstance().onArriveTaskEnd(arrivalNotification);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianCleanSystemState(@NonNull ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) {
|
||||
if (cleanSystemState == null) {
|
||||
return;
|
||||
}
|
||||
long current = System.currentTimeMillis();
|
||||
if (current - mVehicleStateCurrentTimeMillis <= VEHICLE_STATE_INTERVAL_MILLIS) {
|
||||
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);
|
||||
mView.onSweeperFutianCleanSystemState(cleanSystemState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianTaskIndexData(@NonNull RoboSweeperTaskIndexOuterClass.RoboSweeperTaskIndex roboSweeperTaskIndex) {
|
||||
if (roboSweeperTaskIndex == null) {
|
||||
return;
|
||||
}
|
||||
long current = System.currentTimeMillis();
|
||||
if (current - mWeltDataCurrentTimeMillis <= WELT_DATA_INTERVAL_MILLIS) {
|
||||
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);
|
||||
String tempLongitude=NumberFormatUtil.cutOutNumber(roboSweeperTaskIndex.getLocLon(), 6);
|
||||
String tempLatitude=NumberFormatUtil.cutOutNumber(roboSweeperTaskIndex.getLocLat(), 6);
|
||||
//用于过滤车是否停在原地,经纬度相同的情况
|
||||
if (!tempLongitude.equals(longitude)&&!tempLatitude.equals(latitude)){
|
||||
latitude = NumberFormatUtil.cutOutNumber(roboSweeperTaskIndex.getLocLat(), 6);
|
||||
longitude = NumberFormatUtil.cutOutNumber(roboSweeperTaskIndex.getLocLon(), 6);
|
||||
//保存贴边数据到数据库中
|
||||
WeltDataBean weltDataBean = new WeltDataBean();
|
||||
//把wgs坐标系坐标转换成gcj坐标
|
||||
LatLng latLng = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(AbsMogoApplication.getApp(), roboSweeperTaskIndex.getLocLon(),
|
||||
roboSweeperTaskIndex.getLocLat());
|
||||
weltDataBean.setLocLon(latLng.longitude);
|
||||
weltDataBean.setLocLat(latLng.latitude);
|
||||
int edgeCleanState = roboSweeperTaskIndex.getEdgeCleanState();
|
||||
if(edgeCleanState==0){
|
||||
weltDataBean.setWeltDistance(SweeperConst.NONWELT);
|
||||
}else {
|
||||
weltDataBean.setWeltDistance(roboSweeperTaskIndex.getDistToRefEdgePoint());
|
||||
}
|
||||
weltDataBean.setCleanMode(roboSweeperTaskIndex.getCleanMode());
|
||||
weltDataBean.setCleanDirection(roboSweeperTaskIndex.getCleanDirection());
|
||||
weltDataBean.setCleanIntensity(roboSweeperTaskIndex.getCleanIntensity());
|
||||
weltDataBean.setSubTaskId(mSubTaskId);
|
||||
MyDataBase.getInstance().getWeltDataDao().insert(weltDataBean);
|
||||
String distance;
|
||||
if (roboSweeperTaskIndex.getDistToRefEdgePoint() >= 1.0) {//大于等于1m
|
||||
distance = format(roboSweeperTaskIndex.getDistToRefEdgePoint()) + "m";
|
||||
} else {//小于1m
|
||||
distance = Math.round(roboSweeperTaskIndex.getDistToRefEdgePoint() * 100) + "cm";//m->cm 四舍五入到整数
|
||||
}
|
||||
mView.setWeltDataToMap((ArrayList<WeltDataBean>) MyDataBase.getInstance().getWeltDataDao().loadAllWeltDataInfo(), true, distance);
|
||||
}
|
||||
}
|
||||
|
||||
public static String format(double value) {
|
||||
BigDecimal bd = new BigDecimal(value);
|
||||
bd = bd.setScale(2, RoundingMode.HALF_UP);
|
||||
return bd.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前正在执行的任务
|
||||
*/
|
||||
@@ -378,32 +117,54 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
SweeperTaskModel.getInstance().getCurrentTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMainTaskList(List<SweeperMainTaskBean> mainTaskBeanList, boolean refresh) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSubTaskBean(SweeperSubTaskBean subTaskBean, boolean isWorkingSubTask) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSubTaskStatus(TaskStatusEnum typeEnum, boolean isLastSubTask) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMainTaskReset(boolean isSuccess) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSubTakDetail(@NonNull SweeperSubTaskDetailBean subTaskDetailBean, SubTaskTypeEnum subTaskTypeEnum) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRouteList(@NonNull ArrayList<SweeperRoutePlanningUpdateReqBean.Result> routeList) {
|
||||
mView.setTaskRouteList(routeList);
|
||||
mView.setTaskRouteList(routeList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperCloudTask(@NonNull SweeperCloudTask.MessageType messageType, @NonNull SweeperTask.TaskInfo taskInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperCloudTaskConfirm(@NonNull String taskId, @NonNull String subTaskId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperCloudTaskStatus(@NonNull String taskId, @NonNull String subTaskId, @NonNull SweeperCommon.TaskStatus subTaskStatus) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperCloudTaskStop(@NonNull String taskId, @NonNull SweeperTaskStop.StopTaskType stopTaskType) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperCloudTaskSuspendResume(@NonNull SweeperCloudTask.MessageType messageType, @NonNull String taskId,
|
||||
@NonNull String subTaskId, @NonNull SweeperCommon.Code code) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperCloudBootable(@NonNull String taskId, @NonNull String subTaskId, @NonNull SweeperCommon.Code code) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperCloudBigTaskStatus(@NonNull String taskId, @NonNull SweeperBigTaskStatus.BigTaskStatus subTaskStatus) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWeltDataToMap(@NonNull ArrayList<WeltDataBean> weltDataBeans, boolean isWeltData, @NonNull String distance) {
|
||||
mView.setWeltDataToMap(weltDataBeans,isWeltData,distance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianCleanSystemState(@NonNull ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) {
|
||||
mView.onSweeperFutianCleanSystemState(cleanSystemState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
package com.mogo.och.sweepercloud.ui.adapter
|
||||
|
||||
import android.graphics.Color
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.sweepercloud.R
|
||||
import com.mogo.och.sweepercloud.bean.SweeperMainTaskBean
|
||||
|
||||
class TaskListAdapter() : RecyclerView.Adapter<TaskListAdapter.TaskViewHolder>() {
|
||||
private var mItemClickListener: TaskItemClickListener? = null
|
||||
private var mSelectPosition: Int = -1
|
||||
private var data:MutableList<SweeperMainTaskBean>?=null
|
||||
fun setOnTaskItemClickListener(itemClickListener: TaskItemClickListener?) {
|
||||
mItemClickListener = itemClickListener
|
||||
}
|
||||
|
||||
class TaskViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
val selectIv: ImageView
|
||||
val taskName: TextView//任务名称
|
||||
val taskDesc: TextView//任务描述
|
||||
val tvTaskTime: TextView//任务时间
|
||||
|
||||
init {
|
||||
selectIv = itemView.findViewById(R.id.ivTaskSelect)
|
||||
taskName = itemView.findViewById(R.id.tvTaskName)
|
||||
taskDesc = itemView.findViewById(R.id.tvTaskDesc)
|
||||
tvTaskTime = itemView.findViewById(R.id.tvTaskTime)
|
||||
}
|
||||
}
|
||||
|
||||
fun selectPosition(position: Int) {
|
||||
this.mSelectPosition = position
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
fun setTaskListData(data: MutableList<SweeperMainTaskBean>?){
|
||||
this.data=data
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
interface TaskItemClickListener {
|
||||
fun onItemClick(position: Int,mainTask:SweeperMainTaskBean)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TaskViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(
|
||||
R.layout.sweeper_item_task_info, parent, false
|
||||
)
|
||||
return TaskViewHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: TaskViewHolder, position: Int) {
|
||||
data?.let { mainTask->
|
||||
holder.taskName.text= mainTask[position].mainTaskName
|
||||
holder.taskDesc.text= "全程包含${mainTask[position].subTaskTotal}个子任务"
|
||||
val calendar = DateTimeUtil.formatLongToCalendar(mainTask[position].mainTaskStartTime)
|
||||
if (DateTimeUtil.compareDateIsCurrentDay(calendar)){
|
||||
holder.tvTaskTime.text="今天${DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.HH_mm)}"
|
||||
}else{
|
||||
holder.tvTaskTime.text=DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.MM_dd_HH_mm)
|
||||
}
|
||||
holder.itemView.setOnClickListener {
|
||||
mItemClickListener?.onItemClick(position,mainTask[position])
|
||||
}
|
||||
}
|
||||
if (position == mSelectPosition) {
|
||||
holder.selectIv.visibility = View.VISIBLE
|
||||
holder.itemView.setBackgroundColor(Color.parseColor("#FF122B4E"))
|
||||
} else {
|
||||
holder.selectIv.visibility = View.GONE
|
||||
holder.itemView.setBackgroundColor(Color.parseColor("#00000000"))
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = data?.size ?: 0
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package com.mogo.och.sweepercloud.ui.popwindow
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup.LayoutParams
|
||||
import android.widget.PopupWindow
|
||||
import android.widget.TextView
|
||||
import com.mogo.och.sweepercloud.R
|
||||
import com.mogo.och.sweepercloud.constant.TaskStatusEnum
|
||||
|
||||
/**
|
||||
* 当前任务操作菜单栏
|
||||
*/
|
||||
class MenuPopWindow : PopupWindow, View.OnClickListener{
|
||||
|
||||
private var mTvJumpOverTask: TextView? = null
|
||||
|
||||
private var mTaskJumpLineView: View? = null
|
||||
|
||||
private var mTvEndTask: TextView? = null
|
||||
|
||||
private var mTvCancelTask: TextView? = null
|
||||
|
||||
private var mMenuItemClickListener:OnMenuItemOnClickListener?=null
|
||||
|
||||
constructor(context: Context,menuItemClickListener:OnMenuItemOnClickListener) : super(context) {
|
||||
init(context)
|
||||
this.mMenuItemClickListener=menuItemClickListener
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化布局
|
||||
*/
|
||||
private fun init(context: Context) {
|
||||
setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||
var view: View = LayoutInflater.from(context).inflate(R.layout.sweeper_task_menu, null)
|
||||
mTvJumpOverTask = view.findViewById(R.id.tvJumpOverTask)
|
||||
mTaskJumpLineView = view.findViewById(R.id.taskJumpLineView)
|
||||
mTvEndTask = view.findViewById(R.id.tvEndTask)
|
||||
mTvCancelTask = view.findViewById(R.id.tvCancelTask)
|
||||
mTvJumpOverTask?.setOnClickListener(this)
|
||||
mTvEndTask?.setOnClickListener(this)
|
||||
mTvCancelTask?.setOnClickListener(this)
|
||||
width = context.resources.getDimension(R.dimen.dp_174).toInt()
|
||||
height = LayoutParams.WRAP_CONTENT
|
||||
contentView = view
|
||||
isFocusable = true
|
||||
isOutsideTouchable = true
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否是手动任务
|
||||
* 1:云端自动驾驶任务
|
||||
* 2:云端手动驾驶任务
|
||||
* 3: 运营任务
|
||||
*/
|
||||
fun setMenuView(type: Int) {
|
||||
if (type == 1) {
|
||||
mTvJumpOverTask?.visibility = View.GONE
|
||||
mTaskJumpLineView?.visibility = View.GONE
|
||||
} else {
|
||||
mTvJumpOverTask?.visibility = View.VISIBLE
|
||||
mTaskJumpLineView?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
interface OnMenuItemOnClickListener {
|
||||
fun onMenuItemClick(itemType: TaskStatusEnum)
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when(v.id){
|
||||
R.id.tvJumpOverTask->{
|
||||
mMenuItemClickListener?.onMenuItemClick(TaskStatusEnum.JUMP_OVER_SUBTASK)
|
||||
dismiss()
|
||||
}
|
||||
R.id.tvEndTask->{
|
||||
mMenuItemClickListener?.onMenuItemClick(TaskStatusEnum.END_TASK)
|
||||
dismiss()
|
||||
}
|
||||
R.id.tvCancelTask->{
|
||||
mMenuItemClickListener?.onMenuItemClick(TaskStatusEnum.CANCEL_TASK)
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
package com.mogo.och.sweepercloud.util;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils;
|
||||
import com.mogo.och.sweepercloud.bean.SweeperSubTaskDetailBean;
|
||||
import com.mogo.och.sweepercloud.constant.SweeperConst;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_SWEEPER;
|
||||
|
||||
/**
|
||||
* Bus轨迹管理:给MEC下发用于轨迹下载的信息
|
||||
* Created on 2022/6/23
|
||||
*/
|
||||
public class SweeperTrajectoryManager {
|
||||
private static final String TAG = SweeperTrajectoryManager.class.getSimpleName();
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final SweeperTrajectoryManager INSTANCE = new SweeperTrajectoryManager();
|
||||
}
|
||||
|
||||
public static SweeperTrajectoryManager getInstance() {
|
||||
return SweeperTrajectoryManager.SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private AutopilotControlParameters.AutoPilotLine mAutoPilotLine = null;
|
||||
private Disposable mSendReqDisposable = null;
|
||||
|
||||
public SweeperTrajectoryManager() {
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(-1,
|
||||
"", "", "", "", 0, "",
|
||||
"", "", "", "", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步Bus路线信息
|
||||
*/
|
||||
public void syncTrajectoryInfo(SweeperSubTaskDetailBean sweeperSubTaskDetailBean) {
|
||||
if (sweeperSubTaskDetailBean != null) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "syncTrajectoryInfo() start.");
|
||||
startTrajReqLoop(sweeperSubTaskDetailBean);
|
||||
} else {
|
||||
// 无路线信息or当前未在始发站
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "syncTrajectoryInfo() stop.");
|
||||
stopTrajReqLoop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口MEC反馈的常规信息(MAP v2.5.0新增轨迹相关信息)
|
||||
*
|
||||
* @param guardianInfo
|
||||
*/
|
||||
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
if (guardianInfo == null || !guardianInfo.hasCode()) return;
|
||||
if ("ISYS_INIT_TRAJECTORY_START".equals(guardianInfo.getCode())) {
|
||||
// 1. 轨迹管理_轨迹开始下载(本地已有对应轨迹也触发)
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onAutopilotGuardian() 轨迹开始下载");
|
||||
// ToastUtils.showShort("轨迹开始下载");
|
||||
stopTrajReqLoop();
|
||||
} else if ("ISYS_INIT_TRAJECTORY_SUCCESS".equals(guardianInfo.getCode())) {
|
||||
// 2. 轨迹管理_轨迹下载成功(本地已有对应轨迹也触发)
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onAutopilotGuardian() 轨迹下载成功");
|
||||
// ToastUtils.showShort("轨迹下载成功");
|
||||
stopTrajReqLoop();
|
||||
} else if ("ISYS_INIT_TRAJECTORY_FAILURE".equals(guardianInfo.getCode())) {
|
||||
// 3. 轨迹管理_轨迹下载失败,本地无对应轨迹
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onAutopilotGuardian() " +
|
||||
"轨迹下载失败,本地无对应轨迹");
|
||||
// ToastUtils.showShort("轨迹下载失败,本地无对应轨迹");
|
||||
} else if ("ISYS_INIT_TRAJECTORY_WARNING".equals(guardianInfo.getCode())) {
|
||||
// 4. 轨迹管理_轨迹下载失败,本地有对应轨迹,认为成功
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onAutopilotGuardian() " +
|
||||
"轨迹下载失败,本地有对应轨迹,认为成功");
|
||||
// ToastUtils.showShort("轨迹下载失败,本地有对应轨迹,认为成功");
|
||||
} else if ("ISYS_INIT_TRAJECTORY_TIMEOUT".equals(guardianInfo.getCode())) {
|
||||
// 5. 轨迹管理_轨迹下载超时
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onAutopilotGuardian() 轨迹下载超时");
|
||||
// ToastUtils.showShort("轨迹下载超时");
|
||||
}
|
||||
}
|
||||
|
||||
private void setupAutoPilotLine(SweeperSubTaskDetailBean subTaskDetail) {
|
||||
if (subTaskDetail == null) {
|
||||
CallerLogger.INSTANCE.e(M_SWEEPER + TAG, "setupAutoPilotLine(): routesResult is null.");
|
||||
return;
|
||||
} else {
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(subTaskDetail.getLineId(),
|
||||
subTaskDetail.getCsvFileUrl(), subTaskDetail.getCsvFileMd5(),
|
||||
subTaskDetail.getTxtFileUrl(), subTaskDetail.getTxtFileMd5(),
|
||||
subTaskDetail.getPublishTime(), subTaskDetail.getCarModel(),
|
||||
subTaskDetail.getCsvFileUrlDPQP(), subTaskDetail.getCsvFileMd5DPQP(),
|
||||
subTaskDetail.getTxtFileUrlDPQP(), subTaskDetail.getTxtFileMd5DPQP(),
|
||||
subTaskDetail.getPublishTimeDPQP());
|
||||
}
|
||||
}
|
||||
|
||||
private void clearAutoPilotLine() {
|
||||
if (mAutoPilotLine == null) return;
|
||||
mAutoPilotLine.setLineId(-1);
|
||||
mAutoPilotLine.setTrajUrl("");
|
||||
mAutoPilotLine.setTrajMd5("");
|
||||
mAutoPilotLine.setStopUrl("");
|
||||
mAutoPilotLine.setStopMd5("");
|
||||
mAutoPilotLine.setTimestamp(0);
|
||||
mAutoPilotLine.setVehicleModel("");
|
||||
mAutoPilotLine.setTrajUrl_dpqp("");
|
||||
mAutoPilotLine.setTrajMd5_dpqp("");
|
||||
mAutoPilotLine.setStopUrl_dpqp("");
|
||||
mAutoPilotLine.setStopMd5_dpqp("");
|
||||
mAutoPilotLine.setTimestamp_dpqp(0);
|
||||
}
|
||||
|
||||
private void startTrajReqLoop(SweeperSubTaskDetailBean sweeperSubTaskDetailBean) {
|
||||
if (mSendReqDisposable != null && !mSendReqDisposable.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "startTrajReqLoop()");
|
||||
setupAutoPilotLine(sweeperSubTaskDetailBean);
|
||||
mSendReqDisposable = Observable.interval(SweeperConst.LOOP_DELAY,
|
||||
SweeperConst.LOOP_PERIOD_10S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> {
|
||||
if (aLong > SweeperConst.LOOP_SEND_TRAJ_TIMES) {
|
||||
stopTrajReqLoop();
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "loop sendTrajectoryReq: " + aLong);
|
||||
sendTrajectoryReq();
|
||||
});
|
||||
}
|
||||
|
||||
public void stopTrajReqLoop() {
|
||||
if (mSendReqDisposable != null) {
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "stopTrajReqLoop()");
|
||||
mSendReqDisposable.dispose();
|
||||
mSendReqDisposable = null;
|
||||
clearAutoPilotLine();
|
||||
}
|
||||
}
|
||||
|
||||
private void sendTrajectoryReq() {
|
||||
if (mAutoPilotLine == null) {
|
||||
CallerLogger.INSTANCE.e(M_SWEEPER + TAG, "sendTrajectoryReq(): mAutoPilotLine is null!!!");
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: 2022/6/24
|
||||
// test1
|
||||
// mAutoPilotLine.setLineId(148);
|
||||
// mAutoPilotLine.setTrajUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/e27c20c2da32481021d934c3ef084536/traj_148.csv");
|
||||
// mAutoPilotLine.setTrajMd5("e27c20c2da32481021d934c3ef084536");
|
||||
// mAutoPilotLine.setStopUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/6224c9dd2c0e2bd990c6482c0464de45/stop_148.txt");
|
||||
// mAutoPilotLine.setStopMd5("6224c9dd2c0e2bd990c6482c0464de45");
|
||||
// mAutoPilotLine.setTimestamp(1654596000000L); //20220607 18:00
|
||||
// mAutoPilotLine.setVehicleModel("红旗H9");
|
||||
|
||||
// test2
|
||||
// mAutoPilotLine.setLineId(148);
|
||||
// mAutoPilotLine.setTrajUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/8654497cf918be461a59c7ad8e22920d/traj_148.csv");
|
||||
// mAutoPilotLine.setTrajMd5("8654497cf918be461a59c7ad8e22920d");
|
||||
// mAutoPilotLine.setStopUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/1bb098b244922649bf3e7bada0d3950f/stop_148.txt");
|
||||
// mAutoPilotLine.setStopMd5("1bb098b244922649bf3e7bada0d3950f");
|
||||
// mAutoPilotLine.setTimestamp(1654761600000L); //20220609 16:00
|
||||
// mAutoPilotLine.setVehicleModel("红旗H9");
|
||||
|
||||
CallerAutoPilotControlManager.INSTANCE.sendTrajectoryDownloadReq(mAutoPilotLine);
|
||||
CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "sendTrajectoryReq(): "
|
||||
+ GsonUtils.toJson(mAutoPilotLine));
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.och.sweepercloud.R
|
||||
import com.mogo.och.sweepercloud.bean.SubInfo
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask.SubTaskInfo
|
||||
import kotlinx.android.synthetic.main.sweeper_subtask_view.view.*
|
||||
|
||||
/**
|
||||
@@ -29,8 +29,8 @@ class SubTaskView : ConstraintLayout {
|
||||
/**
|
||||
* 设置子任务信息
|
||||
*/
|
||||
fun setData(taskInfo: SubInfo, isSelect: Boolean = false, isLastTask: Boolean = false) {
|
||||
tvSubTaskName.text = taskInfo.taskName
|
||||
fun setData(taskInfo: SubTaskInfo, isSelect: Boolean = false, isLastTask: Boolean = false) {
|
||||
tvSubTaskName.text = taskInfo.subTaskName
|
||||
tvSubTaskName.setTextColor(if (isSelect) Color.parseColor("#3BD2FF") else Color.parseColor("#FFFFFF"))
|
||||
if (isSelect) {
|
||||
ivSubTask.setImageResource(R.drawable.sweeper_icon_select_subtask)
|
||||
|
||||
@@ -7,9 +7,8 @@ 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.mogo.och.sweepercloud.bean.SubInfo
|
||||
import com.mogo.och.sweepercloud.bean.SweeperSubTaskBean
|
||||
import com.mogo.och.sweepercloud.constant.SubTaskTypeEnum
|
||||
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.*
|
||||
|
||||
/**
|
||||
@@ -20,8 +19,8 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
|
||||
|
||||
//当前任务操作菜单
|
||||
private var mCurrentPosition = 0
|
||||
private var listTask: List<SubInfo>? = null
|
||||
private var mSubTaskType: SubTaskTypeEnum = SubTaskTypeEnum.AUTOPILOT_SUBTYPE
|
||||
private var listTask: List<SubTaskInfo>? = null
|
||||
private var mSubTaskType: Int=0
|
||||
private var mSubTaskStatus: Int = 1
|
||||
|
||||
constructor(context: Context) : super(context) {}
|
||||
@@ -41,19 +40,19 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
|
||||
* 设置当前任务数据
|
||||
*/
|
||||
fun setData(
|
||||
subTaskBean: SweeperSubTaskBean?,
|
||||
subTaskBean: TaskInfo?,
|
||||
currentPosition: Int,
|
||||
) {
|
||||
this.mCurrentPosition = currentPosition
|
||||
subTaskBean?.apply {
|
||||
this@SweeperCurrentTaskInfoView.listTask = subList
|
||||
this@SweeperCurrentTaskInfoView.listTask = subListList
|
||||
tvTaskName.text = taskName
|
||||
val calendar = DateTimeUtil.formatLongToCalendar(taskStartTime)
|
||||
tvTaskTime.text = DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.HH_mm)
|
||||
}
|
||||
listTask?.let {
|
||||
mSubTaskStatus = it[currentPosition].taskStatus
|
||||
setSubTaskState(mSubTaskStatus == 2)
|
||||
mSubTaskStatus = it[currentPosition].taskStatus.number
|
||||
setSubTaskState(mSubTaskStatus == 1)
|
||||
}
|
||||
setCurrentData(currentPosition)
|
||||
}
|
||||
@@ -75,8 +74,7 @@ class SweeperCurrentTaskInfoView : ConstraintLayout {
|
||||
*/
|
||||
fun setCurrentData(mCurrentPosition: Int) {
|
||||
listTask?.let {
|
||||
mSubTaskType =
|
||||
if (it[mCurrentPosition].taskType == SubTaskTypeEnum.AUTOPILOT_SUBTYPE.code) SubTaskTypeEnum.AUTOPILOT_SUBTYPE else SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE
|
||||
mSubTaskType = it[mCurrentPosition].taskModel.number
|
||||
if (it.size == 1) {
|
||||
preSubTask.setData(it[mCurrentPosition], isSelect = true, isLastTask = true)
|
||||
currentSubTask.visibility = View.INVISIBLE
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.sweepercloud.R
|
||||
import com.mogo.och.sweepercloud.callback.ICleaningModeStateCallback
|
||||
import com.mogo.och.sweepercloud.constant.OperateStateEnum
|
||||
import com.mogo.och.sweepercloud.constant.SubTaskTypeEnum
|
||||
import com.mogo.och.sweepercloud.ui.popwindow.SweeperOperatePanelPopWindow
|
||||
import com.mogo.och.sweepercloud.util.SweeperFutianCmdUtil
|
||||
import kotlinx.android.synthetic.main.sweeper_work_mode.view.*
|
||||
@@ -68,7 +67,7 @@ class SweeperWorkModeView : ConstraintLayout,ICleaningModeStateCallback {
|
||||
/**
|
||||
* 设置清扫模式面板
|
||||
*/
|
||||
fun setSweeperFutianCleanSystemState(taskType: SubTaskTypeEnum, cleanSystemState: SweeperFuTianTaskSystemStates?) {
|
||||
fun setSweeperFutianCleanSystemState(taskType: Int, cleanSystemState: SweeperFuTianTaskSystemStates?) {
|
||||
// TODO:传递清扫车底盘数据给上装面板
|
||||
//mOperatePanelPopWindow?.setCleanSystemState(cleanSystemState, this@SweeperWorkModeView)
|
||||
if (this.operateState.code==OperateStateEnum.STARTING_STATUS.code){
|
||||
@@ -80,7 +79,7 @@ class SweeperWorkModeView : ConstraintLayout,ICleaningModeStateCallback {
|
||||
d(SceneConstant.M_SWEEPER + TAG, "SystemState operateState:"+operateState.code)
|
||||
}
|
||||
//清扫车暂未选择清扫模式或者任务类型是人工驾驶子任务,则暂无清扫模式
|
||||
if (SweeperFutianCmdUtil.checkIfCleanMode(cleanSystemState) || taskType.code == SubTaskTypeEnum.MANUAL_DRIVING_SUBTYPE.code) {
|
||||
if (SweeperFutianCmdUtil.checkIfCleanMode(cleanSystemState) || taskType==1) {
|
||||
setShowOrHideCleanSystemState(OperateStateEnum.NO_STATUS, cleanSystemState)
|
||||
} else {
|
||||
setShowOrHideCleanSystemState(OperateStateEnum.SUCCESS_STATUS, cleanSystemState)
|
||||
|
||||
Reference in New Issue
Block a user