[8.4.0][司机屏] 无人化,任务管理相关逻辑
This commit is contained in:
@@ -119,6 +119,8 @@ public enum MessageType {
|
||||
TYPE_RECEIVE_OBU_UPLOAD_STATUS(MessagePad.MessageType.MsgTypeObuUploadStatus, R.string.adas_data_MsgTypeObuUploadStatus_RECEIVE),
|
||||
TYPE_RECEIVE_PLANNING_STOP_LINE(MessagePad.MessageType.MsgTypePlanningStopLine, R.string.adas_data_MsgTypePlanningStopLine),
|
||||
TYPE_RECEIVE_FSM_EVENT(MessagePad.MessageType.MsgTypeFsmEvent, R.string.adas_data_MsgTypeFsmEvent),
|
||||
TYPE_SEND_TASK_MANAGER(MessagePad.MessageType.MsgTypeTaskMgrAndPad, R.string.adas_data_MsgTypeTaskMgrAndPad_SEND),
|
||||
TYPE_RECEIVE_TASK_MANAGER(MessagePad.MessageType.MsgTypeTaskMgrAndPad, R.string.adas_data_MsgTypeTaskMgrAndPad_RECEIVE),
|
||||
|
||||
//TODO 透传原始pb文件中不存在以下type。由于Java中无法强转,所以在mogo-adas-data/message_pad.proto中放开注释
|
||||
TYPE_RECEIVE_PLANNING_DECISION_STATE(MessagePad.MessageType.MsgTypePlanningDecisionState, R.string.adas_data_MsgTypePlanningDecisionState),
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
|
||||
|
||||
/**
|
||||
* 自动驾驶坐标点
|
||||
*/
|
||||
public class AutopilotPoint {
|
||||
/**
|
||||
* X坐标
|
||||
*/
|
||||
private double x;
|
||||
/**
|
||||
* Y坐标
|
||||
*/
|
||||
private double y;
|
||||
|
||||
public AutopilotPoint() {
|
||||
}
|
||||
|
||||
public AutopilotPoint(double x, double y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(double x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(double y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotPoint{" +
|
||||
"x=" + x +
|
||||
", y=" + y +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private double x;
|
||||
private double y;
|
||||
|
||||
public Builder x(double x) {
|
||||
this.x = x;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder y(double y) {
|
||||
this.y = y;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AutopilotPoint build() {
|
||||
return new AutopilotPoint(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
|
||||
|
||||
/**
|
||||
* app发送给车端
|
||||
* 开启任务
|
||||
*/
|
||||
public class AutopilotStartRequest {
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
private Long taskId;
|
||||
/**
|
||||
* 来源
|
||||
*/
|
||||
private Integer source;
|
||||
/**
|
||||
* 轨迹
|
||||
*/
|
||||
private Trajectory traj;
|
||||
/**
|
||||
* 任务类型
|
||||
* 0: 多站点模式 1:固定路线
|
||||
*/
|
||||
private Integer taskType;
|
||||
|
||||
public AutopilotStartRequest() {
|
||||
}
|
||||
|
||||
public AutopilotStartRequest(Long taskId, Integer source, Trajectory traj, Integer taskType) {
|
||||
this.taskId = taskId;
|
||||
this.source = source;
|
||||
this.traj = traj;
|
||||
this.taskType = taskType;
|
||||
}
|
||||
|
||||
public Long getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(Long taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public Integer getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(Integer source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public Trajectory getTraj() {
|
||||
return traj;
|
||||
}
|
||||
|
||||
public void setTraj(Trajectory traj) {
|
||||
this.traj = traj;
|
||||
}
|
||||
|
||||
public Integer getTaskType() {
|
||||
return taskType;
|
||||
}
|
||||
|
||||
public void setTaskType(Integer taskType) {
|
||||
this.taskType = taskType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotStartRequest{" +
|
||||
"taskId=" + taskId +
|
||||
", source=" + source +
|
||||
", traj=" + traj +
|
||||
", taskType=" + taskType +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private Long taskId;
|
||||
private Integer source;
|
||||
private Trajectory traj;
|
||||
private Integer taskType;
|
||||
|
||||
public Builder taskId(Long taskId) {
|
||||
this.taskId = taskId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder source(Integer source) {
|
||||
this.source = source;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder traj(Trajectory traj) {
|
||||
this.traj = traj;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder taskType(Integer taskType) {
|
||||
this.taskType = taskType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AutopilotStartRequest build() {
|
||||
return new AutopilotStartRequest(taskId, source, traj, taskType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
|
||||
|
||||
/**
|
||||
* 命令数据传输对象
|
||||
* @param <T> 数据类型
|
||||
*/
|
||||
public class CmdDto<T> {
|
||||
/**
|
||||
* 命令类型
|
||||
*/
|
||||
private String cmdType;
|
||||
/**
|
||||
* 任务ID
|
||||
*/
|
||||
private Long taskId;
|
||||
/**
|
||||
* 轨迹ID
|
||||
*/
|
||||
private Long lineId;
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
private Long timestamp;
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
private T data;
|
||||
|
||||
public CmdDto() {
|
||||
}
|
||||
|
||||
public CmdDto(String cmdType, Long taskId, Long lineId, Long timestamp, T data) {
|
||||
this.cmdType = cmdType;
|
||||
this.taskId = taskId;
|
||||
this.lineId = lineId;
|
||||
this.timestamp = timestamp;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getCmdType() {
|
||||
return cmdType;
|
||||
}
|
||||
|
||||
public void setCmdType(String cmdType) {
|
||||
this.cmdType = cmdType;
|
||||
}
|
||||
|
||||
public Long getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(Long taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public Long getLineId() {
|
||||
return lineId;
|
||||
}
|
||||
|
||||
public void setLineId(Long lineId) {
|
||||
this.lineId = lineId;
|
||||
}
|
||||
|
||||
public Long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(Long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CmdDto{" +
|
||||
"cmdType='" + cmdType + '\'' +
|
||||
", taskId=" + taskId +
|
||||
", lineId=" + lineId +
|
||||
", timestamp=" + timestamp +
|
||||
", data=" + data +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static <T> Builder<T> builder() {
|
||||
return new Builder<>();
|
||||
}
|
||||
|
||||
public static class Builder<T> {
|
||||
private String cmdType;
|
||||
private Long taskId;
|
||||
private Long lineId;
|
||||
private Long timestamp;
|
||||
private T data;
|
||||
|
||||
public Builder<T> cmdType(String cmdType) {
|
||||
this.cmdType = cmdType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder<T> taskId(Long taskId) {
|
||||
this.taskId = taskId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder<T> lineId(Long lineId) {
|
||||
this.lineId = lineId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder<T> timestamp(Long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder<T> data(T data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CmdDto<T> build() {
|
||||
return new CmdDto<>(cmdType, taskId, lineId, timestamp, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
|
||||
|
||||
/**
|
||||
* 车端主动发送
|
||||
* 车端终止上报消息
|
||||
*/
|
||||
public class TaskAbortNotification {
|
||||
/**
|
||||
* 当前位置
|
||||
*/
|
||||
private VehicleSite curLocation;
|
||||
/**
|
||||
* 任务累计行驶距离
|
||||
*/
|
||||
private double accumulatedTaskDis;
|
||||
/**
|
||||
* 解决方案
|
||||
*/
|
||||
private String solution;
|
||||
/**
|
||||
* 错误消息
|
||||
*/
|
||||
private String errMsg;
|
||||
|
||||
public TaskAbortNotification() {
|
||||
}
|
||||
|
||||
public TaskAbortNotification(VehicleSite curLocation, double accumulatedTaskDis, String solution, String errMsg) {
|
||||
this.curLocation = curLocation;
|
||||
this.accumulatedTaskDis = accumulatedTaskDis;
|
||||
this.solution = solution;
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
public VehicleSite getCurLocation() {
|
||||
return curLocation;
|
||||
}
|
||||
|
||||
public void setCurLocation(VehicleSite curLocation) {
|
||||
this.curLocation = curLocation;
|
||||
}
|
||||
|
||||
public double getAccumulatedTaskDis() {
|
||||
return accumulatedTaskDis;
|
||||
}
|
||||
|
||||
public void setAccumulatedTaskDis(double accumulatedTaskDis) {
|
||||
this.accumulatedTaskDis = accumulatedTaskDis;
|
||||
}
|
||||
|
||||
public String getSolution() {
|
||||
return solution;
|
||||
}
|
||||
|
||||
public void setSolution(String solution) {
|
||||
this.solution = solution;
|
||||
}
|
||||
|
||||
public String getErrMsg() {
|
||||
return errMsg;
|
||||
}
|
||||
|
||||
public void setErrMsg(String errMsg) {
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskAbortNotification{" +
|
||||
"curLocation=" + curLocation +
|
||||
", accumulatedTaskDis=" + accumulatedTaskDis +
|
||||
", solution='" + solution + '\'' +
|
||||
", errMsg='" + errMsg + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
|
||||
|
||||
/**
|
||||
* 车端主动发送
|
||||
* 车端到站消息
|
||||
*/
|
||||
public class TaskArrivalNotification {
|
||||
/**
|
||||
* 当前位置
|
||||
*/
|
||||
private VehicleSite curLocation;
|
||||
/**
|
||||
* 站点
|
||||
*/
|
||||
private VehicleSite station;
|
||||
/**
|
||||
* 任务累计行驶距离
|
||||
*/
|
||||
private double accumulatedTaskDis;
|
||||
|
||||
public TaskArrivalNotification() {
|
||||
}
|
||||
|
||||
public TaskArrivalNotification(VehicleSite curLocation, VehicleSite station, double accumulatedTaskDis) {
|
||||
this.curLocation = curLocation;
|
||||
this.station = station;
|
||||
this.accumulatedTaskDis = accumulatedTaskDis;
|
||||
}
|
||||
|
||||
public VehicleSite getCurLocation() {
|
||||
return curLocation;
|
||||
}
|
||||
|
||||
public void setCurLocation(VehicleSite curLocation) {
|
||||
this.curLocation = curLocation;
|
||||
}
|
||||
|
||||
public VehicleSite getStation() {
|
||||
return station;
|
||||
}
|
||||
|
||||
public void setStation(VehicleSite station) {
|
||||
this.station = station;
|
||||
}
|
||||
|
||||
public double getAccumulatedTaskDis() {
|
||||
return accumulatedTaskDis;
|
||||
}
|
||||
|
||||
public void setAccumulatedTaskDis(double accumulatedTaskDis) {
|
||||
this.accumulatedTaskDis = accumulatedTaskDis;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskArrivalNotification{" +
|
||||
"curLocation=" + curLocation +
|
||||
", station=" + station +
|
||||
", accumulatedTaskDis=" + accumulatedTaskDis +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
|
||||
|
||||
/**
|
||||
* 任务取消响应
|
||||
*/
|
||||
public class TaskCancelResponse {
|
||||
/**
|
||||
* 任务累计行驶距离
|
||||
*/
|
||||
private double accumulatedTaskDis;
|
||||
/**
|
||||
* 任务取消结果,true:成功 false:失败
|
||||
*/
|
||||
private boolean result;
|
||||
/**
|
||||
* 任务取消失败原因 (目前仅超时5秒未退出自驾)
|
||||
*/
|
||||
private String errMsg;
|
||||
|
||||
public TaskCancelResponse() {
|
||||
}
|
||||
|
||||
public TaskCancelResponse(double accumulatedTaskDis, boolean result, String errMsg) {
|
||||
this.accumulatedTaskDis = accumulatedTaskDis;
|
||||
this.result = result;
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
public double getAccumulatedTaskDis() {
|
||||
return accumulatedTaskDis;
|
||||
}
|
||||
|
||||
public void setAccumulatedTaskDis(double accumulatedTaskDis) {
|
||||
this.accumulatedTaskDis = accumulatedTaskDis;
|
||||
}
|
||||
|
||||
public boolean isResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(boolean result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public String getErrMsg() {
|
||||
return errMsg;
|
||||
}
|
||||
|
||||
public void setErrMsg(String errMsg) {
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskCancelResponse{" +
|
||||
"accumulatedTaskDis=" + accumulatedTaskDis +
|
||||
", result=" + result +
|
||||
", errMsg='" + errMsg + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
|
||||
|
||||
/**
|
||||
* App发送给车端
|
||||
* 离开站点
|
||||
*/
|
||||
public class TaskContinueNotification {
|
||||
/**
|
||||
* 当前站点
|
||||
*/
|
||||
private VehicleSite curStation;
|
||||
|
||||
public TaskContinueNotification() {
|
||||
}
|
||||
|
||||
public TaskContinueNotification(VehicleSite curStation) {
|
||||
this.curStation = curStation;
|
||||
}
|
||||
|
||||
public VehicleSite getCurStation() {
|
||||
return curStation;
|
||||
}
|
||||
|
||||
public void setCurStation(VehicleSite curStation) {
|
||||
this.curStation = curStation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskContinueNotification{" +
|
||||
"curStation=" + curStation +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private VehicleSite curStation;
|
||||
|
||||
public Builder curStation(VehicleSite curStation) {
|
||||
this.curStation = curStation;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TaskContinueNotification build() {
|
||||
return new TaskContinueNotification(curStation);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
|
||||
|
||||
/**
|
||||
* 任务完成通知
|
||||
*/
|
||||
public class TaskFinishNotification {
|
||||
public TaskFinishNotification() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskFinishNotification{}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
|
||||
|
||||
/**
|
||||
* 剩余里程查询参数-暂时未使用
|
||||
*/
|
||||
public class TaskLocationQueryRequest {
|
||||
public TaskLocationQueryRequest() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskLocationQueryRequest{}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
|
||||
|
||||
/**
|
||||
* 车端响应
|
||||
* 车辆预估全程剩余里程、剩余时间
|
||||
* 预估到下站预估里程、预估时间
|
||||
*/
|
||||
public class TaskLocationQueryResponse {
|
||||
/**
|
||||
* 当前位置
|
||||
*/
|
||||
private VehicleSite curLocation;
|
||||
/**
|
||||
* 上一个站点
|
||||
*/
|
||||
private VehicleSite preStation;
|
||||
/**
|
||||
* 下一个站点
|
||||
*/
|
||||
private VehicleSite nextStation;
|
||||
/**
|
||||
* 从前一站点到目前的总距离(单位m)
|
||||
*/
|
||||
private double accumulatedStationDis;
|
||||
/**
|
||||
* 从当前到下一站点的距离(单位m)
|
||||
*/
|
||||
private double reversedAccumulatedStationDis;
|
||||
/**
|
||||
* 到达下一站需要的时间(单位s)
|
||||
*/
|
||||
private double stationTimeLeft;
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
private double velocity;
|
||||
/**
|
||||
* 加速度
|
||||
*/
|
||||
private double acceleration;
|
||||
/**
|
||||
* 航向角
|
||||
*/
|
||||
private double theta;
|
||||
/**
|
||||
* 曲率
|
||||
*/
|
||||
private double kappa;
|
||||
/**
|
||||
* 任务全程的行进里程(单位米)
|
||||
*/
|
||||
private double accumulatedTaskDis;
|
||||
/**
|
||||
* 任务全程的剩余里程(单位米)
|
||||
*/
|
||||
private double reversedAccumulatedTaskDis;
|
||||
/**
|
||||
* 到达终点需要的时间(单位s)
|
||||
*/
|
||||
private double taskTimeLeft;
|
||||
|
||||
public TaskLocationQueryResponse() {
|
||||
}
|
||||
|
||||
public TaskLocationQueryResponse(VehicleSite curLocation, VehicleSite preStation, VehicleSite nextStation, double accumulatedStationDis, double reversedAccumulatedStationDis, double stationTimeLeft, double velocity, double acceleration, double theta, double kappa, double accumulatedTaskDis, double reversedAccumulatedTaskDis, double taskTimeLeft) {
|
||||
this.curLocation = curLocation;
|
||||
this.preStation = preStation;
|
||||
this.nextStation = nextStation;
|
||||
this.accumulatedStationDis = accumulatedStationDis;
|
||||
this.reversedAccumulatedStationDis = reversedAccumulatedStationDis;
|
||||
this.stationTimeLeft = stationTimeLeft;
|
||||
this.velocity = velocity;
|
||||
this.acceleration = acceleration;
|
||||
this.theta = theta;
|
||||
this.kappa = kappa;
|
||||
this.accumulatedTaskDis = accumulatedTaskDis;
|
||||
this.reversedAccumulatedTaskDis = reversedAccumulatedTaskDis;
|
||||
this.taskTimeLeft = taskTimeLeft;
|
||||
}
|
||||
|
||||
public VehicleSite getCurLocation() {
|
||||
return curLocation;
|
||||
}
|
||||
|
||||
public void setCurLocation(VehicleSite curLocation) {
|
||||
this.curLocation = curLocation;
|
||||
}
|
||||
|
||||
public VehicleSite getPreStation() {
|
||||
return preStation;
|
||||
}
|
||||
|
||||
public void setPreStation(VehicleSite preStation) {
|
||||
this.preStation = preStation;
|
||||
}
|
||||
|
||||
public VehicleSite getNextStation() {
|
||||
return nextStation;
|
||||
}
|
||||
|
||||
public void setNextStation(VehicleSite nextStation) {
|
||||
this.nextStation = nextStation;
|
||||
}
|
||||
|
||||
public double getAccumulatedStationDis() {
|
||||
return accumulatedStationDis;
|
||||
}
|
||||
|
||||
public void setAccumulatedStationDis(double accumulatedStationDis) {
|
||||
this.accumulatedStationDis = accumulatedStationDis;
|
||||
}
|
||||
|
||||
public double getReversedAccumulatedStationDis() {
|
||||
return reversedAccumulatedStationDis;
|
||||
}
|
||||
|
||||
public void setReversedAccumulatedStationDis(double reversedAccumulatedStationDis) {
|
||||
this.reversedAccumulatedStationDis = reversedAccumulatedStationDis;
|
||||
}
|
||||
|
||||
public double getStationTimeLeft() {
|
||||
return stationTimeLeft;
|
||||
}
|
||||
|
||||
public void setStationTimeLeft(double stationTimeLeft) {
|
||||
this.stationTimeLeft = stationTimeLeft;
|
||||
}
|
||||
|
||||
public double getVelocity() {
|
||||
return velocity;
|
||||
}
|
||||
|
||||
public void setVelocity(double velocity) {
|
||||
this.velocity = velocity;
|
||||
}
|
||||
|
||||
public double getAcceleration() {
|
||||
return acceleration;
|
||||
}
|
||||
|
||||
public void setAcceleration(double acceleration) {
|
||||
this.acceleration = acceleration;
|
||||
}
|
||||
|
||||
public double getTheta() {
|
||||
return theta;
|
||||
}
|
||||
|
||||
public void setTheta(double theta) {
|
||||
this.theta = theta;
|
||||
}
|
||||
|
||||
public double getKappa() {
|
||||
return kappa;
|
||||
}
|
||||
|
||||
public void setKappa(double kappa) {
|
||||
this.kappa = kappa;
|
||||
}
|
||||
|
||||
public double getAccumulatedTaskDis() {
|
||||
return accumulatedTaskDis;
|
||||
}
|
||||
|
||||
public void setAccumulatedTaskDis(double accumulatedTaskDis) {
|
||||
this.accumulatedTaskDis = accumulatedTaskDis;
|
||||
}
|
||||
|
||||
public double getReversedAccumulatedTaskDis() {
|
||||
return reversedAccumulatedTaskDis;
|
||||
}
|
||||
|
||||
public void setReversedAccumulatedTaskDis(double reversedAccumulatedTaskDis) {
|
||||
this.reversedAccumulatedTaskDis = reversedAccumulatedTaskDis;
|
||||
}
|
||||
|
||||
public double getTaskTimeLeft() {
|
||||
return taskTimeLeft;
|
||||
}
|
||||
|
||||
public void setTaskTimeLeft(double taskTimeLeft) {
|
||||
this.taskTimeLeft = taskTimeLeft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskLocationQueryResponse{" +
|
||||
"curLocation=" + curLocation +
|
||||
", preStation=" + preStation +
|
||||
", nextStation=" + nextStation +
|
||||
", accumulatedStationDis=" + accumulatedStationDis +
|
||||
", reversedAccumulatedStationDis=" + reversedAccumulatedStationDis +
|
||||
", stationTimeLeft=" + stationTimeLeft +
|
||||
", velocity=" + velocity +
|
||||
", acceleration=" + acceleration +
|
||||
", theta=" + theta +
|
||||
", kappa=" + kappa +
|
||||
", accumulatedTaskDis=" + accumulatedTaskDis +
|
||||
", reversedAccumulatedTaskDis=" + reversedAccumulatedTaskDis +
|
||||
", taskTimeLeft=" + taskTimeLeft +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车端发送车辆启动结果
|
||||
*/
|
||||
public class TaskStartNotification {
|
||||
/**
|
||||
* 当前位置
|
||||
*/
|
||||
private VehicleSite curLocation;
|
||||
/**
|
||||
* 自动驾驶结果
|
||||
*/
|
||||
private boolean autopilotResult;
|
||||
/**
|
||||
* 站点剩余时间
|
||||
*/
|
||||
private double stationTimeLeft;
|
||||
/**
|
||||
* 错误消息
|
||||
*/
|
||||
private String errMsg;
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
private List<Integer> errCodes;
|
||||
|
||||
public TaskStartNotification() {
|
||||
}
|
||||
|
||||
public TaskStartNotification(VehicleSite curLocation, boolean autopilotResult, double stationTimeLeft, String errMsg, List<Integer> errCodes) {
|
||||
this.curLocation = curLocation;
|
||||
this.autopilotResult = autopilotResult;
|
||||
this.stationTimeLeft = stationTimeLeft;
|
||||
this.errMsg = errMsg;
|
||||
this.errCodes = errCodes;
|
||||
}
|
||||
|
||||
public VehicleSite getCurLocation() {
|
||||
return curLocation;
|
||||
}
|
||||
|
||||
public void setCurLocation(VehicleSite curLocation) {
|
||||
this.curLocation = curLocation;
|
||||
}
|
||||
|
||||
public boolean isAutopilotResult() {
|
||||
return autopilotResult;
|
||||
}
|
||||
|
||||
public void setAutopilotResult(boolean autopilotResult) {
|
||||
this.autopilotResult = autopilotResult;
|
||||
}
|
||||
|
||||
public double getStationTimeLeft() {
|
||||
return stationTimeLeft;
|
||||
}
|
||||
|
||||
public void setStationTimeLeft(double stationTimeLeft) {
|
||||
this.stationTimeLeft = stationTimeLeft;
|
||||
}
|
||||
|
||||
public String getErrMsg() {
|
||||
return errMsg;
|
||||
}
|
||||
|
||||
public void setErrMsg(String errMsg) {
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
public List<Integer> getErrCodes() {
|
||||
return errCodes;
|
||||
}
|
||||
|
||||
public void setErrCodes(List<Integer> errCodes) {
|
||||
this.errCodes = errCodes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskStartNotification{" +
|
||||
"curLocation=" + curLocation +
|
||||
", autopilotResult=" + autopilotResult +
|
||||
", stationTimeLeft=" + stationTimeLeft +
|
||||
", errMsg='" + errMsg + '\'' +
|
||||
", errCodes=" + errCodes +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 轨迹
|
||||
*/
|
||||
public class Trajectory {
|
||||
/**
|
||||
* 路线ID
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 轨迹URL
|
||||
*/
|
||||
private String trajUrl;
|
||||
/**
|
||||
* 轨迹MD5
|
||||
*/
|
||||
private String trajMd5;
|
||||
/**
|
||||
* 轨迹版本
|
||||
*/
|
||||
private String trajVer;
|
||||
/**
|
||||
* 停止点URL
|
||||
*/
|
||||
private String stopUrl;
|
||||
/**
|
||||
* 停止点MD5
|
||||
*/
|
||||
private String stopMd5;
|
||||
/**
|
||||
* 停止点版本
|
||||
*/
|
||||
private String stopVer;
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
private Long timestamp;
|
||||
/**
|
||||
* 途经点
|
||||
*/
|
||||
private List<VehicleSite> wayPoints;
|
||||
/**
|
||||
* 黑名单点
|
||||
*/
|
||||
private List<VehicleSite> blackPoints;
|
||||
|
||||
public Trajectory() {
|
||||
}
|
||||
|
||||
public Trajectory(Long id, String name, String trajUrl, String trajMd5, String trajVer, String stopUrl, String stopMd5, String stopVer, Long timestamp, List<VehicleSite> wayPoints, List<VehicleSite> blackPoints) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.trajUrl = trajUrl;
|
||||
this.trajMd5 = trajMd5;
|
||||
this.trajVer = trajVer;
|
||||
this.stopUrl = stopUrl;
|
||||
this.stopMd5 = stopMd5;
|
||||
this.stopVer = stopVer;
|
||||
this.timestamp = timestamp;
|
||||
this.wayPoints = wayPoints;
|
||||
this.blackPoints = blackPoints;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getTrajUrl() {
|
||||
return trajUrl;
|
||||
}
|
||||
|
||||
public void setTrajUrl(String trajUrl) {
|
||||
this.trajUrl = trajUrl;
|
||||
}
|
||||
|
||||
public String getTrajMd5() {
|
||||
return trajMd5;
|
||||
}
|
||||
|
||||
public void setTrajMd5(String trajMd5) {
|
||||
this.trajMd5 = trajMd5;
|
||||
}
|
||||
|
||||
public String getTrajVer() {
|
||||
return trajVer;
|
||||
}
|
||||
|
||||
public void setTrajVer(String trajVer) {
|
||||
this.trajVer = trajVer;
|
||||
}
|
||||
|
||||
public String getStopUrl() {
|
||||
return stopUrl;
|
||||
}
|
||||
|
||||
public void setStopUrl(String stopUrl) {
|
||||
this.stopUrl = stopUrl;
|
||||
}
|
||||
|
||||
public String getStopMd5() {
|
||||
return stopMd5;
|
||||
}
|
||||
|
||||
public void setStopMd5(String stopMd5) {
|
||||
this.stopMd5 = stopMd5;
|
||||
}
|
||||
|
||||
public String getStopVer() {
|
||||
return stopVer;
|
||||
}
|
||||
|
||||
public void setStopVer(String stopVer) {
|
||||
this.stopVer = stopVer;
|
||||
}
|
||||
|
||||
public Long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(Long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public List<VehicleSite> getWayPoints() {
|
||||
return wayPoints;
|
||||
}
|
||||
|
||||
public void setWayPoints(List<VehicleSite> wayPoints) {
|
||||
this.wayPoints = wayPoints;
|
||||
}
|
||||
|
||||
public List<VehicleSite> getBlackPoints() {
|
||||
return blackPoints;
|
||||
}
|
||||
|
||||
public void setBlackPoints(List<VehicleSite> blackPoints) {
|
||||
this.blackPoints = blackPoints;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Trajectory{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", trajUrl='" + trajUrl + '\'' +
|
||||
", trajMd5='" + trajMd5 + '\'' +
|
||||
", trajVer='" + trajVer + '\'' +
|
||||
", stopUrl='" + stopUrl + '\'' +
|
||||
", stopMd5='" + stopMd5 + '\'' +
|
||||
", stopVer='" + stopVer + '\'' +
|
||||
", timestamp=" + timestamp +
|
||||
", wayPoints=" + wayPoints +
|
||||
", blackPoints=" + blackPoints +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String trajUrl;
|
||||
private String trajMd5;
|
||||
private String trajVer;
|
||||
private String stopUrl;
|
||||
private String stopMd5;
|
||||
private String stopVer;
|
||||
private Long timestamp;
|
||||
private List<VehicleSite> wayPoints;
|
||||
private List<VehicleSite> blackPoints;
|
||||
|
||||
public Builder id(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder trajUrl(String trajUrl) {
|
||||
this.trajUrl = trajUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder trajMd5(String trajMd5) {
|
||||
this.trajMd5 = trajMd5;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder trajVer(String trajVer) {
|
||||
this.trajVer = trajVer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder stopUrl(String stopUrl) {
|
||||
this.stopUrl = stopUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder stopMd5(String stopMd5) {
|
||||
this.stopMd5 = stopMd5;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder stopVer(String stopVer) {
|
||||
this.stopVer = stopVer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder timestamp(Long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder wayPoints(List<VehicleSite> wayPoints) {
|
||||
this.wayPoints = wayPoints;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder blackPoints(List<VehicleSite> blackPoints) {
|
||||
this.blackPoints = blackPoints;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Trajectory build() {
|
||||
return new Trajectory(id, name, trajUrl, trajMd5, trajVer, stopUrl, stopMd5, stopVer, timestamp, wayPoints, blackPoints);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
|
||||
|
||||
/**
|
||||
* 车辆站点
|
||||
*/
|
||||
public class VehicleSite {
|
||||
/**
|
||||
* 坐标类型
|
||||
*/
|
||||
private Integer coordinateType;
|
||||
/**
|
||||
* 坐标点
|
||||
*/
|
||||
private AutopilotPoint point;
|
||||
/**
|
||||
* 站点类型
|
||||
*/
|
||||
private Integer station;
|
||||
/**
|
||||
* 站点ID
|
||||
*/
|
||||
private Long stationId;
|
||||
/**
|
||||
* 站点名称
|
||||
*/
|
||||
private String stationName;
|
||||
/**
|
||||
* 站点序号
|
||||
*/
|
||||
private Integer stationSeq;
|
||||
|
||||
/**
|
||||
* 是否临时不停靠
|
||||
* 1:正常停靠 2:临时不停靠
|
||||
*/
|
||||
private Integer tag = 1;
|
||||
|
||||
|
||||
public VehicleSite() {
|
||||
}
|
||||
|
||||
public VehicleSite(Integer coordinateType, AutopilotPoint point, Integer station, Long stationId, String stationName, Integer stationSeq, Integer tag) {
|
||||
this.coordinateType = coordinateType;
|
||||
this.point = point;
|
||||
this.station = station;
|
||||
this.stationId = stationId;
|
||||
this.stationName = stationName;
|
||||
this.stationSeq = stationSeq;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public Integer getCoordinateType() {
|
||||
return coordinateType;
|
||||
}
|
||||
|
||||
public void setCoordinateType(Integer coordinateType) {
|
||||
this.coordinateType = coordinateType;
|
||||
}
|
||||
|
||||
public AutopilotPoint getPoint() {
|
||||
return point;
|
||||
}
|
||||
|
||||
public void setPoint(AutopilotPoint point) {
|
||||
this.point = point;
|
||||
}
|
||||
|
||||
public Integer getStation() {
|
||||
return station;
|
||||
}
|
||||
|
||||
public void setStation(Integer station) {
|
||||
this.station = station;
|
||||
}
|
||||
|
||||
public Long getStationId() {
|
||||
return stationId;
|
||||
}
|
||||
|
||||
public void setStationId(Long stationId) {
|
||||
this.stationId = stationId;
|
||||
}
|
||||
|
||||
public String getStationName() {
|
||||
return stationName;
|
||||
}
|
||||
|
||||
public void setStationName(String stationName) {
|
||||
this.stationName = stationName;
|
||||
}
|
||||
|
||||
public Integer getStationSeq() {
|
||||
return stationSeq;
|
||||
}
|
||||
|
||||
public void setStationSeq(Integer stationSeq) {
|
||||
this.stationSeq = stationSeq;
|
||||
}
|
||||
|
||||
public Integer getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void setTag(Integer tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VehicleSite{" +
|
||||
"coordinateType=" + coordinateType +
|
||||
", point=" + point +
|
||||
", station=" + station +
|
||||
", stationId=" + stationId +
|
||||
", stationName='" + stationName + '\'' +
|
||||
", stationSeq=" + stationSeq +
|
||||
", tag=" + tag +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private Integer coordinateType;
|
||||
private AutopilotPoint point;
|
||||
private Integer station;
|
||||
private Long stationId;
|
||||
private String stationName;
|
||||
private Integer stationSeq;
|
||||
private Integer tag = 1;
|
||||
|
||||
public Builder coordinateType(Integer coordinateType) {
|
||||
this.coordinateType = coordinateType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder point(AutopilotPoint point) {
|
||||
this.point = point;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder station(Integer station) {
|
||||
this.station = station;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder stationId(Long stationId) {
|
||||
this.stationId = stationId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder stationName(String stationName) {
|
||||
this.stationName = stationName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder stationSeq(Integer stationSeq) {
|
||||
this.stationSeq = stationSeq;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder tag(Integer tag) {
|
||||
this.tag = tag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public VehicleSite build() {
|
||||
return new VehicleSite(coordinateType, point, station, stationId, stationName, stationSeq, tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.enums;
|
||||
|
||||
public enum AutopilotCoordinateTypeEnum {
|
||||
WGS84(0,"WGS84"),GCJ02(1,"GCJ02"),UTM(2,"UTM");
|
||||
private int code;
|
||||
private String desc;
|
||||
|
||||
private AutopilotCoordinateTypeEnum(int code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public static AutopilotCoordinateTypeEnum codeOf(Integer code) {
|
||||
for(AutopilotCoordinateTypeEnum typeEnum : AutopilotCoordinateTypeEnum.values()) {
|
||||
if (code == typeEnum.code){
|
||||
return typeEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.enums;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public enum MessageCmdEnum {
|
||||
|
||||
AutopilotStartRequest("AutopilotStartRequest", "APP开始任务"),
|
||||
|
||||
TaskContinueNotification("TaskContinueNotification", "站点出发"),
|
||||
TaskFinishNotification("TaskFinishNotification", "任务完成"),
|
||||
TaskLocationQueryRequest("TaskLocationQueryRequest", "任务查询"),
|
||||
TaskStartNotification("TaskStartNotification", "自驾/离站结果回执"),
|
||||
TaskArrivalNotification("TaskArrivalNotification", "到站通知"),
|
||||
TaskAbortNotification("TaskAbortNotification", "任务终止"),
|
||||
TaskLocationQueryResponse("TaskLocationQueryResponse", "任务查询结果"),
|
||||
TaskCancelRequest("TaskCancelRequest", "任务取消请求"),
|
||||
TaskCancelResponse("TaskCancelResponse", "任务取消请求"),
|
||||
TaskQueryStateRequest("TaskQueryStateRequest", "任务状态查询"),
|
||||
TaskQueryStateResponse("TaskQueryStateResponse", "任务状态查询响应"),
|
||||
;
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
private MessageCmdEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
public static MessageCmdEnum codeOf(@Nullable String code) {
|
||||
if (TextUtils.isEmpty(code)) return null;
|
||||
for (MessageCmdEnum typeEnum : MessageCmdEnum.values()) {
|
||||
if (code.equals(typeEnum.code)) {
|
||||
return typeEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.enums;
|
||||
|
||||
public enum RouteTypeEnum {
|
||||
SiteRoute(0, "多站点模式"),
|
||||
LineRoute(1, "路线模式");
|
||||
|
||||
private int code;
|
||||
private String desc;
|
||||
|
||||
private RouteTypeEnum(int code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public static RouteTypeEnum codeOf(Integer code) {
|
||||
for (RouteTypeEnum typeEnum : RouteTypeEnum.values()) {
|
||||
if (code == typeEnum.code) {
|
||||
return typeEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.enums;
|
||||
|
||||
public enum StationEnum {
|
||||
SITE(0,"业务站点"),WAY(1,"途径点");
|
||||
private int code;
|
||||
private String desc;
|
||||
|
||||
private StationEnum(int code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public static StationEnum codeOf(Integer code) {
|
||||
for(StationEnum typeEnum : StationEnum.values()) {
|
||||
if (code == typeEnum.code){
|
||||
return typeEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.enums;
|
||||
|
||||
|
||||
public enum TaskStatusEnum {
|
||||
|
||||
INIT(0), START(10), CANCEL_ING(90), COMPLETE(100), FAIL(110), CANCEL(120);
|
||||
|
||||
private int code;
|
||||
|
||||
private TaskStatusEnum(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public static TaskStatusEnum codeOf(Integer code) {
|
||||
for (TaskStatusEnum typeEnum : TaskStatusEnum.values()) {
|
||||
if (code == typeEnum.code) {
|
||||
return typeEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ syntax = "proto3";
|
||||
package mogo.telematics.pad;
|
||||
|
||||
import "geometry.proto";
|
||||
import "header.proto";
|
||||
|
||||
enum ProtocolVersion
|
||||
{
|
||||
@@ -114,6 +115,7 @@ enum MessageType
|
||||
MsgTypeObuUploadStatus = 0x1013A;//obu上报状态查询以结果(上下行)
|
||||
MsgTypePlanningStopLine = 0x1013B;//决策停止线(自动驾驶决策呈现使用) 定频,理论是10hz,实际会有不同
|
||||
MsgTypeFsmEvent = 0x1013C;//fsm event msg
|
||||
MsgTypeTaskMgrAndPad = 0x10142; //鹰眼和任务管理之间的消息透传
|
||||
}
|
||||
|
||||
message Header
|
||||
@@ -1068,3 +1070,6 @@ message SetEnableReq
|
||||
{
|
||||
uint32 enable = 1; //1: enable, 0: disable
|
||||
}
|
||||
|
||||
// message definition for MessageType: MsgTypeTaskMgrAndPad
|
||||
//bytes
|
||||
|
||||
@@ -94,6 +94,8 @@
|
||||
<string name="adas_data_MsgTypeObuUploadStatus_RECEIVE">Domain control OBU upload status response</string>
|
||||
<string name="adas_data_MsgTypePlanningStopLine">Planning Stop Line</string>
|
||||
<string name="adas_data_MsgTypeFsmEvent">FSM Event</string>
|
||||
<string name="adas_data_MsgTypeTaskMgrAndPad_SEND">Send Task Management Message</string>
|
||||
<string name="adas_data_MsgTypeTaskMgrAndPad_RECEIVE">Receive Task Management Message</string>
|
||||
<string name="adas_data_MsgTypePlanningDecisionState">Planning decision state</string>
|
||||
<string name="adas_data_MsgTypeSweeperTaskIndexData">Sweeper index data</string>
|
||||
<string name="adas_data_MsgTypeObuWarningData">OBU warning event</string>
|
||||
|
||||
@@ -94,6 +94,8 @@
|
||||
<string name="adas_data_MsgTypeObuUploadStatus_RECEIVE">域控上报OBU开关状态响应</string>
|
||||
<string name="adas_data_MsgTypePlanningStopLine">决策停止线</string>
|
||||
<string name="adas_data_MsgTypeFsmEvent">FSM事件</string>
|
||||
<string name="adas_data_MsgTypeTaskMgrAndPad_SEND">发送任任务管理消息</string>
|
||||
<string name="adas_data_MsgTypeTaskMgrAndPad_RECEIVE">接收任务管理消息</string>
|
||||
<string name="adas_data_MsgTypePlanningDecisionState">Planning决策状态</string>
|
||||
<string name="adas_data_MsgTypeSweeperTaskIndexData">清扫车指标数据</string>
|
||||
<string name="adas_data_MsgTypeObuWarningData">OBU预警事件</string>
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.zhidao.support.adas.high.common.CertificateUtils;
|
||||
import com.zhidao.support.adas.high.common.Constants;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.common.Define;
|
||||
import com.zhidao.support.adas.high.common.JsonUtil;
|
||||
import com.zhidao.support.adas.high.common.ParallelDrivingManager;
|
||||
import com.zhidao.support.adas.high.common.PingAddressHelper;
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus;
|
||||
@@ -60,9 +61,22 @@ import com.zhjt.mogo.adas.data.sweeper.task.cloud.s_r.SweeperTaskCloudSuspendRes
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.confirm.SweeperTaskConfirm;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.AutopilotPoint;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.AutopilotStartRequest;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.CmdDto;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskContinueNotification;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.Trajectory;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.VehicleSite;
|
||||
import com.zhjt.mogo.adas.unmanned.task.enums.AutopilotCoordinateTypeEnum;
|
||||
import com.zhjt.mogo.adas.unmanned.task.enums.MessageCmdEnum;
|
||||
import com.zhjt.mogo.adas.unmanned.task.enums.RouteTypeEnum;
|
||||
import com.zhjt.mogo.adas.unmanned.task.enums.StationEnum;
|
||||
import com.zhjt.mogo.adas.utils.ByteUtil;
|
||||
import com.zhjt.service.chain.ChainLog;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -3143,6 +3157,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
|
||||
/**
|
||||
* 查询OTA2.0状态
|
||||
*
|
||||
* @param queryStr 域控发送OTA升级请求中的 {"cmd":"PAD_QUERY_UPGRADE_STATUS","token":"123"}
|
||||
* @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID
|
||||
* * >=0:表示添加到WS发送消息队列
|
||||
@@ -3375,5 +3390,65 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
public long sendImgUploadCloudStatusQuery() {
|
||||
return sendPBMessage(MessageType.TYPE_SEND_IMG_UPLOAD_CLOUD_STATUS_QUERY, null);
|
||||
}
|
||||
|
||||
private <T> long sendTaskManager(T data) {
|
||||
// MessagePad.TaskManager.Builder builder = MessagePad.TaskManager
|
||||
// .newBuilder()
|
||||
// .setTaskData(com.google.protobuf.ByteString.copyFrom(JsonUtil.toJsonBase64(data).getBytes(StandardCharsets.UTF_8)));
|
||||
// return sendPBMessage(MessageType.TYPE_SEND_TASK_MANAGER, builder.build().toByteArray());
|
||||
return sendPBMessage(MessageType.TYPE_SEND_TASK_MANAGER, JsonUtil.toJsonBase64(data).getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
/**
|
||||
* 向任务管理发送启动自驾命令
|
||||
*
|
||||
* @param taskId 任务ID, 同原接口的orderid, 首次和头部校验
|
||||
* @param traj 轨迹信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public long sendTaskManagerAutopilotStart(Long taskId, Trajectory traj) {
|
||||
AutopilotStartRequest autopilotStartRequest = AutopilotStartRequest.builder()
|
||||
.taskId(taskId).source(1).traj(traj).taskType(RouteTypeEnum.LineRoute.getCode()).build();
|
||||
|
||||
CmdDto<AutopilotStartRequest> cmdDto = CmdDto.<AutopilotStartRequest>builder().cmdType(MessageCmdEnum.AutopilotStartRequest.getCode()).taskId(taskId)
|
||||
.lineId(traj.getId()).timestamp(System.currentTimeMillis()).data(autopilotStartRequest).build();
|
||||
return sendTaskManager(cmdDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 向任务管理发送继续自驾命令
|
||||
*
|
||||
* @param trackId
|
||||
* @param taskId
|
||||
* @param stationId
|
||||
* @param stationName
|
||||
* @param stationSeq
|
||||
* @param lon
|
||||
* @param lat
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public long sendTaskManagerAutopilotContinue(Long trackId, Long taskId, Long stationId, String stationName, Integer stationSeq, double lon, double lat) {
|
||||
VehicleSite vehicleSite = VehicleSite.builder().stationId(stationId).stationName(stationName)
|
||||
.station(StationEnum.SITE.getCode()).stationSeq(stationSeq)
|
||||
.point(AutopilotPoint.builder().x(lon).y(lat).build()).coordinateType(AutopilotCoordinateTypeEnum.WGS84.getCode()).build();
|
||||
TaskContinueNotification taskContinueNotification = TaskContinueNotification.builder().curStation(vehicleSite).build();
|
||||
CmdDto<TaskContinueNotification> cmdDto = CmdDto.<TaskContinueNotification>builder().cmdType(MessageCmdEnum.TaskContinueNotification.getCode()).taskId(taskId).lineId(trackId).timestamp(System.currentTimeMillis()).data(taskContinueNotification).build();
|
||||
return sendTaskManager(cmdDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 向任务管理发送取消自驾命令
|
||||
*
|
||||
* @param taskId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public long sendTaskManagerAutopilotCancel(Long taskId) {
|
||||
CmdDto<JSONObject> cmdDto = CmdDto.<JSONObject>builder().cmdType(MessageCmdEnum.TaskCancelRequest.getCode()).taskId(taskId)
|
||||
.lineId(0L).timestamp(System.currentTimeMillis()).data(new JSONObject()).build();
|
||||
return sendTaskManager(cmdDto);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.cloud.s_r.SweeperTaskCloudSuspendRes
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.confirm.SweeperTaskConfirm;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.Trajectory;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -1883,6 +1884,7 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
|
||||
/**
|
||||
* OTA2.0 请求命令下发
|
||||
*
|
||||
* @param queryStr {"cmd":"PAD_QUERY_UPGRADE_STATUS","token":"123"} JSON
|
||||
* @return
|
||||
*/
|
||||
@@ -2085,6 +2087,21 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
return mChannel == null ? -1L : mChannel.sendImgUploadCloudStatusQuery();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long sendTaskManagerAutopilotStart(Long taskId, Trajectory traj) {
|
||||
return mChannel == null ? -1L : mChannel.sendTaskManagerAutopilotStart(taskId, traj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long sendTaskManagerAutopilotContinue(Long trackId, Long taskId, Long stationId, String stationName, Integer stationSeq, double lon, double lat) {
|
||||
return mChannel == null ? -1L : mChannel.sendTaskManagerAutopilotContinue(trackId, taskId, stationId, stationName, stationSeq, lon, lat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long sendTaskManagerAutopilotCancel(Long taskId) {
|
||||
return mChannel == null ? -1L : mChannel.sendTaskManagerAutopilotCancel(taskId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询节点状态
|
||||
*
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.cloud.s_r.SweeperTaskCloudSuspendRes
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.confirm.SweeperTaskConfirm;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.Trajectory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -1375,6 +1376,7 @@ public interface IAdasNetCommApi {
|
||||
|
||||
/**
|
||||
* OTA2.0查询
|
||||
*
|
||||
* @param queryStr {"cmd":"PAD_QUERY_UPGRADE_STATUS","token":"123"} JSON
|
||||
*/
|
||||
long sendOtaPadMsgQuery(@Nullable String queryStr);
|
||||
@@ -1534,6 +1536,12 @@ public interface IAdasNetCommApi {
|
||||
*/
|
||||
long sendImgUploadCloudStatusQuery();
|
||||
|
||||
long sendTaskManagerAutopilotStart(Long taskId, Trajectory traj);
|
||||
|
||||
long sendTaskManagerAutopilotContinue(Long trackId, Long taskId, Long stationId, String stationName, Integer stationSeq, double lon, double lat);
|
||||
|
||||
long sendTaskManagerAutopilotCancel(Long taskId);
|
||||
|
||||
/**
|
||||
* 向工控机发送数据
|
||||
*
|
||||
|
||||
@@ -34,7 +34,9 @@ import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.status.SweeperTaskStatus;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
import bag_manager.BagManagerOuterClass;
|
||||
import chassis.Chassis;
|
||||
@@ -795,6 +797,48 @@ public interface OnAdasListener {
|
||||
*/
|
||||
void onPlanningStopLine(@NonNull MessagePad.Header header, @NonNull Hadmap.MapMsg mapMsg);
|
||||
|
||||
/**
|
||||
* 域控任务管理原始数据
|
||||
*
|
||||
* @param header 头
|
||||
* @param data 数据
|
||||
*/
|
||||
void onAdasTaskManagerOriginal(@NonNull MessagePad.Header header, @NonNull byte[] data);
|
||||
|
||||
/**
|
||||
* 域控任务管理离站通知
|
||||
*
|
||||
* @param taskId
|
||||
* @param siteId
|
||||
* @param sequence
|
||||
* @param ack
|
||||
* @param reason
|
||||
* @param stationTimeLeft
|
||||
*/
|
||||
void onAdasTaskManagerDeparture(Long taskId, Long siteId, Integer sequence, boolean ack, String reason, double stationTimeLeft);
|
||||
|
||||
/**
|
||||
* 域控任务管理到站通知
|
||||
*
|
||||
* @param taskId 任务ID, 同原接口的orderid, 首次和头部校验
|
||||
* @param siteId 站点编号,对应云平台固定值
|
||||
* @param sequence 站点序号,对应顺序列表里站点流程,从1开始,1为起始点,最大值为终点。 途径点填写0
|
||||
* @param mileage 任务全程的已经行进的里程
|
||||
*/
|
||||
void onAdasTaskManagerArrival(Long taskId, Long siteId, Integer sequence, BigDecimal mileage);
|
||||
|
||||
/**
|
||||
* 域控任务管理终止任务
|
||||
*
|
||||
* @param taskId
|
||||
* @param userId
|
||||
* @param status
|
||||
* @param reason
|
||||
* @param completedTime
|
||||
* @param mileage
|
||||
*/
|
||||
void onAdasTaskManagerComplete(Long taskId, Long userId, Integer status, String reason, Date completedTime, BigDecimal mileage);
|
||||
|
||||
/**
|
||||
* 是否有能力启动自动驾驶
|
||||
*
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.zhidao.support.adas.high.common;
|
||||
|
||||
import android.util.Base64;
|
||||
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonToken;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ByteArrayToBase64TypeAdapter extends TypeAdapter<byte[]> {
|
||||
|
||||
@Override
|
||||
public void write(JsonWriter writer, byte[] value) throws IOException {
|
||||
if (value == null) {
|
||||
writer.nullValue();
|
||||
return;
|
||||
}
|
||||
// 将 byte[] 编码为 Base64 字符串并写入JSON
|
||||
String base64 = Base64.encodeToString(value, Base64.NO_WRAP);
|
||||
writer.value(base64);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] read(JsonReader reader) throws IOException {
|
||||
if (reader.peek() == JsonToken.NULL) {
|
||||
reader.nextNull();
|
||||
return null;
|
||||
}
|
||||
// 从JSON中读取字符串,并将其从 Base64 解码回 byte[]
|
||||
String base64 = reader.nextString();
|
||||
return Base64.decode(base64, Base64.NO_WRAP);
|
||||
}
|
||||
}
|
||||
@@ -1,66 +1,62 @@
|
||||
package com.zhidao.support.adas.high.common;
|
||||
|
||||
import android.util.Base64;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* Java对象和JSON字符串相互转化工具类
|
||||
* 格式化
|
||||
*
|
||||
* @author xfk
|
||||
*/
|
||||
public final class JsonUtil {
|
||||
|
||||
// 1. 预先创建单例,避免重复 new 对象带来的开销
|
||||
private static final Gson COMMON_GSON = new GsonBuilder()
|
||||
.setDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||
.create();
|
||||
|
||||
private static final Gson NULL_SERIALIZE_GSON = new GsonBuilder()
|
||||
.setDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||
.serializeNulls()
|
||||
.create();
|
||||
|
||||
private JsonUtil() {
|
||||
// 私有构造函数,防止被实例化
|
||||
}
|
||||
|
||||
/**
|
||||
* 对象转换成json字符串
|
||||
*
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
public static String toJson(Object obj) {
|
||||
|
||||
return toJson(false, obj);
|
||||
}
|
||||
|
||||
public static String toJsonBase64(Object obj) {
|
||||
String value = toJson(false, obj);
|
||||
return Base64.encodeToString(value.getBytes(StandardCharsets.UTF_8), Base64.NO_WRAP);
|
||||
}
|
||||
|
||||
public static String toJson(boolean isSerializeNulls, Object obj) {
|
||||
Gson gson;
|
||||
if (isSerializeNulls) {
|
||||
GsonBuilder gsonBuilder = new GsonBuilder();
|
||||
gsonBuilder.serializeNulls(); //重点
|
||||
gson = gsonBuilder.create();
|
||||
} else {
|
||||
gson = new Gson();
|
||||
}
|
||||
return gson.toJson(obj);
|
||||
if (obj == null) return null;
|
||||
return isSerializeNulls ? NULL_SERIALIZE_GSON.toJson(obj) : COMMON_GSON.toJson(obj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* json字符串转成对象
|
||||
*
|
||||
* @param str
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
public static <T> T fromJson(String str, Type type) {
|
||||
Gson gson = new Gson();
|
||||
return gson.fromJson(str, type);
|
||||
if (isEmpty(str)) return null;
|
||||
return COMMON_GSON.fromJson(str, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* json字符串转成对象
|
||||
*
|
||||
* @param str
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
public static <T> T fromJson(String str, Class<T> type) {
|
||||
Gson gson = new Gson();
|
||||
return gson.fromJson(str, type);
|
||||
if (isEmpty(str)) return null;
|
||||
return COMMON_GSON.fromJson(str, type);
|
||||
}
|
||||
|
||||
public static <T> T fromJson(JsonElement object, Class<T> type) {
|
||||
if (object == null) return null;
|
||||
return COMMON_GSON.fromJson(object, type);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private static boolean isEmpty(String str) {
|
||||
return str == null || str.trim().isEmpty();
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,7 @@ public class MyMessageFactory implements IMyMessageFactory {
|
||||
private IMsg obuUploadStatusMessage;//域控上报OBU开关状态响应
|
||||
private IMsg planningStopLineMessage;//决策停止线
|
||||
private IMsg fSMEventMessage;//FSM事件
|
||||
private IMsg taskMgrAndPadMessage;//任务管理消息
|
||||
|
||||
private final AutopilotReview autopilotReview;
|
||||
private final TurnLightState lightLeft = new TurnLightState();
|
||||
@@ -382,11 +383,17 @@ public class MyMessageFactory implements IMyMessageFactory {
|
||||
}
|
||||
return planningStopLineMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_FSM_EVENT.typeCode) {
|
||||
//决策停止线
|
||||
//FSM事件
|
||||
if (fSMEventMessage == null) {
|
||||
fSMEventMessage = new FSMEventMessage();
|
||||
}
|
||||
return fSMEventMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_TASK_MANAGER.typeCode) {
|
||||
//任务管理消息
|
||||
if (taskMgrAndPadMessage == null) {
|
||||
taskMgrAndPadMessage = new TaskManagerMessage();
|
||||
}
|
||||
return taskMgrAndPadMessage;
|
||||
} else {
|
||||
//MessageType.TYPE_DEFAULT.typeCode
|
||||
return null;
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.AdasChannel;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.common.JsonUtil;
|
||||
import com.zhidao.support.adas.high.protocol.RawData;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.CmdDto;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskAbortNotification;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskArrivalNotification;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskLocationQueryResponse;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskStartNotification;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.VehicleSite;
|
||||
import com.zhjt.mogo.adas.unmanned.task.enums.MessageCmdEnum;
|
||||
import com.zhjt.mogo.adas.unmanned.task.enums.TaskStatusEnum;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 任务管理消息
|
||||
*/
|
||||
public class TaskManagerMessage extends MyAbstractMessageHandler {
|
||||
private static final String TAG = TaskManagerMessage.class.getSimpleName();
|
||||
|
||||
public TaskManagerMessage() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
int len = raw.getPackageLengthValue() - raw.getOffsetValue();
|
||||
byte[] data = new byte[len];
|
||||
System.arraycopy(raw.originalData.toByteArray(), raw.getOffsetValue(), data, 0, len);
|
||||
|
||||
AdasChannel.calculateTimeConsumingOnDispatchRaw("任务管理消息", raw.receiveTime);
|
||||
long nowTime = 0;
|
||||
if (CupidLogUtils.isEnableLog())
|
||||
nowTime = SystemClock.elapsedRealtime();
|
||||
if (adasListener != null) {
|
||||
adasListener.onAdasTaskManagerOriginal(raw.getHeader(), data);
|
||||
parse(adasListener, new String(data, StandardCharsets.UTF_8));
|
||||
}
|
||||
AdasChannel.calculateTimeConsumingBusiness("任务管理消息", nowTime);
|
||||
}
|
||||
|
||||
private void parse(OnAdasListener adasListener, String data) {
|
||||
Log.i(TAG, "任务管理接收原始数据=" + data);
|
||||
|
||||
JsonObject jsonObject = JsonParser.parseString(data).getAsJsonObject();
|
||||
String cmdType = jsonObject.get("cmdType").getAsString();
|
||||
MessageCmdEnum messageCmdEnum = MessageCmdEnum.codeOf(cmdType);
|
||||
if (messageCmdEnum == MessageCmdEnum.TaskStartNotification) {//自驾/离站结果回执
|
||||
CmdDto<TaskStartNotification> cmdDto = JsonUtil.fromJson(data, new TypeToken<CmdDto<TaskStartNotification>>() {
|
||||
}.getType());
|
||||
if (cmdDto != null) {
|
||||
Log.i(TAG, "onAdasTaskManagerDeparture=" + cmdDto);
|
||||
TaskStartNotification taskStartNotification = cmdDto.getData();
|
||||
|
||||
VehicleSite vehicleSite = taskStartNotification.getCurLocation();
|
||||
adasListener.onAdasTaskManagerDeparture(cmdDto.getTaskId(), vehicleSite.getStationId(), vehicleSite.getStationSeq(), taskStartNotification.isAutopilotResult(), taskStartNotification.getErrMsg(), taskStartNotification.getStationTimeLeft());
|
||||
}
|
||||
|
||||
} else if (messageCmdEnum == MessageCmdEnum.TaskArrivalNotification) {//到站通知
|
||||
CmdDto<TaskArrivalNotification> cmdDto = JsonUtil.fromJson(data, new TypeToken<CmdDto<TaskArrivalNotification>>() {
|
||||
}.getType());
|
||||
if (cmdDto != null) {
|
||||
Log.i(TAG, "onAdasTaskManagerArrival=" + cmdDto);
|
||||
TaskArrivalNotification taskArrivalNotification = cmdDto.getData();
|
||||
VehicleSite vehicleSite = taskArrivalNotification.getCurLocation();
|
||||
adasListener.onAdasTaskManagerArrival(cmdDto.getTaskId(), vehicleSite.getStationId(), vehicleSite.getStationSeq(), BigDecimal.valueOf(taskArrivalNotification.getAccumulatedTaskDis()));
|
||||
}
|
||||
|
||||
} else if (messageCmdEnum == MessageCmdEnum.TaskAbortNotification) {//终止任务
|
||||
CmdDto<TaskAbortNotification> cmdDto = JsonUtil.fromJson(data, new TypeToken<CmdDto<TaskAbortNotification>>() {
|
||||
}.getType());
|
||||
if (cmdDto != null) {
|
||||
Log.i(TAG, "onAdasTaskManagerComplete=" + cmdDto);
|
||||
TaskAbortNotification taskAbortNotification = cmdDto.getData();
|
||||
Log.i(TAG, "onAdasTaskManagerComplete=" + taskAbortNotification);
|
||||
VehicleSite vehicleSite = taskAbortNotification.getCurLocation();
|
||||
adasListener.onAdasTaskManagerComplete(cmdDto.getTaskId(), null, TaskStatusEnum.CANCEL.getCode(), taskAbortNotification.getErrMsg(), new Date(), BigDecimal.valueOf(taskAbortNotification.getAccumulatedTaskDis()));
|
||||
}
|
||||
|
||||
} else if (messageCmdEnum == MessageCmdEnum.TaskLocationQueryResponse) {//任务查询结果
|
||||
CmdDto<TaskLocationQueryResponse> cmdDto = JsonUtil.fromJson(data, new TypeToken<CmdDto<TaskLocationQueryResponse>>() {
|
||||
}.getType());
|
||||
if (cmdDto != null) {
|
||||
Log.i(TAG, "onAdasTaskLocationQueryResponse=" + cmdDto);
|
||||
TaskLocationQueryResponse taskLocationQueryResponse = cmdDto.getData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user