package bx import ( "bytes" "encoding/binary" ) type CmdState struct { baseBxCmd } func NewCmdState() CmdState { return CmdState{ baseBxCmd: newBaseCmd(CMD_SYSTEM_STATE.group, CMD_SYSTEM_STATE.code), } } func (cmd CmdState) Build() []byte { w := bytes.NewBuffer(make([]byte, 0, 1024)) binary.Write(w, binary.LittleEndian, cmd.Group()) binary.Write(w, binary.LittleEndian, cmd.Cmd()) binary.Write(w, binary.LittleEndian, cmd.ReqResp()) //r0 r1 binary.Write(w, binary.LittleEndian, byte(0x00)) binary.Write(w, binary.LittleEndian, byte(0x00)) return w.Bytes() }