Package jmri

Interface AnalogIO

    • Method Detail

      • setCommandedAnalogValue

        void setCommandedAnalogValue​(double value)
                              throws JmriException
        Change the commanded value, which results in the relevant command(s) being sent to the hardware. The exception is thrown if there are problems communicating with the layout hardware.

        The value must be a valid number, not a NaN or infinity number.

        Parameters:
        value - the desired analog value
        Throws:
        JmriException - general error when setting the value fails
        java.lang.IllegalArgumentException - if the value is Double.NaN, Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY
      • getCommandedAnalogValue

        @CheckReturnValue
        double getCommandedAnalogValue()
        Query the commanded value. This is a bound parameter, so you can also register a listener to be informed of changes.

        The result must be a valid number, not a NaN or infinity number.

        Returns:
        the analog value
      • getKnownAnalogValue

        @CheckReturnValue
        default double getKnownAnalogValue()
        Query the known analog value. This is a bound parameter, so you can also register a listener to be informed of changes. A result is always returned; if no other feedback method is available, the commanded value will be used.

        The result must be a valid number, not a NaN or infinity number.

        Returns:
        the known analog value
      • setState

        @InvokeOnLayoutThread
        void setState​(double value)
               throws JmriException
        Provide generic access to internal state.

        This generally shouldn't be used by Java code; use the class-specific form instead (setCommandedAnalogValue). This is provided to make scripts access easier to read.

        Parameters:
        value - the analog value
        Throws:
        JmriException - general error when setting the state fails
      • getState

        @CheckReturnValue
        double getState​(double v)
        Provide generic access to internal state.

        This generally shouldn't be used by Java code; use the class-specific form instead (getCommandedAnalogValue). This is provided to make scripts easier to read.

        Parameters:
        v - only used to select this method which returns an analog value. It's recommended to use 0.0 as the parameter.
        Returns:
        the state
      • requestUpdateFromLayout

        default void requestUpdateFromLayout()
        Request an update from the layout soft/hardware. May not even happen, and if it does it will happen later; listen for the result.