libpldmresponder:Support GetNumericEffecterValue responder

The GetNumericEffecterValue command is used to return the present
numeric setting of a PLDM Numeric Effecter.
This commit adds responder support for GetNumericEffecterValue Cmd
as mentioned in Section22.3 of DSP0248_1.2.0.
Currently "effecterOperationalState" field in the response msg is
set to "enabled-noUpdatePending". Actual value can be fetched once
the support for EffecterEvent/SetNumericEffecterEnable is added.

Test:
    Using pldmtool raw command
    Success Case:
        pldmtool raw -d 0x80 0x02 0x32 0x23 00
        pldmtool: Tx: 08 01 80 02 32 23 00
        pldmtool: Rx: 08 01 00 02 32 00 00 01 03 03
   Failure Case:
        pldmtool raw -d 0x80 0x02 0x32 0x25 0x00
        pldmtool: Tx: 08 01 80 02 32 25 00
        pldmtool: Rx: 08 01 00 02 32 80

Change-Id: I64a7205d8f69e3925b75b02558a0857b63c70ebf
Signed-off-by: Archana Kakani <archana.kakani@ibm.com>
diff --git a/libpldmresponder/platform.cpp b/libpldmresponder/platform.cpp
index 5f71252..67264c8 100644
--- a/libpldmresponder/platform.cpp
+++ b/libpldmresponder/platform.cpp
@@ -593,6 +593,67 @@
     return PLDM_SUCCESS;
 }
 
+Response Handler::getNumericEffecterValue(const pldm_msg* request,
+                                          size_t payloadLength)
+{
+    if (payloadLength != PLDM_GET_NUMERIC_EFFECTER_VALUE_REQ_BYTES)
+    {
+        return ccOnlyResponse(request, PLDM_ERROR_INVALID_LENGTH);
+    }
+
+    uint16_t effecterId{};
+    auto rc = decode_get_numeric_effecter_value_req(request, payloadLength,
+                                                    &effecterId);
+    if (rc != PLDM_SUCCESS)
+    {
+        return ccOnlyResponse(request, rc);
+    }
+
+    const pldm::utils::DBusHandler dBusIntf;
+    uint8_t effecterDataSize{};
+    pldm::utils::PropertyValue dbusValue;
+    std::string propertyType;
+    using effecterOperationalState = uint8_t;
+    using completionCode = uint8_t;
+
+    rc = platform_numeric_effecter::getNumericEffecterData<
+        pldm::utils::DBusHandler, Handler>(
+        dBusIntf, *this, effecterId, effecterDataSize, propertyType, dbusValue);
+
+    if (rc != PLDM_SUCCESS)
+    {
+        return ccOnlyResponse(request, rc);
+    }
+
+    // Refer DSP0248_1.2.0.pdf (section 22.3, Table 48)
+    // Completion Code (uint8), Effecter Data Size(uint8), Effecter Operational
+    // State(uint8), PendingValue (uint8|sint8|uint16|sint16|uint32|sint32 )
+    // PresentValue (uint8|sint8|uint16|sint16|uint32|sint32 )
+    // Size of PendingValue and PresentValue calculated based on size is
+    // provided in effecter data size
+    size_t responsePayloadLength = sizeof(completionCode) +
+                                   sizeof(effecterDataSize) +
+                                   sizeof(effecterOperationalState) +
+                                   getEffecterDataSize(effecterDataSize) +
+                                   getEffecterDataSize(effecterDataSize);
+
+    Response response(responsePayloadLength + sizeof(pldm_msg_hdr));
+    auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
+
+    rc = platform_numeric_effecter::getNumericEffecterValueHandler(
+        propertyType, dbusValue, effecterDataSize, responsePtr,
+        responsePayloadLength, request->hdr.instance_id);
+
+    if (rc != PLDM_SUCCESS)
+    {
+        error(
+            "Reponse to GetNumericEffecterValue failed RC={RC} for EffectorId={EFFECTER_ID} ",
+            "RC", rc, "EFFECTER_ID", effecterId);
+        return ccOnlyResponse(request, rc);
+    }
+    return response;
+}
+
 Response Handler::setNumericEffecterValue(const pldm_msg* request,
                                           size_t payloadLength)
 {