001package jmri.jmrix.dccpp.dccppovertcp; 002 003import jmri.jmrix.dccpp.DCCppConstants; 004import org.slf4j.Logger; 005import org.slf4j.LoggerFactory; 006 007/** 008 * Definition of objects to handle configuring a DCC++OverTcp layout 009 * connection via a DCCppTcpDriverAdapter object. 010 * 011 * @author Bob Jacobsen Copyright (C) 2001, 2003 012 * @author Stephen Williams Copyright (C) 2008 013 * @author Mark Underwood Copyright (C) 2015 014 * 015 * Based on LocoNetOverTCP 016 */ 017public class ConnectionConfig extends jmri.jmrix.AbstractNetworkConnectionConfig { 018 019 /** 020 * Ctor for an object being created during load process; Swing init is 021 * deferred. 022 */ 023 public ConnectionConfig() { 024 super(); 025 } 026 027 /** 028 * Ctor for a connection configuration with no preexisting adapter. 029 * {@link #setInstance()} will fill the adapter member. 030 * @param p network port adapter. 031 */ 032 public ConnectionConfig(jmri.jmrix.NetworkPortAdapter p) { 033 super(p); 034 log.info("NetworkPortAdapter opening. Is DCC++ Over TCP Server running on host?"); 035 } 036 037 @Override 038 public String name() { 039 return "DCC++ Server"; 040 } 041 042 public boolean isOptList1Advanced() { 043 return false; 044 } 045 046 /** 047 * {@inheritDoc} 048 */ 049 @Override 050 protected void setInstance() { 051 if (adapter == null) { 052 adapter = new DCCppTcpDriverAdapter(); 053 adapter.setPort(DCCppConstants.DCCPP_OVER_TCP_PORT); // TODO: Choose another port? 054 } 055 } 056 057 private static final Logger log = LoggerFactory.getLogger(ConnectionConfig.class); 058 059}