package com.gyee.edge.protocol.iec60870.infoelement;

import java.io.DataInputStream;
import java.io.IOException;

/**
 * Represents a single command (SCO) information element.
 */
public class IeSingleCommand extends IeAbstractQualifierOfCommand {

    public IeSingleCommand(boolean commandStateOn, int qualifier, boolean select) {
        super(qualifier, select);

        if (commandStateOn) {
            value |= 0x01;
        }
    }

    IeSingleCommand(DataInputStream is) throws IOException {
        super(is);
    }

    public boolean isCommandStateOn() {
        return (value & 0x01) == 0x01;
    }

    @Override
    public String toString() {
        return "Single Command state on: " + isCommandStateOn() + ", " + super.toString();
    }

}
