-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathcmd_get_bmc_global_enables.go
60 lines (49 loc) · 1.49 KB
/
cmd_get_bmc_global_enables.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
package ipmi
import "context"
// 22.2 Get BMC Global Enables Command
type GetBMCGlobalEnablesRequest struct {
// empty
}
type GetBMCGlobalEnablesResponse struct {
OEM2Enabled bool
OEM1Enabled bool
OEM0Enabled bool
SystemEventLoggingEnabled bool
EventMessageBufferEnabled bool
EventMessageBufferFullInterruptEnabled bool
ReceiveMessageQueueInterruptEnabled bool
}
func (req *GetBMCGlobalEnablesRequest) Command() Command {
return CommandGetBMCGlobalEnables
}
func (req *GetBMCGlobalEnablesRequest) Pack() []byte {
return []byte{}
}
func (res *GetBMCGlobalEnablesResponse) Unpack(msg []byte) error {
if len(msg) < 1 {
return ErrUnpackedDataTooShortWith(len(msg), 1)
}
b, _, _ := unpackUint8(msg, 0)
res.OEM2Enabled = isBit7Set(b)
res.OEM1Enabled = isBit6Set(b)
res.OEM0Enabled = isBit5Set(b)
res.SystemEventLoggingEnabled = isBit3Set(b)
res.EventMessageBufferEnabled = isBit2Set(b)
res.EventMessageBufferFullInterruptEnabled = isBit1Set(b)
res.ReceiveMessageQueueInterruptEnabled = isBit0Set(b)
return nil
}
func (*GetBMCGlobalEnablesResponse) CompletionCodes() map[uint8]string {
// no command-specific cc
return map[uint8]string{}
}
func (res *GetBMCGlobalEnablesResponse) Format() string {
// Todo
return ""
}
func (c *Client) GetBMCGlobalEnables(ctx context.Context) (response *GetBMCGlobalEnablesResponse, err error) {
request := &GetBMCGlobalEnablesRequest{}
response = &GetBMCGlobalEnablesResponse{}
err = c.Exchange(ctx, request, response)
return
}