diff options
author | Patrick Venture <venture@google.com> | 2019-08-19 12:07:18 -0700 |
---|---|---|
committer | Patrick Venture <venture@google.com> | 2019-09-19 10:20:31 -0700 |
commit | 87fd2cd13314a2b0b8cbc6441e724a4fea57e20c (patch) | |
tree | 4b8278bedc9035659d16d8734bac2218e437e131 /sensorhandler.cpp | |
parent | 99bf1c410f4521e1df05c41cd377e9d1232dbdba (diff) | |
download | phosphor-host-ipmid-87fd2cd13314a2b0b8cbc6441e724a4fea57e20c.tar.gz phosphor-host-ipmid-87fd2cd13314a2b0b8cbc6441e724a4fea57e20c.zip |
sensorhandler: use entity-map from json if filled
Step 4 of the transition from YAML to JSON will return the data from the
JSON file if present and valid, otherwise it'll fallback and return the
default example YAML present in the repository.
Tested: This was not tested.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I33c773fc53660a9eb5e27a8c8c3e231c64fe079d
Diffstat (limited to 'sensorhandler.cpp')
-rw-r--r-- | sensorhandler.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sensorhandler.cpp b/sensorhandler.cpp index b5e2f2f..bda7fda 100644 --- a/sensorhandler.cpp +++ b/sensorhandler.cpp @@ -602,7 +602,9 @@ ipmi::RspType<uint8_t, // respcount if (count.value_or(0) == getSdrCount) { // Get SDR count. This returns the total number of SDRs in the device. - const auto& entityRecords = ipmi::sensor::getIpmiEntityRecords(); + const auto& entityRecords = + ipmi::sensor::EntityInfoMapContainer::getContainer() + ->getIpmiEntityRecords(); sdrCount = ipmi::sensor::sensors.size() + frus.size() + entityRecords.size(); } @@ -771,7 +773,9 @@ ipmi_ret_t ipmi_fru_get_sdr(ipmi_request_t request, ipmi_response_t response, { // we have reached till end of fru, so assign the next record id to // 512(Max fru ID = 511) + Entity Record ID(may start with 0). - const auto& entityRecords = ipmi::sensor::getIpmiEntityRecords(); + const auto& entityRecords = + ipmi::sensor::EntityInfoMapContainer::getContainer() + ->getIpmiEntityRecords(); auto next_record_id = (entityRecords.size()) ? entityRecords.begin()->first + ENTITY_RECORD_ID_START @@ -810,7 +814,9 @@ ipmi_ret_t ipmi_entity_get_sdr(ipmi_request_t request, ipmi_response_t response, get_sdr::SensorDataEntityRecord record{}; auto dataLength = 0; - const auto& entityRecords = ipmi::sensor::getIpmiEntityRecords(); + const auto& entityRecords = + ipmi::sensor::EntityInfoMapContainer::getContainer() + ->getIpmiEntityRecords(); auto entity = entityRecords.begin(); uint8_t entityRecordID; auto recordID = get_sdr::request::get_record_id(req); |