001package jmri.jmrix.bidib.bidibovertcp; 002 003import javax.swing.JPanel; 004import jmri.jmrix.bidib.BiDiBConstants; 005import org.bidib.jbidibc.net.serialovertcp.NetBidib; 006import org.slf4j.Logger; 007import org.slf4j.LoggerFactory; 008 009/** 010 * Definition of objects to handle configuring a BiDiB OverTcp layout 011 * connection via a BiDiBTcpDriverAdapter object. 012 * 013 * @author Bob Jacobsen Copyright (C) 2001, 2003 014 * @author Stephen Williams Copyright (C) 2008 015 * @author Mark Underwood Copyright (C) 2015 016 * @author Eckart Meyer Copyright (C) 2023 017 * 018 * Based on DCCppNetOverTCP 019 */ 020public class ConnectionConfig extends jmri.jmrix.AbstractNetworkConnectionConfig { 021 022 public final static String NAME = "BiDiB over TCP"; //text to show in ComboBox 023 024 /** 025 * Ctor for an object being created during load process; Swing init is 026 * deferred. 027 */ 028 public ConnectionConfig() { 029 super(); 030 } 031 032 /** 033 * Ctor for a connection configuration with no preexisting adapter. 034 * {@link #setInstance()} will fill the adapter member. 035 * @param p network port adapter. 036 */ 037 public ConnectionConfig(jmri.jmrix.NetworkPortAdapter p) { 038 super(p); 039 log.info("NetworkPortAdapter opening."); 040 } 041 042 @Override 043 public String name() { 044 return NAME; 045 } 046 047 public boolean isOptList1Advanced() { 048 return false; 049 } 050 051 /** 052 * {@inheritDoc} 053 */ 054 @Override 055 protected void setInstance() { 056 if (adapter == null) { 057 adapter = new BiDiBOverTcpAdapter(); 058 adapter.setPort(NetBidib.BIDIB_UDP_PORT_NUMBER); 059 adapter.setHostName(BiDiBConstants.BIDIB_OVER_TCP_DEFAULT_HOST); 060 } 061 } 062 063 /** 064 * {@inheritDoc} 065 */ 066 @Override 067 public void loadDetails(JPanel details) { 068 super.loadDetails(details); 069 //hostNameField.setText(BiDiBConstants.BIDIB_OVER_TCP_DEFAULT_HOST); 070 portFieldLabel.setText("TCP Port"); 071// portField.setText(String.valueOf(LIUSBServerAdapter.COMMUNICATION_TCP_PORT)); 072 } 073 074 075 private static final Logger log = LoggerFactory.getLogger(ConnectionConfig.class); 076 077}