[change] 添加状态查询请求和添加状态查询应答
This commit is contained in:
@@ -38,6 +38,8 @@ enum MessageType
|
||||
MsgTypeArrivalNotification = 0x1010e; //到站提醒
|
||||
MsgTypeSystemCmdReq = 0x1010f; //系统命令请求, 比如系统重启,启用新镜像
|
||||
MsgTypeTrajectoryDownloadReq = 0x10110; //轨迹下载请求
|
||||
MsgTypeStatusQueryReq = 0x10111; //状态查询请求
|
||||
MsgTypeStatusQueryResp = 0x10112; //状态查询应答
|
||||
}
|
||||
|
||||
message Header
|
||||
@@ -327,12 +329,13 @@ message SystemCmdReq
|
||||
SystemCmdType cmdType = 1; //
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// message definition for MsgTypeStatusQueryReq
|
||||
message StatusQueryReq
|
||||
{
|
||||
}
|
||||
|
||||
// message definition for MsgTypeStatusQueryResp
|
||||
// refer to system_status_info.proto
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package system_master;
|
||||
|
||||
enum SystemState {
|
||||
SYS_STARTING = 0;
|
||||
SYS_RUNNING = 1;
|
||||
SYS_EXITING = 2;
|
||||
SYS_FAULT = 3;
|
||||
PILOT_READY = 4;
|
||||
AUTO_PILOT_STARTING = 5;
|
||||
AUTO_PILOT_RUNNING = 6;
|
||||
REMOTE_PILOT_STARTING = 7;
|
||||
REMOTE_PILOT_RUNNING = 8;
|
||||
}
|
||||
|
||||
enum HealthState {
|
||||
NORMAL = 0;
|
||||
FAULT = 1;
|
||||
UNKNOW = 2;
|
||||
}
|
||||
|
||||
message HealthInfo{
|
||||
required string name = 1; //node name
|
||||
required HealthState state = 2; //health state
|
||||
optional string code = 3; //code 与系统事件错误码对应,如有该错误填写,没有不填
|
||||
optional string desc = 4; //补充描述,用于未知情况
|
||||
}
|
||||
|
||||
message TopicInfo{
|
||||
optional string name = 1; //topic name
|
||||
optional int32 hz = 2;
|
||||
// optional int32 max_delay = 3; //unit: msec
|
||||
}
|
||||
|
||||
message DropTopic{
|
||||
required int32 sum = 1; //dropped topic sum
|
||||
repeated TopicInfo topic = 2;
|
||||
}
|
||||
|
||||
|
||||
message StatusInfo {
|
||||
required SystemState sys_state=1; // 当前消息状态
|
||||
repeated HealthInfo health_info=2; // 健康检查状态信息
|
||||
optional DropTopic topic_drop_info=3; // topic 掉频信息, 如有掉频添加没有不添加
|
||||
optional string reserved = 4; // 预留可选字段,用于接口扩充或者,其他信息补充
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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列表
|
||||
*
|
||||
|
||||
@@ -188,6 +188,13 @@ public interface IAdasNetCommApi {
|
||||
*/
|
||||
boolean sendTrajectoryDownloadReq(MessagePad.Line line);
|
||||
|
||||
/**
|
||||
* 发送 状态查询请求
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendStatusQueryReq();
|
||||
|
||||
// TODO 需求暂停 待讨论
|
||||
// boolean getRoutes();
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
* 数据错误
|
||||
*
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user