forked from bougou/go-ipmi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd_chassis_identify.go
53 lines (44 loc) · 1.31 KB
/
cmd_chassis_identify.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
package ipmi
// 28.5 Chassis Identify Command
// 用来定位设备,机箱定位 (机箱定位灯默认亮 interval 秒)
type ChassisIdentifyRequest struct {
IdentifyInterval uint8
ForceIdentifyOn bool
}
type ChassisIdentifyResponse struct {
// empty
}
func (req *ChassisIdentifyRequest) Pack() []byte {
out := make([]byte, 2)
packUint8(uint8(req.IdentifyInterval), out, 0)
var force uint8 = 0
if req.ForceIdentifyOn {
force = 1
}
packUint8(force, out, 1)
return out
}
func (req *ChassisIdentifyRequest) Command() Command {
return CommandChassisIdentify
}
func (res *ChassisIdentifyResponse) CompletionCodes() map[uint8]string {
return map[uint8]string{}
}
func (res *ChassisIdentifyResponse) Unpack(msg []byte) error {
return nil
}
func (res *ChassisIdentifyResponse) Format() string {
return ""
}
// This command causes the chassis to physically identify itself by a mechanism
// chosen by the system implementation; such as turning on blinking user-visible lights
// or emitting beeps via a speaker, LCD panel, etc.
func (c *Client) ChassisIdentify(interval uint8, force bool) (response *ChassisIdentifyResponse, err error) {
request := &ChassisIdentifyRequest{
IdentifyInterval: interval,
ForceIdentifyOn: force,
}
response = &ChassisIdentifyResponse{}
err = c.Exchange(request, response)
return
}