Verify the value of the tempX_label file
- The intent behind this commit is to verify the value of
the tempX_label file.
- In the future, the value of this file will be changed to
`D0000002` (OCC sensor ID).
- OCC Sensor Ids(D0000002)
- First byte is type - D0
- Second byte is reserved - 00
- Third+Fourth bytes are instance id - 0002
Tested: built openpower-occ-control successfully and unit test worked
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I5e89ce9592898f79b9fe926dd7bbe5691bf535a5
diff --git a/utils.hpp b/utils.hpp
index 1d173a3..6254ed7 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -1,13 +1,19 @@
#pragma once
+#include <optional>
#include <sdbusplus/bus.hpp>
#include <string>
+#include <tuple>
+
namespace open_power
{
namespace occ
{
namespace utils
{
+
+using LABELVALUE = std::tuple<std::string, uint16_t>;
+
constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
constexpr auto MAPPER_OBJ_PATH = "/xyz/openbmc_project/object_mapper";
constexpr auto MAPPER_IFACE = "xyz.openbmc_project.ObjectMapper";
@@ -49,6 +55,15 @@
const std::string& interface,
const std::string& propertyName);
+/**
+ * @brief Check the value of the `tempX_label` file
+ *
+ * @param[in] value - the value of the `tempX_label` file
+ *
+ * @return Sensors type and Sensors ID
+ */
+std::optional<LABELVALUE> checkLabelValue(const std::string& value);
+
} // namespace utils
} // namespace occ
} // namespace open_power