-
Notifications
You must be signed in to change notification settings - Fork 17
/
cmd_set_sensor_thresholds.go
103 lines (91 loc) · 2.34 KB
/
cmd_set_sensor_thresholds.go
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package ipmi
// 35.8 Set Sensor Thresholds Command
type SetSensorThresholdsRequest struct {
SensorNumber uint8
// Set Threshold flag
SetUNR bool
SetUCR bool
SetUNC bool
SetLNR bool
SetLCR bool
SetLNC bool
// Threshold value
LNC_Raw uint8
LCR_Raw uint8
LNR_Raw uint8
UNC_Raw uint8
UCR_Raw uint8
UNR_Raw uint8
}
type SetSensorThresholdsResponse struct {
// empty
}
func (req *SetSensorThresholdsRequest) Command() Command {
return CommandSetSensorThresholds
}
func (req *SetSensorThresholdsRequest) Pack() []byte {
out := make([]byte, 8)
packUint8(req.SensorNumber, out, 0)
var b uint8
if req.SetUNR {
b = setBit5(b)
}
if req.SetUCR {
b = setBit4(b)
}
if req.SetUNC {
b = setBit3(b)
}
if req.SetLNR {
b = setBit2(b)
}
if req.SetLCR {
b = setBit1(b)
}
if req.SetLNC {
b = setBit0(b)
}
packUint8(b, out, 1)
packUint8(req.LNC_Raw, out, 2)
packUint8(req.LCR_Raw, out, 3)
packUint8(req.LNR_Raw, out, 4)
packUint8(req.UNC_Raw, out, 5)
packUint8(req.UCR_Raw, out, 6)
packUint8(req.UNR_Raw, out, 7)
return out
}
func (res *SetSensorThresholdsResponse) Unpack(msg []byte) error {
return nil
}
func (r *SetSensorThresholdsResponse) CompletionCodes() map[uint8]string {
return map[uint8]string{}
}
func (res *SetSensorThresholdsResponse) Format() string {
return ""
}
// SetSensorThresholds is to set the specified threshold for the given sensor.
// Note that the application issuing this command is responsible for ensuring that
// thresholds for a sensor are set in the proper order (e.g. that
// the upper critical threshold is set higher than the upper non-critical threshold)
//
// Upper Non Recoverable area
// -----------------UNR threshold
// Upper Critical area
// -----------------UCR threshold
// Upper Non Critical area
// -----------------UNC threshold
// OK area
// -----------------LNC threshold
// Lower Non Critical area
// -----------------LCR threshold
// Lower Critical area
// -----------------LNR threshold
// Lower NonRecoverable area
//
// This command provides a mechanism for setting the hysteresis values associated
// with the thresholds of a sensor that has threshold based event generation.
func (c *Client) SetSensorThresholds(request *SetSensorThresholdsRequest) (response *SetSensorThresholdsResponse, err error) {
response = &SetSensorThresholdsResponse{}
err = c.Exchange(request, response)
return
}