package com.hboxs.serialport.frame;

import com.hboxs.serialport.Command;

/**
 * 命令帧 - 读
 */
public class ReadCommandFrame extends CommandFrame {

    /**
     * 读取某个地址1字节
     * @param address 地址
     */
    public ReadCommandFrame(String address) {
        this(address, 1);
    }

    /**
     * 读取某个地址n字节
     * @param address 地址
     * @param dataLength 字节数
     */
    public ReadCommandFrame(String address, int dataLength) {
        super(Command.CMD_READ, address, dataLength);
    }

    public static void main(String[] args) {
        CommandFrame commandFrame = new ReadCommandFrame("X10");
        System.out.print("{");
        for (byte b : commandFrame.getFrameData()) {
            System.out.print(Integer.toHexString(b));
            System.out.print(",");
        }
        System.out.println("}");
    }
}
