Support numeric effecters in dbus-to-host-effecter

Adds support of the numeric effecter PDR (section `28.11 Numeric
Effecter PDR` DSP0248 V1.3.0) type in dbus-to-host-effecter handler.
This handler will be applied for all PLDM termini but not only host.
The setting for one numeric effecter of one device can be:
{
    "mctp_eid": 20,
    "effecter_info": {
        "effecterPdrType": 9,
        "effecterID": 2,
        "entityType": 32903,
        "entityInstance": 2,
        "containerID": 2,
        "compositeEffecterCount": 1,
        "checkHostState": false
    },
    "effecters": [
        {
            "dbus_info": {
                "object_path": "/xyz/openbmc_project/sensors/power/A",
                "interface": "xyz.openbmc_project.Sensor.Value",
                "property_name": "Value",
                "property_type": "double"
            },
            "effecterDataSize": 5,
            "resolution": 1,
            "offset": 0,
            "unitModifier": 0
        }
    ]
}

Where:
+ effecterPdrType to difference state/numeric effecter type. Default
is state effecter.
+ effecterID should be effecter ID and should not empty.
+ checkHostState can be set to false to bypass checking host state.
+ effecterDataSize, resolution, offset, unitModifier are from numeric
effecter PDR (section `28.11 Numeric Effecter PDR` DSP0248 V1.3.0)

Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
Change-Id: I438d7f204643edd4066e8a6ba28d53a97503fc4b
diff --git a/common/utils.hpp b/common/utils.hpp
index 5561399..6c17191 100644
--- a/common/utils.hpp
+++ b/common/utils.hpp
@@ -36,6 +36,15 @@
 {
 namespace utils
 {
+
+const std::set<std::string_view> dbusValueTypeNames = {
+    "bool",    "uint8_t",  "int16_t",         "uint16_t",
+    "int32_t", "uint32_t", "int64_t",         "uint64_t",
+    "double",  "string",   "vector<uint8_t>", "vector<string>"};
+const std::set<std::string_view> dbusValueNumericTypeNames = {
+    "uint8_t",  "int16_t", "uint16_t", "int32_t",
+    "uint32_t", "int64_t", "uint64_t", "double"};
+
 namespace fs = std::filesystem;
 using Json = nlohmann::json;
 constexpr bool Tx = true;
@@ -531,5 +540,18 @@
  */
 std::string_view trimNameForDbus(std::string& name);
 
+/** @brief Convert the number type D-Bus Value to the double
+ *
+ *  @param[in] type - string type should in dbusValueNumericTypeNames list
+ *  @param[in] value - DBus PropertyValue variant
+ *  @param[out] doubleValue - response value
+ *
+ *  @return true if data type is corrected and converting is successful
+ *          otherwise return false.
+ */
+bool dbusPropValuesToDouble(const std::string_view& type,
+                            const pldm::utils::PropertyValue& value,
+                            double* doubleValue);
+
 } // namespace utils
 } // namespace pldm