package com.hboxs.serialport.plc.frame;

import com.hboxs.serialport.plc.Command;

/**
 * 命令帧 - 置位
 * 写的num必须偶数字节
 */
public class SetCommandFrame extends CommandFrame {
    /**
     * 构造置位命令
     * @param address 地址
     *
     */
    public SetCommandFrame(String address) {
        super(Command.CMD_SET, address);
    }

    public static void main(String[] args) {
//        System.out.println(Integer.parseInt("10000001", 2));
//        System.out.println(Integer.parseInt("81", 16));
//        System.out.println("10000001".substring(0, 8));
        CommandFrame commandFrame = new SetCommandFrame("Y0");
        System.out.print("{");
        for (byte b : commandFrame.getFrameData()) {
            System.out.print(Integer.toHexString(b));
            System.out.print(",");
        }
        System.out.println("}");
    }
}
