blob: ab123afd001b22f45d12d485464c78e5d60e814f (
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
|
#include "XIpmiBatteryImp.h"
XIpmiBatteryImp::XIpmiBatteryImp(const XString& batteryIdentifier):
batteryIdentifier_(batteryIdentifier)
{
}
void XIpmiBatteryImp::setBatteryType(const XString& batteryType)
{
comVals_["batteryType"] = batteryType;
}
void XIpmiBatteryImp::setBatteryIdentifier(const XString& batteryIdentifier)
{
comVals_["batteryIdentifier"] = batteryIdentifier;
}
void XIpmiBatteryImp::setBatteryVoltageLevel(XNumber batteryVoltageLevel)
{
comVals_["batteryVoltageLevel"] = batteryVoltageLevel;
}
json XIpmiBatteryImp::toJson()
{
try
{
json field = {
{"batteryIdentifier", batteryIdentifier_}
};
//optional val
field = mergeCommonValues(field, comVals_);
return field;
}
catch (json::exception& e)
{
SPDLOG_ERROR("Fail to build XIpmiBattery to json object:{}.", e.what());
return json();
}
}
|