001package jmri.jmrix.dccpp;
002
003import java.io.DataInputStream;
004import java.io.DataOutputStream;
005
006/**
007 * Abstract base for classes representing a DCCpp communications port
008 *
009 * @author Bob Jacobsen Copyright (C) 2001, 2008
010 * @author Paul Bender Copyright (C) 2004,2010
011 * @author Mark Underwood Copyright (C) 2015
012  *
013 * Based on XNetSimulatorPortController by Bob Jacobsen, Paul Bender
014 */
015public abstract class DCCppSimulatorPortController extends jmri.jmrix.AbstractSerialPortController implements DCCppPortController {
016
017    public DCCppSimulatorPortController() {
018        super(new DCCppSystemConnectionMemo());
019    }
020
021    // base class. Implementations will provide InputStream and OutputStream
022    // objects to DCCppTrafficController classes, who in turn will deal in messages.    
023    // returns the InputStream from the port
024    @Override
025    public abstract DataInputStream getInputStream();
026
027    // returns the outputStream to the port
028    @Override
029    public abstract DataOutputStream getOutputStream();
030
031    /**
032     * Check that this object is ready to operate. This is a question of
033     * configuration, not transient hardware status.
034     */
035    @Override
036    public abstract boolean status();
037
038    /**
039     * Can the port accept additional characters? This might go false for short
040     * intervals, but it might also stick off if something goes wrong.
041     */
042    @Override
043    public abstract boolean okToSend();
044
045    /**
046     * We need a way to say if the output buffer is empty or not
047     */
048    @Override
049    public abstract void setOutputBufferEmpty(boolean s);
050
051    @Override
052    public DCCppSystemConnectionMemo getSystemConnectionMemo() {
053        return (DCCppSystemConnectionMemo) super.getSystemConnectionMemo();
054    }
055
056}
057
058
059