summaryrefslogtreecommitdiffstats
path: root/veslibrary/ves_cpplibrary/src/lib/encode/XIpmiPowerSupplyImp.cpp
blob: 9babe881f85587b4bf74f5c552fbfc8ce90a3907 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "XIpmiPowerSupplyImp.h"

XIpmiPowerSupplyImp::XIpmiPowerSupplyImp(const XString& powerSupplyIdentifier):
        powerSupplyIdentifier_(powerSupplyIdentifier)
{

}

void XIpmiPowerSupplyImp::setPowerSupplyInputPower(XNumber powerSupplyInputPower)
{
    comVals_["powerSupplyInputPower"] = powerSupplyInputPower;
}
            
void XIpmiPowerSupplyImp::setPowerSupplyCurrentOutputPercent(XNumber powerSupplyCurrentOutputPercent)
{
    comVals_["powerSupplyCurrentOutputPercent"] = powerSupplyCurrentOutputPercent;
}
            
void XIpmiPowerSupplyImp::setPowerSupplyIdentifier(const XString& powerSupplyIdentifier)
{
    comVals_["powerSupplyIdentifier"] = powerSupplyIdentifier;
}
            
void XIpmiPowerSupplyImp::setPowerSupplyTemperature(XNumber powerSupplyTemperature)
{
    comVals_["powerSupplyTemperature"] = powerSupplyTemperature;
}

json XIpmiPowerSupplyImp::toJson()
{
    try
    {
        json field = {
            {"powerSupplyIdentifier", powerSupplyIdentifier_}
        };

        //optional val
        
        field = mergeCommonValues(field, comVals_);

        return field;
    }
    catch (json::exception& e)
    {
        SPDLOG_ERROR("Fail to build XIpmiPowerSupply to json object:{}.", e.what());
        return json();
    }
}