forked from bougou/go-ipmi
/
cmd_set_sensor_type.go
47 lines (39 loc) · 1.12 KB
/
cmd_set_sensor_type.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
package ipmi
// 35.15 Set Sensor Type Command
type SetSensorTypeRequest struct {
SensorNumber uint8
SensorType SensorType
EventReadingType EventReadingType
}
type SetSensorTypeResponse struct {
// empty
}
func (req *SetSensorTypeRequest) Command() Command {
return CommandSetSensorType
}
func (req *SetSensorTypeRequest) Pack() []byte {
out := make([]byte, 3)
packUint8(req.SensorNumber, out, 0)
packUint8(uint8(req.SensorType), out, 1)
packUint8(uint8(req.EventReadingType), out, 2)
return out
}
func (res *SetSensorTypeResponse) Unpack(msg []byte) error {
return nil
}
func (r *SetSensorTypeResponse) CompletionCodes() map[uint8]string {
return map[uint8]string{}
}
func (res *SetSensorTypeResponse) Format() string {
return ""
}
func (c *Client) SetSensorType(sensorNumber uint8, sensorType SensorType, eventReadingType EventReadingType) (response *SetSensorTypeResponse, err error) {
request := &SetSensorTypeRequest{
SensorNumber: sensorNumber,
SensorType: sensorType,
EventReadingType: eventReadingType,
}
response = &SetSensorTypeResponse{}
err = c.Exchange(request, response)
return
}