001package jmri.jmrix.bachrus.kpfserialdriver;
002
003import jmri.util.SystemType;
004
005/**
006 * Definition of objects to handle configuring a connection via a Bachrus
007 * SerialDriverAdapter object.
008 *
009 * @author Bob Jacobsen Copyright (C) 2001, 2003
010 * @author Andrew Crosland Copyright (C) 2010
011 */
012public class ConnectionConfig extends jmri.jmrix.AbstractSerialConnectionConfig {
013
014    /**
015     * Create a connection configuration with a preexisting adapter. This is
016     * used principally when loading a configuration that defines this
017     * connection.
018     *
019     * @param p the adapter to create a connection configuration for
020     */
021    public ConnectionConfig(jmri.jmrix.SerialPortAdapter p) {
022        super(p);
023    }
024
025    /**
026     * Ctor for a connection configuration with no preexisting adapter.
027     * {@link #setInstance()} will fill the adapter member.
028     */
029    public ConnectionConfig() {
030        super();
031    }
032
033    @Override
034    public String name() {
035        return "Speedo"; // NOI18N
036    }
037
038    @Override
039    protected String[] getPortFriendlyNames() {
040        if (SystemType.isWindows()) {
041            return new String[]{"Bachrus Speedo", "Bachrus"};
042        }
043        return new String[]{};
044    }
045
046    /**
047     * {@inheritDoc}
048     */
049    @Override
050    protected void setInstance() {
051        if (adapter == null) {
052            adapter = new SerialDriverAdapter();
053        }
054    }
055
056}