Package jmri.jmrix

Class UsbPortAdapter

    • Field Detail

      • usbDevice

        protected javax.usb.UsbDevice usbDevice
    • Method Detail

      • setVendorID

        public void setVendorID​(java.lang.Short value)
      • setProductID

        public void setProductID​(java.lang.Short value)
      • getSerialNumber

        public java.lang.String getSerialNumber()
        Get the device serial number.
        the serial number or null if there is no serial number
      • setSerialNumber

        public void setSerialNumber​(java.lang.String serialNumber)
        Set the device serial number.
        serialNumber - the serial number; if null, empty, or only containing whitespace, sets property to null
      • openPort

        public java.lang.String openPort​(java.lang.String portName,
                                         java.lang.String serialNumber)
      • connect

        public void connect()
        Open the connection.
        Throws: - if unable to connect
      • recover

        public void recover()
        This is called when a connection is initially lost. After checking the allowConnectionRecovery flag, closes the connection, resets the open flag and attempts a reconnection.
        Specified by:
        recover in interface PortAdapter
        recover in class AbstractPortController
      • configure

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

        public java.util.List<java.lang.String> getPortNames()
        Get the list of USB locations with devices matching a single vendor/product ID combination. These are "portNames" to match the calling API.
        the list of locations with matching devices; this is an empty list if there are no matches
      • setPort

        public void setPort​(java.lang.String s)
      • sendControlTransfer

        public boolean sendControlTransfer​(int requestType,
                                           int request,
                                           int value,
                                           int index,
                                           byte[] data)
        send USB control transfer
        requestType - the request type
        request - the request
        value - the value
        index - the index
        data - the data
        true if successful sent