001package jmri.jmrix.nce.usbdriver;
002
003import jmri.util.SystemType;
004
005/**
006 * Definition of objects to handle configuring an LocoBuffer layout connection
007 * via an NCE SerialDriverAdapter object.
008 *
009 * @author Bob Jacobsen Copyright (C) 2001, 2003
010 * @author Daniel Boudreau Copyright (C) 2007
011 */
012public class ConnectionConfig extends jmri.jmrix.AbstractSerialConnectionConfig {
013
014    public final static String NAME = "NCE USB"; // NOI18N
015
016    /**
017     * Ctor for an object being created during load process; Swing init is
018     * deferred.
019     * @param p SerialPortAdapter to configure
020     */
021    public ConnectionConfig(jmri.jmrix.SerialPortAdapter p) {
022        super(p);
023    }
024
025    /**
026     * Ctor for a functional Swing object with no existing adapter
027     */
028    public ConnectionConfig() {
029        super();
030    }
031
032    @Override
033    public String name() {
034        return NAME;
035    }
036
037    public boolean isOptList1Advanced() {
038        return false;
039    }
040
041    /**
042     * {@inheritDoc}
043     */
044    @Override
045    protected void setInstance() {
046        if (adapter == null) {
047            adapter = new UsbDriverAdapter();
048        }
049    }
050
051    @Override
052    protected String[] getPortFriendlyNames() {
053        if (SystemType.isWindows()) {
054            return new String[]{"Silicon Labs CP210x USB to UART Bridge", "Silicon Labs CP210x"}; // NOI18N
055        }
056        return new String[]{};
057    }
058
059}