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