001package jmri.jmrix.loconet.locobufferng;
002
003import jmri.jmrix.loconet.locobuffer.LocoBufferAdapter;
004import org.slf4j.Logger;
005import org.slf4j.LoggerFactory;
006
007/**
008 * Override {@link jmri.jmrix.loconet.locobuffer.LocoBufferAdapter} so that it refers to the
009 * (switch) settings on the LocoBuffer-NG.
010 *
011 * @author Bob Jacobsen Copyright (C) 2004, 2005, 2021
012 */
013public class LocoBufferNGAdapter extends LocoBufferAdapter {
014
015    public LocoBufferNGAdapter() {
016        super();
017        options.remove(option1Name);
018    }
019
020    @Override
021    protected void reportOpen(String portName) {
022        log.info("Connecting LocoBuffer-NG via {} {}", portName, currentSerialPort);
023    }
024
025    /**
026     * Always on flow control
027     */
028    @Override
029    protected void setLocalFlowControl() {
030        FlowControl flow = FlowControl.RTSCTS;
031        setFlowControl(currentSerialPort, flow);
032    }
033
034    /**
035     * {@inheritDoc}
036     */
037    @Override
038    public String[] validBaudRates() {
039        return new String[]{Bundle.getMessage("Baud57600")};
040    }
041
042    /**
043     * {@inheritDoc}
044     */
045    @Override
046    public int[] validBaudNumbers() {
047        return new int[]{57600};
048    }
049
050    @Override
051    public int defaultBaudIndex() {
052        return 0;
053    }
054
055    private final static Logger log = LoggerFactory.getLogger(LocoBufferNGAdapter.class);
056
057}