File: cmd_set_pef_config_params.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 (59 lines) | stat: -rw-r--r-- 1,583 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
59
package ipmi

import "context"

// 30.3 Set PEF Configuration Parameters Command
type SetPEFConfigParamRequest struct {
	ParamSelector PEFConfigParamSelector
	ParamData     []byte
}

type SetPEFConfigParamResponse struct {
	// empty
}

func (req *SetPEFConfigParamRequest) Command() Command {
	return CommandSetPEFConfigParam
}

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

	out := make([]byte, 1+len(req.ParamData))

	// out[0] = req.ParamSelector
	packUint8(uint8(req.ParamSelector), out, 0)
	if len(req.ParamData) > 0 {
		packBytes(req.ParamData, out, 1)
	}
	return out
}

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

func (r *SetPEFConfigParamResponse) CompletionCodes() map[uint8]string {
	return map[uint8]string{
		0x80: "parameter not supported",
		// (This completion code provides a way to recognize that another party has already 'claimed' the parameters)"
		0x81: "attempt to set the 'set in progress' value (in parameter #0) when not in the 'set complete' state.",
		0x82: "attempt to write read-only parameter",
		0x83: "attempt to read write-only parameter",
	}
}

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

// Todo
func (c *Client) SetPEFConfigParam(ctx context.Context, paramSelector PEFConfigParamSelector, paramData []byte) (response *SetPEFConfigParamResponse, err error) {
	request := &SetPEFConfigParamRequest{
		ParamSelector: paramSelector,
		ParamData:     paramData,
	}
	response = &SetPEFConfigParamResponse{}
	err = c.Exchange(ctx, request, response)
	return
}