
package uk.co.wingpath.modbusgui;

import java.io.*;
import uk.co.wingpath.modbus.*;
import uk.co.wingpath.util.*;
import uk.co.wingpath.gui.*;
import uk.co.wingpath.xml.*;

public interface Command<R extends Command.Result>
    extends Xml.Savable
{
    void send (ModbusClient client, Settings settings)
        throws InterruptedException, IOException, ValueException;
    String getTag ();
    String getTypeName ();
    String getDescription ();
    R getActualResult ();
    R getExpectedResult ();

    interface Result
    {
        ModbusException getException ();

        /**
        * Gets the response time for this result.
        * @return the response time in nanoseconds.
        */
        long getResponseTime ();

        /**
        * Tests whether this reults matches the specified result.
        * @return true if this reults matches the specified result.
        */
        boolean matches (Result r);
    }
}

