001package jmri.jmrix.easydcc.simulator;
002
003/**
004 * Handle configuring an EasyDCC layout connection via an EasyDccSimulator
005 * adapter.
006 * <p>
007 * This uses the {@link SimulatorAdapter} class to do the actual (virtual) connection.
008 *
009 * @author Bob Jacobsen Copyright (C) 2001, 2003
010 * @author Paul Bender Copyright (C) 2009
011 * @author Mark Underwood Copyright (C) 2015
012 *
013 * @see SimulatorAdapter
014 *
015 * Based on jmri.jmrix.lenz.xnetsimulator.ConnectionConfig, copied from DCCpp
016 */
017public class ConnectionConfig extends jmri.jmrix.AbstractSimulatorConnectionConfig {
018
019    /**
020     * Ctor for an object being created during load process; Swing init is
021     * deferred.
022     * @param p serial port adapter.
023     */
024    public ConnectionConfig(jmri.jmrix.SerialPortAdapter p) {
025        super(p);
026    }
027
028    /**
029     * Ctor for a connection configuration with no preexisting adapter.
030     * {@link #setInstance()} will fill the adapter member.
031     */
032    public ConnectionConfig() {
033        super();
034    }
035
036    @Override
037    public String name() {
038        return "EasyDCC Simulator";
039    }
040
041    String manufacturerName = jmri.jmrix.easydcc.EasyDccConnectionTypeList.EASYDCC;
042
043    @Override
044    public String getManufacturer() {
045        return manufacturerName;
046    }
047
048    @Override
049    public void setManufacturer(String manu) {
050        manufacturerName = manu;
051    }
052
053    /**
054     * {@inheritDoc}
055     */
056    @Override
057    protected void setInstance() {
058        if (adapter == null) {
059            adapter = new SimulatorAdapter();
060        }
061    }
062
063}