-
Notifications
You must be signed in to change notification settings - Fork 26
/
cmd_arm_pef_postpone_timer.go
67 lines (57 loc) · 2.05 KB
/
cmd_arm_pef_postpone_timer.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
61
62
63
64
65
66
67
package ipmi
import (
"context"
"fmt"
)
// 30.2 Arm PEF Postpone Timer Command
type ArmPEFPostponeTimerRequest struct {
// PEF Postpone Timeout, in seconds. 01h -> 1 second.
//
// 00h = disable Postpone Timer (PEF will immediately handle events, if enabled).
// The BMC automatically disables the timer whenever the system
// enters a sleep state, is powered down, or reset.
// 01h - FDh = arm timer.
// Timer will automatically start counting down from given value
// when the last-processed event Record ID is not equal to the last
// received event's Record ID.
// FEh = Temporary PEF disable.
// The PEF Postpone timer does not countdown from the value.
// The BMC automatically re-enables PEF (if enabled in the PEF configuration parameters)
// and sets the PEF Postpone timeout to 00h whenever the system
// enters a sleep state, is powered down, or reset. Software can
// cancel this disable by setting this parameter to 00h or 01h-FDh.
// FFh = get present countdown value
Timeout uint8
}
type ArmPEFPostponeTimerResponse struct {
// Present timer countdown value
PresentValue uint8
}
func (req *ArmPEFPostponeTimerRequest) Command() Command {
return CommandArmPEFPostponeTimer
}
func (req *ArmPEFPostponeTimerRequest) Pack() []byte {
// empty request data
return []byte{req.Timeout}
}
func (res *ArmPEFPostponeTimerResponse) Unpack(msg []byte) error {
if len(msg) < 1 {
return ErrUnpackedDataTooShort
}
res.PresentValue = msg[0]
return nil
}
func (r *ArmPEFPostponeTimerResponse) CompletionCodes() map[uint8]string {
return map[uint8]string{}
}
func (res *ArmPEFPostponeTimerResponse) Format() string {
return fmt.Sprintf(`Present timer countdown value : %d (%#02x)`,
res.PresentValue, res.PresentValue,
)
}
func (c *Client) ArmPEFPostponeTimer(ctx context.Context) (response *ArmPEFPostponeTimerResponse, err error) {
request := &ArmPEFPostponeTimerRequest{}
response = &ArmPEFPostponeTimerResponse{}
err = c.Exchange(ctx, request, response)
return
}