提交 8e6442b3 编写于 作者: A Aaron Xiao 提交者: siyangy

Dreamview: Reuse monitor::HardwareStatus in HMIStatus. (#851)

上级 951c2c95
......@@ -22,9 +22,10 @@ namespace apollo {
namespace dreamview {
void HMIStatusHelper::ReportHardwareStatus(
const google::protobuf::Map<std::string, HardwareStatus> &hw_status) {
const std::string &hardware_name,
const monitor::HardwareStatus &hw_status) {
HMIStatus hmi_status;
*hmi_status.mutable_hardware() = hw_status;
hmi_status.mutable_hardware()->insert({hardware_name, hw_status});
common::adapter::AdapterManager::PublishHMIStatus(hmi_status);
}
......
......@@ -20,6 +20,7 @@
#include <string>
#include "modules/dreamview/proto/hmi_status.pb.h"
#include "modules/monitor/proto/hardware_status.pb.h"
/**
* @namespace apollo::dreamview
......@@ -38,15 +39,16 @@ class HMIStatusHelper {
public:
/*
* @brief Report hardware status to HMI.
* @param hw_status the map of hardware name and hardware status entries.
* @param hardware_name the name of the hardware.
* @param hw_status the status of the hardware.
*/
static void ReportHardwareStatus(
const google::protobuf::Map<std::string, HardwareStatus> &hw_status);
static void ReportHardwareStatus(const std::string &hardware_name,
const monitor::HardwareStatus &hw_status);
/*
* @brief Report module status to HMI.
* @param module_status the status of the module
* @param module_status the status of the module
* @param module_name the name of the module.
* @param module_status the status of the module.
*/
static void ReportModuleStatus(const std::string &module_name,
const ModuleStatus &module_status);
......
......@@ -38,4 +38,7 @@ cc_proto_library(
proto_library(
name = "hmi_status_proto_lib",
srcs = ["hmi_status.proto"],
deps = [
"//modules/monitor/proto:hardware_status_proto_lib",
]
)
......@@ -2,6 +2,8 @@ syntax = "proto2";
package apollo.dreamview;
import "modules/monitor/proto/hardware_status.proto";
message ModuleStatus {
enum Status {
UNINITIALIZED = 0;
......@@ -13,14 +15,9 @@ message ModuleStatus {
optional Status status = 1 [default = UNINITIALIZED];
}
message HardwareStatus {
// Defined in modules/monitor/common/interface/hw_status.h.
optional int32 status = 1 [default = -1];
}
message HMIStatus {
optional string current_map = 1;
optional string current_vehicle = 2;
map<string, ModuleStatus> modules = 3;
map<string, HardwareStatus> hardware = 4;
map<string, apollo.monitor.HardwareStatus> hardware = 4;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册