blob: 01222d04c5168af1250cab9167172c02777bbdcf [file] [log] [blame]
Tony Lee6c595012019-06-19 10:54:59 +08001#include "nvmes.hpp"
2
3namespace phosphor
4{
5namespace nvme
6{
7
8void NvmeSSD::checkSensorThreshold()
9{
10 int8_t value = ValueIface::value();
11 int8_t criticalHigh = CriticalInterface::criticalHigh();
12 int8_t criticalLow = CriticalInterface::criticalLow();
13 int8_t warningHigh = WarningInterface::warningHigh();
14 int8_t warningLow = WarningInterface::warningLow();
15
16 CriticalInterface::criticalAlarmHigh(value > criticalHigh);
17
18 CriticalInterface::criticalAlarmLow(value < criticalLow);
19
20 WarningInterface::warningAlarmHigh(value > warningHigh);
21
22 WarningInterface::warningAlarmLow(value < warningLow);
23}
24
25void NvmeSSD::setSensorThreshold(int8_t criticalHigh, int8_t criticalLow,
26 int8_t maxValue, int8_t minValue,
27 int8_t warningHigh, int8_t warningLow)
28{
29
30 CriticalInterface::criticalHigh(criticalHigh);
31 CriticalInterface::criticalLow(criticalLow);
32
33 WarningInterface::warningHigh(warningHigh);
34 WarningInterface::warningLow(warningLow);
35
36 ValueIface::maxValue(maxValue);
37 ValueIface::minValue(minValue);
38}
39
40void NvmeSSD::setSensorValueToDbus(const int8_t value)
41{
42 ValueIface::value(value);
43}
44
45} // namespace nvme
46} // namespace phosphor