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

import net.northking.cctp.upperComputer.driver.agent.command.protocol.AbstractProtocolCommand;

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

/**
 * 获取短信列表指令
 */
public class GetSmsListCommand extends AbstractProtocolCommand<String> {

    /**
     * 读取条数
     * <br>
     * -1为所有短信
     */
    private int readNumber = -1;

    public GetSmsListCommand() {
    }

    ;

    public GetSmsListCommand(int number) {
        this.readNumber = number;
    }

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

    @Override
    public void doSend(DataOutput output) throws IOException {
        output.writeInt(readNumber);
    }

    @Override
    public String buildReceive(DataInput input) throws IOException {
        return readText(input);
    }
}
