-
Notifications
You must be signed in to change notification settings - Fork 17
/
cmd_set_sensor_hysteresis.go
50 lines (41 loc) · 1.43 KB
/
cmd_set_sensor_hysteresis.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
package ipmi
// 35.6 Set Sensor Hysteresis Command
type SetSensorHysteresisRequest struct {
SensorNumber uint8
PositiveHysteresis uint8
NegativeHysteresis uint8
}
type SetSensorHysteresisResponse struct {
}
func (req *SetSensorHysteresisRequest) Command() Command {
return CommandSetSensorHysteresis
}
func (req *SetSensorHysteresisRequest) Pack() []byte {
out := make([]byte, 4)
packUint8(req.SensorNumber, out, 0)
packUint8(0xff, out, 1) // reserved for future "hysteresis mask" definition. Write as FFh
packUint8(req.PositiveHysteresis, out, 2)
packUint8(req.NegativeHysteresis, out, 3)
return out
}
func (res *SetSensorHysteresisResponse) Unpack(msg []byte) error {
return nil
}
func (r *SetSensorHysteresisResponse) CompletionCodes() map[uint8]string {
return map[uint8]string{}
}
func (res *SetSensorHysteresisResponse) Format() string {
return ""
}
// 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) SetSensorHysteresis(sensorNumber uint8, positiveHysteresis uint8, negativeHysteresis uint8) (response *SetSensorHysteresisResponse, err error) {
request := &SetSensorHysteresisRequest{
SensorNumber: sensorNumber,
PositiveHysteresis: positiveHysteresis,
NegativeHysteresis: negativeHysteresis,
}
response = &SetSensorHysteresisResponse{}
err = c.Exchange(request, response)
return
}