-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtype_23_system_reset.go
75 lines (66 loc) · 1.54 KB
/
type_23_system_reset.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
68
69
70
71
72
73
74
75
package dmi
import (
"fmt"
)
type SystemResetBootOption byte
const (
SystemResetBootOptionReserved SystemResetBootOption = iota
SystemResetBootOptionOperatingSystem
SystemResetBootOptionSystemUtilities
SystemResetBootOptionDoNotReboot
)
func (s SystemResetBootOption) String() string {
options := [...]string{
"Reserved",
"Operating System",
"System Utilities",
"Do Not Reboot",
}
return options[s]
}
type SystemResetCapabilities struct {
Status bool
BootOptionOnLimit SystemResetBootOption
BootOption SystemResetBootOption
WatchdogTimer bool
}
func NewSystemResetCapablities(data byte) SystemResetCapabilities {
var s SystemResetCapabilities
s.Status = (data&0x01 != 0)
s.BootOption = SystemResetBootOption(data & 0x06)
s.BootOptionOnLimit = SystemResetBootOption(data & 0x18)
s.WatchdogTimer = data&0x20 != 0
return s
}
func (s SystemResetCapabilities) String() string {
return fmt.Sprintf("Capablities\n"+
"\tStatus: %t\n"+
"\tBoot Option: %s\n"+
"\tBoot Option On Limit: %s\n"+
"\tWatchdog Timer: %t",
s.Status,
s.BootOption,
s.BootOptionOnLimit,
s.WatchdogTimer)
}
type SystemReset struct {
infoCommon
Capabilities byte
ResetCount uint16
ResetLimit uint16
TimerInterval uint16
Timeout uint16
}
func (s SystemReset) String() string {
return fmt.Sprintf("System Reset\n"+
"\tCapabilities: %s\n"+
"\tReset Count: %d\n"+
"\tReset Limit: %d\n"+
"\tTimer Interval: %d\n"+
"\tTimeout: %d",
s.Capabilities,
s.ResetCount,
s.ResetLimit,
s.TimerInterval,
s.Timeout)
}