package turgen.decoder;


/** Pulse decoder*/
public interface PulseDecoder {
    
    public static final int PD_UNEXPECTED_PULSE_WIDTH=-7;
    public static final int PD_NOT_ONE_NOT_ZERO=-6;
    public static final int PD_TOO_LONG=-5;
    public static final int PD_EOF=-4;
    public static final int PD_ERROR=-3;
    public static final int PD_USER_BREAK=-2;
    public static final int PD_OK=0;

    /** Initialize pulse decoder*/
    public void init(String config,turgen.Logger log,Object config2) throws Exception;

    /** Close pulse decoder*/
    public void close(String config) throws Exception;

    /** Is this decoder positionable
     *
     * @return true if position can be set
     */
    public boolean isPositionable();

    /** Set current sample*/
    public void setCurrentSample(int s);

    /** Get current sample*/
    public long getCurrentSample();

    /** Set sample counter*/
    public void setCounter(int c);

    /** Get sample counter*/
    public int getCounter();

    /** Wait for egde*/
    public int waitForEdge();

    /** Wait for egde*/
    public int waitForStartingEdge();

    /** Measure length*/
    public int measureLength();

    /** Set maximum tolerated silence*/
    public void setMaxSilence(int s);

    /** Request stop
     *
     * @param emergency Indicates emergency stop
     */
    public void requestStop(boolean emergency);

    /** Get total number of samples*/
    public long getTotalSamples();

    public String getMessage(int code);
    
    /** Get sample rate*/
    public int getSampleRate();



}
