package net.northking.cctp.upperComputer.driver.agent.command;

import net.northking.cctp.upperComputer.driver.agent.command.protocol.AbstractProtocolCommand;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

/**
 * 观察屏幕内容<br>
 * 接收到的数据为编码的图像
 */
public class WatchScreenStreamCommand extends AbstractProtocolCommand<byte[]> {

    private Logger logger = LoggerFactory.getLogger(WatchScreenStreamCommand.class);

    private static WatchScreenStreamCommand instance = null;

    public static WatchScreenStreamCommand getInstance() {
        if (instance == null) {
            instance = new WatchScreenStreamCommand();
        }
        return instance;
    }

    @Override
    public int getCommandId() {
        return 32;
    }

    @Override
    public void doSend(DataOutput output) throws IOException {

    }

    @Override
    public byte[] buildReceive(DataInput input) throws IOException {
        int size = input.readInt();
        byte[] result = new byte[size];
        input.readFully(result);
        return result;
    }
}
