forked from bougou/go-ipmi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd_get_message_flags.go
54 lines (45 loc) · 1.4 KB
/
cmd_get_message_flags.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
package ipmi
// 22.4 Get Message Flags Command
type GetMessageFlagsRequest struct {
}
type GetMessageFlagsResponse struct {
OEM2Avaiable bool
OEM1Avaiable bool
OEM0Avaiable bool
WatchdogPreTimeoutInterruptOccurred bool
EventMessageBufferFull bool
ReceiveMessageQueueAvaiable bool // One or more messages ready for reading from Receive Message Queue
}
func (req *GetMessageFlagsRequest) Command() Command {
return CommandGetMessageFlags
}
func (req *GetMessageFlagsRequest) Pack() []byte {
return []byte{}
}
func (res *GetMessageFlagsResponse) Unpack(msg []byte) error {
if len(msg) < 1 {
return ErrUnpackedDataTooShort
}
b, _, _ := unpackUint8(msg, 0)
res.OEM2Avaiable = isBit7Set(b)
res.OEM1Avaiable = isBit6Set(b)
res.OEM0Avaiable = isBit5Set(b)
res.WatchdogPreTimeoutInterruptOccurred = isBit3Set(b)
res.EventMessageBufferFull = isBit1Set(b)
res.ReceiveMessageQueueAvaiable = isBit0Set(b)
return nil
}
func (*GetMessageFlagsResponse) CompletionCodes() map[uint8]string {
// no command-specific cc
return map[uint8]string{}
}
func (res *GetMessageFlagsResponse) Format() string {
// Todo
return ""
}
func (c *Client) GetMessageFlags() (response *GetMessageFlagsResponse, err error) {
request := &GetMessageFlagsRequest{}
response = &GetMessageFlagsResponse{}
err = c.Exchange(request, response)
return
}