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


import net.northking.cctp.upperComputer.driver.agent.command.data.NetworkSpeed;
import net.northking.cctp.upperComputer.driver.agent.command.protocol.ProtocolCommand;

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

public class WatchTrafficStatsNetworkSpeedCommand implements ProtocolCommand<NetworkSpeed> {

    private static WatchTrafficStatsNetworkSpeedCommand instance = null;

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

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

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

    }

    @Override
    public NetworkSpeed buildReceive(DataInput input) throws IOException {
        NetworkSpeed networkSpeed = new NetworkSpeed();
        networkSpeed.uploadSpeed = input.readLong();
        networkSpeed.downloadSpeed = input.readLong();
        return networkSpeed;
    }
}
