001package jmri.jmrix.sprog.sprog;
002
003import jmri.jmrix.sprog.serialdriver.SerialDriverAdapter;
004import jmri.util.SystemType;
005
006/**
007 * Definition of objects to handle configuring a layout connection via an SPROG
008 * SerialDriverAdapter object.
009 *
010 * @author Bob Jacobsen Copyright (C) 2001, 2003
011 */
012public class ConnectionConfig extends jmri.jmrix.AbstractSerialConnectionConfig {
013
014    /**
015     * Ctor for an object being created during load process; Swing init is
016     * deferred.
017     * @param p Serial port adapter.
018     */
019    public ConnectionConfig(jmri.jmrix.SerialPortAdapter p) {
020        super(p);
021    }
022
023    /**
024     * Ctor for a connection configuration with no preexisting adapter.
025     * {@link #setInstance()} will fill the adapter member.
026     */
027    public ConnectionConfig() {
028        super();
029    }
030
031    @Override
032    public String name() {
033        return "SPROG"; // NOI18N
034    }
035
036    @Override
037    protected String[] getPortFriendlyNames() {
038        if (SystemType.isWindows()) {
039            return new String[]{"SPROG"};
040        }
041        return new String[]{};
042    }
043
044    /**
045     * {@inheritDoc}
046     */
047    @Override
048    protected void setInstance() {
049        if(adapter == null) {
050           adapter = new SerialDriverAdapter();
051        }
052    }
053
054}