package net.northking.cctp.upperComputer.driver.ios.command.data;


import net.northking.cctp.upperComputer.driver.ios.packet.ICommandData;

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

public class AppBatteryData implements ICommandData {

    private short status = 0;
    private double level;

    @Override
    public void buildFromInput(DataInput dataInput) throws IOException {
        status = dataInput.readShort();
        level = dataInput.readDouble();
    }

    @Override
    public void encodeToOutput(DataOutput dataOutput) throws IOException {
        dataOutput.writeShort(status);
        dataOutput.writeDouble(level);
    }

    @Override
    public String toString() {
        return "AppBatteryData{" +
                "status=" + status +
                ", level=" + level + "|" + String.format("%f", level) +
                '}';
    }
}
