001package jmri.jmrix.marklin.simulation;
002
003import java.io.DataInputStream;
004import java.io.DataOutputStream;
005
006import jmri.jmrix.ConnectionStatus;
007import jmri.jmrix.marklin.MarklinPortController;
008import jmri.jmrix.marklin.MarklinSystemConnectionMemo;
009
010/**
011 * Implements NetworkPortAdapter for a simulated Marklin network connection.
012 * @author Bob Jacobsen Copyright (C) 2001, 2002, 2003, 2008
013 * @author Kevin Dickerson Copyright (C) 2012
014 * @author Steve Young Copyright (C) 2024
015 */
016public class MarklinSimDriverAdapter extends MarklinPortController {
017
018    public MarklinSimDriverAdapter() {
019        super(new MarklinSystemConnectionMemo());
020        getSystemConnectionMemo().setUserName("Marklin CS2 Simulation");
021        allowConnectionRecovery = false;
022        manufacturerName = jmri.jmrix.marklin.MarklinConnectionTypeList.MARKLIN;
023        m_port = 15731;
024    }
025
026    @Override
027    public void connect() {
028        opened = true;
029        ConnectionStatus.instance().setConnectionState(
030            null, m_HostName, ConnectionStatus.CONNECTION_UP);
031    }
032
033    @Override
034    public DataInputStream getInputStream() {
035        return null;
036    }
037
038    @Override
039    public DataOutputStream getOutputStream() {
040        return null;
041    }
042
043    /**
044     * Set up all of the other objects to operate with a Marklin command station
045     * connected to this port.
046     */
047    @Override
048    public void configure() {
049        // connect to the traffic controller
050        MarklinSimTrafficController tc = new MarklinSimTrafficController();
051        tc.setAdapterMemo(getSystemConnectionMemo());
052        getSystemConnectionMemo().setMarklinTrafficController(tc);
053        getSystemConnectionMemo().configureManagers();
054    }
055
056    @Override
057    public boolean status() {
058        return true;
059    }
060
061    // private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(MarklinSimDriverAdapter.class);
062
063}