From 6add0b810bfd859ad21cb6b3f98b0bbfaa15aa62 Mon Sep 17 00:00:00 2001 From: Vishwanatha Subbanna Date: Fri, 21 Jul 2017 19:02:37 +0530 Subject: Use generated occ to sensor ID map Change-Id: I948cc33ef05c2c49353277f4d5df958012a9801f Signed-off-by: Vishwanatha Subbanna --- occ_status.hpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'occ_status.hpp') diff --git a/occ_status.hpp b/occ_status.hpp index f426048..d30d642 100644 --- a/occ_status.hpp +++ b/occ_status.hpp @@ -13,6 +13,12 @@ namespace occ namespace Base = sdbusplus::org::open_power::OCC::server; using Interface = sdbusplus::server::object::object; +// OCC status instance. Ex. for "occ0", the instance is 0 +using instanceID = int; + +// IPMI sensor ID for a given OCC instance +using sensorID = uint8_t; + /** @class Status * @brief Implementation of OCC Active Status */ @@ -35,8 +41,9 @@ class Status : public Interface Status(sdbusplus::bus::bus& bus, EventPtr& event, const char* path) : Interface(bus, path), path(path), + instance(((this->path.back() - '0'))), device(event, - name + std::to_string((this->path.back() - '0') + 1), + name + std::to_string(instance + 1), std::bind(&Status::deviceErrorHandler, this)) { // Nothing to do here @@ -63,6 +70,12 @@ class Status : public Interface /** @brief occ name prefix */ std::string name = OCC_NAME; + /** @brief OCC instance number. Ex, 0,1, etc */ + int instance; + + /** @brief OCC instance to Sensor ID mapping */ + static const std::map sensorMap; + /** @brief OCC device object to do bind and unbind */ Device device; -- cgit v1.2.1