Class SerialDriverAdapter

    • Method Detail

      • getPortNameFilter

        public java.lang.String getPortNameFilter()
        Get the filter string for port names to scan when autoScan is on
        Returns:
        port name filter as a string (wildcard is allowed at the end)
      • setPortNameFilter

        public void setPortNameFilter​(java.lang.String filter)
        Set the port name filter
        Parameters:
        filter - filter string
      • getRootNodeUid

        public java.lang.Long getRootNodeUid()
        Get the root node unique ID
        Returns:
        UID as Long
      • setRootNodeUid

        public void setRootNodeUid​(java.lang.Long uid)
        Set the root node unique ID
        Parameters:
        uid - Unique ID as Long
      • getUseAutoScan

        public boolean getUseAutoScan()
        Get the AutoScan status
        Returns:
        true of autoScan is on, false if not
      • setUseAutoScan

        public void setUseAutoScan​(boolean flag)
        Set the AutoScan status
        Parameters:
        flag - true of ON is requested
      • getCanonicalPortName

        public static java.lang.String getCanonicalPortName​(java.lang.String portName)
        Get the canonical port name from the underlying operating system. For a symbolic link, the real path is returned.
        Parameters:
        portName - human-readable name
        Returns:
        canonical path
      • getRealPortName

        public static java.lang.String getRealPortName​(java.lang.String portName)
        Static function to get the port name in the format which is used by jbidibc
        Parameters:
        portName - displayed port name
        Returns:
        real port name
      • openPort

        public java.lang.String openPort​(java.lang.String portName,
                                         java.lang.String appName)
        This methods is called from serial connection config and creates the BiDiB object from jbidibc and opens it. The connectPort method of the traffic controller is called for generic initialisation.
        Parameters:
        portName - port name from XML
        appName - not used
        Returns:
        error string to be displayed by JMRI. null of no error
      • configure

        public void configure()
        Set up all of the other objects to operate with an BiDiB command station connected to this port.
      • registerAllListeners

        public void registerAllListeners​(org.bidib.jbidibc.messages.ConnectionListener connectionListener,
                                         java.util.Set<org.bidib.jbidibc.core.NodeListener> nodeListeners,
                                         java.util.Set<org.bidib.jbidibc.core.MessageListener> messageListeners,
                                         java.util.Set<org.bidib.jbidibc.core.node.listener.TransferListener> transferListeners)
        Register all Listeners to the specific BiDiB Object. We need this here since the BidibInterface does not provide this method.
        Specified by:
        registerAllListeners in interface BiDiBPortController
        Specified by:
        registerAllListeners in class BiDiBSerialPortController
        Parameters:
        connectionListener - where to add
        nodeListeners - listeners to add
        messageListeners - listeners to add
        transferListeners - listeners to add
      • getPortIdentifiers

        public java.util.List<java.lang.String> getPortIdentifiers()
        Get a list of available port names
        Returns:
        list of portnames
      • findPortbyUniqueID

        public java.lang.String findPortbyUniqueID​(java.lang.Long requid)
        Internal method to find a port, possibly with already created BiDiB object
        Parameters:
        requid - requested unique ID of the root node
        Returns:
        port name as String
      • checkPort

        public java.lang.Long checkPort​(java.lang.String portName)
        Internal method to check if the given port is a BiDiB connection and returns the unique ID of the root node. Return the UID from cache if we already know the UID. // * @param bidib a BiDiB object from jbidibc
        Parameters:
        portName - port name to check
        Returns:
        unique ID of the root node
      • getKownPortName

        public java.lang.String getKownPortName​(java.lang.Long reqUid)
        Check if the port name of a given UID already exists in the cache.
        Parameters:
        reqUid - requested UID
        Returns:
        port name or null if not found in cache