Package jmri.jmrix

Interface PortAdapter

    • Method Detail

      • configure

        void configure()
        Configure all of the other jmrix widgets needed to work with this adapter.
      • status

        boolean status()
        Query the status of this connection. This is a question of configuration, not transient hardware status.
        Returns:
        true if OK, at least as far as known
      • connect

        void connect()
              throws java.io.IOException
        Open the connection.
        Throws:
        java.io.IOException - if unable to connect
      • getInputStream

        java.io.DataInputStream getInputStream()
        Get the InputStream from the port.
        Returns:
        the InputStream from the port
      • getOutputStream

        java.io.DataOutputStream getOutputStream()
        Get the outputStream to the port.
        Returns:
        the outputStream to the port
      • configureOption1

        void configureOption1​(java.lang.String value)
        Set the first port option. Only to be used after construction, but before the openPort call.
        Parameters:
        value - to set the option to
      • configureOption2

        void configureOption2​(java.lang.String value)
        Set the second port option. Only to be used after construction, but before the openPort call.
        Parameters:
        value - to set the option to
      • configureOption3

        void configureOption3​(java.lang.String value)
        Set the third port option. Only to be used after construction, but before the openPort call.
        Parameters:
        value - to set the option to
      • configureOption4

        void configureOption4​(java.lang.String value)
        Set the fourth port option. Only to be used after construction, but before the openPort call.
        Parameters:
        value - to set the option to
      • getOptions

        java.lang.String[] getOptions()
        Get a list of all the options configured against this adapter.
        Returns:
        Array of option identifier strings
      • setOptionState

        void setOptionState​(java.lang.String option,
                            java.lang.String value)
        Set the value of an option.
        Parameters:
        option - the name string of the option
        value - the string value to set the option to
      • getOptionState

        java.lang.String getOptionState​(java.lang.String option)
        Get the string value of a specific option.
        Parameters:
        option - the name of the option to query
        Returns:
        the option value
      • getOptionChoices

        java.lang.String[] getOptionChoices​(java.lang.String option)
        Get a list of the various choices allowed with an given option.
        Parameters:
        option - the name of the option to query
        Returns:
        list of valid values for the option
      • isOptionTypeText

        boolean isOptionTypeText​(java.lang.String option)
        Should this option be represented by a text field (as opposed to a JCombobox)
        Parameters:
        option - Name of the option to check
        Returns:
        true for text representation preferred
      • isOptionTypePassword

        boolean isOptionTypePassword​(java.lang.String option)
        Should this option be represented by a password field
        Parameters:
        option - Name of the option to check
        Returns:
        true for text representation preferred
      • getManufacturer

        java.lang.String getManufacturer()
        Get the system manufacturer's name.
        Returns:
        manufacturer's name
      • setManufacturer

        void setManufacturer​(java.lang.String Manufacturer)
        Set the system manufacturer's name.
        Parameters:
        Manufacturer - the manufacturer's name
      • getDisabled

        boolean getDisabled()
        Return the disabled state of the adapter.
        Returns:
        true if disabled
      • setDisabled

        void setDisabled​(boolean disabled)
        Set whether the connection is disabled.
        Parameters:
        disabled - When true, disables operation
      • getUserName

        java.lang.String getUserName()
        Get the user name for this adapter.
        Returns:
        the username or null
      • setUserName

        void setUserName​(java.lang.String userName)
                  throws java.lang.IllegalArgumentException
        Set the user name for this adapter.
        Parameters:
        userName - the new user name
        Throws:
        java.lang.IllegalArgumentException - if another adapter has this user name
      • getSystemPrefix

        java.lang.String getSystemPrefix()
        Get the system prefix for this adapter.
        Returns:
        the system prefix or null
      • setSystemPrefix

        void setSystemPrefix​(java.lang.String systemPrefix)
                      throws java.lang.IllegalArgumentException
        Set the system prefix for this adapter.
        Parameters:
        systemPrefix - the new system prefix
        Throws:
        java.lang.IllegalArgumentException - if another adapter has this system prefix
      • setSystemConnectionMemo

        void setSystemConnectionMemo​(SystemConnectionMemo connectionMemo)
                              throws java.lang.IllegalArgumentException
        Replace the existing SystemConnectionMemo with another one. Overriding methods should throw an IllegalAccessException if the overriding class requires a specific subclass of SystemConnectionMemo. A NullPointerException should be thrown if the parameter is null.
        Parameters:
        connectionMemo - the new connection memo
        Throws:
        java.lang.IllegalArgumentException - if connectionMemo is the wrong subclass of SystemConnectionMemo
        java.lang.NullPointerException - if connectionMemo is null
      • dispose

        void dispose()
        This is called when a connection is to be disposed.
      • recover

        void recover()
        This is called when a connection is initially lost.
      • isDirty

        boolean isDirty()
        Determine if configuration needs to be written to disk.
        Returns:
        true if configuration needs to be saved, false otherwise
      • isRestartRequired

        boolean isRestartRequired()
        Determine if application needs to be restarted for configuration changes to be applied.
        Returns:
        true if application needs to restart, false otherwise
      • setReconnectMaxInterval

        void setReconnectMaxInterval​(int maxInterval)
        Set the maximum interval between reconnection attempts.
        Parameters:
        maxInterval - in seconds.
      • setReconnectMaxAttempts

        void setReconnectMaxAttempts​(int maxAttempts)
        Set the maximum number of reconnection attempts. -1 will set an infinite number of attempts.
        Parameters:
        maxAttempts - total maximum reconnection attempts.
      • getReconnectMaxInterval

        int getReconnectMaxInterval()
        Get the maximum interval between reconnection attempts.
        Returns:
        maximum interval in seconds.
      • getReconnectMaxAttempts

        int getReconnectMaxAttempts()
        Get the maximum number of reconnection attempts which should be made. A value of -1 means no maximum value, i.e. infinite attempts.
        Returns:
        total number of attempts which should be made.