File: cmd_set_last_processed_event_id.go

package info (click to toggle)
golang-github-bougou-go-ipmi 0.7.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,880 kB
  • sloc: makefile: 38
file content (58 lines) | stat: -rw-r--r-- 1,335 bytes parent folder | download | duplicates (2)
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
package ipmi

import "context"

// 30.5 Set Last Processed Event ID Command
type SetLastProcessedEventIdRequest struct {
	// 0b = set Record ID for last record processed by software.
	// 1b = set Record ID for last record processed by BMC.
	ByBMC    bool
	RecordID uint16
}

type SetLastProcessedEventIdResponse struct {
	// empty
}

func (req *SetLastProcessedEventIdRequest) Command() Command {
	return CommandSetLastProcessedEventId
}

func (req *SetLastProcessedEventIdRequest) Pack() []byte {
	// empty request data

	out := make([]byte, 3)

	var b0 uint8 = 0x0
	if req.ByBMC {
		b0 = 1
	}
	packUint8(b0, out, 0)
	packUint16L(req.RecordID, out, 1)

	return out
}

func (res *SetLastProcessedEventIdResponse) Unpack(msg []byte) error {
	return nil
}

func (r *SetLastProcessedEventIdResponse) CompletionCodes() map[uint8]string {
	return map[uint8]string{
		0x81: "cannot execute command, SEL erase in progress",
	}
}

func (res *SetLastProcessedEventIdResponse) Format() string {
	return ""
}

func (c *Client) SetLastProcessedEventId(ctx context.Context, recordID uint16, byBMC bool) (response *SetLastProcessedEventIdResponse, err error) {
	request := &SetLastProcessedEventIdRequest{
		ByBMC:    byBMC,
		RecordID: recordID,
	}
	response = &SetLastProcessedEventIdResponse{}
	err = c.Exchange(ctx, request, response)
	return
}