[change] 添加状态查询请求和添加状态查询应答

This commit is contained in:
xinfengkun
2022-06-08 23:49:23 +08:00
parent 3b6815be18
commit 9bf94a9765
15 changed files with 229 additions and 82 deletions

View File

@@ -862,5 +862,18 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
MessagePad.TrajectoryDownloadReq req = builder.build();
return sendWsMessage(MessageType.TYPE_SEND_TRAJECTORY_DOWNLOAD_REQ.typeCode, req.toByteArray());
}
/**
* 发送 状态查询请求
*
* @return boolean
*/
@Override
public boolean sendStatusQueryReq() {
MessagePad.StatusQueryReq req = MessagePad.StatusQueryReq
.newBuilder()
.build();
return sendWsMessage(MessageType.TYPE_SEND_STATUS_QUERY_REQ.typeCode, req.toByteArray());
}
}

View File

@@ -406,6 +406,16 @@ public class AdasManager implements IAdasNetCommApi {
return mChannel != null && mChannel.sendTrajectoryDownloadReq(line);
}
/**
* 发送 状态查询请求
*
* @return boolean
*/
@Override
public boolean sendStatusQueryReq() {
return mChannel != null && mChannel.sendStatusQueryReq();
}
/**
* 获取工控机固定IP列表
*

View File

@@ -188,6 +188,13 @@ public interface IAdasNetCommApi {
*/
boolean sendTrajectoryDownloadReq(MessagePad.Line line);
/**
* 发送 状态查询请求
*
* @return boolean
*/
boolean sendStatusQueryReq();
// TODO 需求暂停 待讨论
// boolean getRoutes();

View File

@@ -9,6 +9,7 @@ import perception.TrafficLightOuterClass;
import prediction.Prediction;
import record_cache.RecordPanelOuterClass;
import rule_segement.MogoPointCloudOuterClass;
import system_master.SystemStatusInfo;
/**
* @ProjectName: lib-adas-fpga
@@ -155,6 +156,14 @@ public interface OnAdasListener {
*/
void onArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification arrivalNotification);
/**
* 状态查询应答
*
* @param header 头
* @param statusInfo 数据
*/
void onStatusQueryResp(MessagePad.Header header, SystemStatusInfo.StatusInfo statusInfo);
/**
* 数据错误
*

View File

@@ -12,16 +12,16 @@ import mogo.telematics.pad.MessagePad;
public enum MessageType {
TYPE_DEFAULT(MessagePad.MessageType.MsgTypeDefault, "默认"),
TYPE_RECEIVE_TRAJECTORY(MessagePad.MessageType.MsgTypeTrajectory, "局部轨迹,车前引导线"),
TYPE_RECEIVE_TRAJECTORY(MessagePad.MessageType.MsgTypeTrajectory, "车前引导线"),
TYPE_RECEIVE_TRACKED_OBJECTS(MessagePad.MessageType.MsgTypeTrackedObjects, "障碍物信息"),
TYPE_RECEIVE_GNSS_INFO(MessagePad.MessageType.MsgTypeGnssInfo, "惯导信息"),
TYPE_RECEIVE_VEHICLE_STATE(MessagePad.MessageType.MsgTypeVehicleState, "底盘信息, 透传底盘状态pb参考底盘"),
TYPE_RECEIVE_VEHICLE_STATE(MessagePad.MessageType.MsgTypeVehicleState, "底盘信息"),
TYPE_RECEIVE_AUTOPILOT_STATE(MessagePad.MessageType.MsgTypeAutopilotState, "自动驾驶状态"),
TYPE_RECEIVE_REPORT_MESSAGE(MessagePad.MessageType.MsgTypeReportMessage, "监控事件报告"),
TYPE_RECEIVE_PERCEPTION_TRAFFIC_LIGHT(MessagePad.MessageType.MsgTypePerceptionTrafficLight, "感知红绿灯"),
TYPE_RECEIVE_PREDICTION_OBSTACLE_TRAJECTORY(MessagePad.MessageType.MsgTypePredictionObstacleTrajectory, "他车轨迹预测"),
TYPE_RECEIVE_POINT_CLOUD(MessagePad.MessageType.MsgTypePointCloud, "点云透传"),
TYPE_RECEIVE_PLANNING_OBJECTS(MessagePad.MessageType.MsgTypePlanningObjects, "planning障碍物"),
TYPE_RECEIVE_PLANNING_OBJECTS(MessagePad.MessageType.MsgTypePlanningObjects, "Planning障碍物"),
TYPE_RECEIVE_BASIC_INFO_REQ(MessagePad.MessageType.MsgTypeBasicInfoReq, "自动驾驶设备基础信息请求"),
TYPE_SEND_BASIC_INFO_RESP(MessagePad.MessageType.MsgTypeBasicInfoResp, "自动驾驶设备基础信息应答"),
@@ -40,7 +40,9 @@ public enum MessageType {
TYPE_RECEIVE_WARN(MessagePad.MessageType.MsgTypeWarn, "预警数据"),
TYPE_RECEIVE_ARRIVAL_NOTIFICATION(MessagePad.MessageType.MsgTypeArrivalNotification, "到站提醒"),
TYPE_SEND_SYSTEM_CMD_REQ(MessagePad.MessageType.MsgTypeSystemCmdReq, "系统命令请求, 比如系统重启,启用新镜像"),
TYPE_SEND_TRAJECTORY_DOWNLOAD_REQ(MessagePad.MessageType.MsgTypeTrajectoryDownloadReq, "轨迹下载请求");
TYPE_SEND_TRAJECTORY_DOWNLOAD_REQ(MessagePad.MessageType.MsgTypeTrajectoryDownloadReq, "轨迹下载请求"),
TYPE_SEND_STATUS_QUERY_REQ(MessagePad.MessageType.MsgTypeStatusQueryReq, "状态查询请求"),
TYPE_RECEIVE_STATUS_QUERY_RESP(MessagePad.MessageType.MsgTypeStatusQueryResp, "状态查询应答");
/**
* 消息action code

View File

@@ -28,6 +28,7 @@ public class MyMessageFactory implements IMyMessageFactory {
private IMsg globalPathRespMessage;//自动驾驶路径应答
private IMsg warnMessage;//预警数据
private IMsg arrivalNotificationMessage;//到站提醒
private IMsg statusQueryRespMessage;//状态查询应答
@Override
@@ -128,6 +129,12 @@ public class MyMessageFactory implements IMyMessageFactory {
arrivalNotificationMessage = new ArrivalNotificationMessage();
}
return arrivalNotificationMessage;
} else if (messageType == MessageType.TYPE_RECEIVE_STATUS_QUERY_RESP.typeCode) {
//状态查询应答
if (statusQueryRespMessage == null) {
statusQueryRespMessage = new StatusQueryRespMessage();
}
return statusQueryRespMessage;
} else {
//MessageType.TYPE_DEFAULT.typeCode
return null;

View File

@@ -0,0 +1,24 @@
package com.zhidao.support.adas.high.msg;
import com.google.protobuf.InvalidProtocolBufferException;
import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.protocol.RawData;
import mogo.telematics.pad.MessagePad;
import system_master.SystemStatusInfo;
/**
* 状态查询应答
*/
public class StatusQueryRespMessage extends MyAbstractMessageHandler {
@Override
public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException {
SystemStatusInfo.StatusInfo statusInfo= SystemStatusInfo.StatusInfo.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue());
if (adasListener != null) {
adasListener.onStatusQueryResp(raw.getHeader(), statusInfo);
}
// CupidLogUtils.e("状态查询应答--->" + statusInfo.toString());
}
}