001package jmri.jmrix.nce.networkdriver; 002 003import jmri.jmrix.nce.NceCmdStationMemory; 004import jmri.jmrix.nce.NceNetworkPortController; 005import jmri.jmrix.nce.NceSystemConnectionMemo; 006import jmri.jmrix.nce.NceTrafficController; 007 008/** 009 * Implements SerialPortAdapter for the NCE system network connection. 010 * <p> 011 * This connects an NCE command station via a telnet connection. Normally 012 * controlled by the NetworkDriverFrame class. 013 * 014 * @author Bob Jacobsen Copyright (C) 2001, 2002, 2003 015 * @author Ken Cameron Copyright (C) 2023 016 */ 017public class NetworkDriverAdapter extends NceNetworkPortController { 018 019 public NetworkDriverAdapter() { 020 super(new NceSystemConnectionMemo()); 021 option2Name = "Eprom"; 022 // the default is 2006 or later 023 options.put(option2Name, new Option("Command Station EPROM", new String[]{"2006 or later", "2004 or earlier"})); 024 setManufacturer(jmri.jmrix.nce.NceConnectionTypeList.NCE); 025 } 026 027 /** 028 * set up all of the other objects to operate with an NCE command station 029 * connected to this port 030 */ 031 @Override 032 public void configure() { 033 NceTrafficController tc = new NceTrafficController(); 034 this.getSystemConnectionMemo().setNceTrafficController(tc); 035 tc.setAdapterMemo(this.getSystemConnectionMemo()); 036 037 // set the command options, Note that the NetworkDriver uses 038 // the second option for EPROM revision 039 if (getOptionState(option2Name).equals(getOptionChoices(option2Name)[0])) { 040 // setting binary mode 041 this.getSystemConnectionMemo().configureCommandStation(NceTrafficController.OPTION_2006); 042 this.getSystemConnectionMemo().setNceCmdGroups(~NceTrafficController.CMDS_USB); 043 } else { 044 this.getSystemConnectionMemo().configureCommandStation(NceTrafficController.OPTION_2004); 045 this.getSystemConnectionMemo().setNceCmdGroups(~NceTrafficController.CMDS_USB); 046 } 047 048 tc.csm = new NceCmdStationMemory(); 049 tc.connectPort(this); 050 051 this.getSystemConnectionMemo().configureManagers(); 052 } 053 054}