001package jmri.jmrix.srcp.networkdriver;
002
003/**
004 * Definition of objects to handle configuring an EasyDCC layout connection via
005 * a NetworkDriverAdapter object.
006 *
007 * @author Bob Jacobsen Copyright (C) 2001, 2003
008 */
009public class ConnectionConfig extends jmri.jmrix.AbstractNetworkConnectionConfig {
010
011    /**
012     * Create a connection configuration with a preexisting adapter. This is
013     * used principally when loading a configuration that defines this
014     * connection.
015     *
016     * @param p the adapter to create a connection configuration for
017     */
018    public ConnectionConfig(jmri.jmrix.NetworkPortAdapter p) {
019        super(p);
020    }
021
022    /**
023     * Ctor for a connection configuration with no preexisting adapter.
024     * {@link #setInstance()} will fill the adapter member.
025     */
026    public ConnectionConfig() {
027        super();
028    }
029
030    @Override
031    public String name() {
032        return "SRCP Network Connection";
033    }
034
035    /**
036     * {@inheritDoc}
037     */
038    @Override
039    protected void setInstance() {
040        if (adapter == null) {
041            adapter = new NetworkDriverAdapter();
042            adapter.setPort(4303); // 4303 is assigned to SRCP by IANA
043        }
044    }
045
046    @Override
047    public boolean isPortAdvanced() {
048        return false;
049    }
050
051}