package bx

import (
	"bytes"
	"encoding/binary"
)

type CmdCancelTimingSwitch struct {
	baseBxCmd
}

func NewCmdCancelTimingSwitch() CmdCancelTimingSwitch {
	return CmdCancelTimingSwitch{
		baseBxCmd: newBaseCmd(CMD_CANCEL_TIMING_SWITCH.group, CMD_CANCEL_TIMING_SWITCH.code),
	}
}

func (cmd CmdCancelTimingSwitch) Build() []byte {
	w := bytes.NewBuffer(make([]byte, 0, 8))
	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 nil
}
