001package jmri.implementation;
002
003import jmri.LocoAddress;
004import jmri.RailCom;
005
006/**
007 * Extend AbstractReporter for RailCom reporters
008 * <p>
009 * This file is based on @{link jmri.jmrix.rfid.RfidReporter}
010 *
011 * @author Matthew Harris Copyright (c) 2011
012 * @author Paul Bender Copyright (c) 2016,2019
013 * @since 4.5.4
014 */
015public class AbstractRailComReporter extends AbstractIdTagReporter {
016
017    public AbstractRailComReporter(String systemName) {
018        super(systemName);
019    }
020
021    public AbstractRailComReporter(String systemName, String userName) {
022        super(systemName, userName);
023    }
024
025    // Methods to support PhysicalLocationReporter interface
026    
027    /**
028     * Get the locomotive address we're reporting about from the current report.
029     *
030     * Note: We ignore the string passed in, because RailCom Reporters don't send
031     * String type reports.
032     * {@inheritDoc}
033     */
034    @Override
035    public LocoAddress getLocoAddress(String rep) {
036        // For now, we assume the current report.
037        // IdTags passed by RailCom reporters are actually jmri.RailCom objects
038        // so we use properties of the RailCom object here.
039        RailCom cr = (RailCom) this.getCurrentReport();
040        return cr.getLocoAddress();
041    }
042
043}