001package jmri.jmrix.jmriclient;
002
003/**
004 * Abstract base for classes representing a JMRIClient communications port
005 *
006 * @author Bob Jacobsen Copyright (C) 2001, 2008, 2010
007 * @author Paul Bender Copyright (C) 2010
008 */
009public abstract class JMRIClientPortController extends jmri.jmrix.AbstractNetworkPortController {
010
011    // base class. Implementations will provide InputStream and OutputStream
012    // objects to JMRIClientTrafficController classes, who in turn will deal in messages.
013    protected JMRIClientPortController(JMRIClientSystemConnectionMemo connectionMemo) {
014        super(connectionMemo);
015        allowConnectionRecovery=true;
016        setConnectionTimeout(30000);
017    }
018
019    @Override
020    public JMRIClientSystemConnectionMemo getSystemConnectionMemo() {
021        return (JMRIClientSystemConnectionMemo) super.getSystemConnectionMemo();
022    }
023
024    @Override
025    protected void resetupConnection() {
026       // reconnect the port to the traffic controller.
027       getSystemConnectionMemo().getJMRIClientTrafficController().connectPort(this);
028       // notify the memo that we've restarted, so it can ask the associated 
029       // managers to refresh status
030       getSystemConnectionMemo().requestAllStatus();       
031    }
032
033}