1 Star 0 Fork 0

叶海丰/ipmi-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
cmd_set_bmc_global_enables.go 2.25 KB
一键复制 编辑 原始数据 按行查看 历史
叶海丰 提交于 1年前 . init
package ipmi
import "fmt"
// 22.1 Set BMC Global Enables Command
type SetBMCGlobalEnablesRequest struct {
// Generic system mgmt. software must do a "read-modify-write" using the Get BMC Global Enables and Set BMC Global Enables to avoid altering EnableOEM_X field.
EnableOEM2 bool
EnableOEM1 bool
EnableOEM0 bool
EnableSystemEventLogging bool
EnableEventMessageBuffer bool
EnableEventMessageBufferFullInterrupt bool
EnableReceiveMessageQueueInterrupt bool
}
type SetBMCGlobalEnablesResponse struct {
// empty
}
func (req *SetBMCGlobalEnablesRequest) Command() Command {
return CommandSetBMCGlobalEnables
}
func (req *SetBMCGlobalEnablesRequest) Pack() []byte {
var b uint8 = 0
if req.EnableOEM2 {
b = setBit7(b)
}
if req.EnableOEM1 {
b = setBit6(b)
}
if req.EnableOEM0 {
b = setBit5(b)
}
if req.EnableSystemEventLogging {
b = setBit3(b)
}
if req.EnableEventMessageBuffer {
b = setBit2(b)
}
if req.EnableEventMessageBufferFullInterrupt {
b = setBit1(b)
}
if req.EnableReceiveMessageQueueInterrupt {
b = setBit0(b)
}
return []byte{b}
}
func (res *SetBMCGlobalEnablesResponse) Unpack(msg []byte) error {
return nil
}
func (*SetBMCGlobalEnablesResponse) CompletionCodes() map[uint8]string {
// no command-specific cc
return map[uint8]string{}
}
func (res *SetBMCGlobalEnablesResponse) Format() string {
// Todo
return ""
}
func (c *Client) SetBMCGlobalEnables(enableSystemEventLogging bool, enableEventMessageBuffer bool, enableEventMessageBufferFullInterrupt bool, enableReceiveMessageQueueInterrupt bool) (response *SetBMCGlobalEnablesResponse, err error) {
getRes, err := c.GetBMCGlobalEnables()
if err != nil {
return nil, fmt.Errorf("GetBMCGlobalEnables failed, err: %s", err)
}
request := &SetBMCGlobalEnablesRequest{
EnableOEM2: getRes.OEM2Enabled,
EnableOEM1: getRes.OEM1Enabled,
EnableOEM0: getRes.OEM0Enabled,
EnableSystemEventLogging: enableSystemEventLogging,
EnableEventMessageBuffer: enableEventMessageBuffer,
EnableEventMessageBufferFullInterrupt: enableEventMessageBufferFullInterrupt,
EnableReceiveMessageQueueInterrupt: enableReceiveMessageQueueInterrupt,
}
response = &SetBMCGlobalEnablesResponse{}
err = c.Exchange(request, response)
return
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/rogax/ipmi-go.git
git@gitee.com:rogax/ipmi-go.git
rogax
ipmi-go
ipmi-go
86ae46cfb58e

搜索帮助