001package jmri.jmrix.powerline.simulator;
002
003import jmri.Light;
004import jmri.jmrix.powerline.SerialTrafficController;
005
006/**
007 * Implement LightManager for powerline serial systems with Insteon 2412S
008 * adapters
009 * <p>
010 * Just provide the specific objects at creation time.
011 *
012 * @author Dave Duchamp Copyright (C) 2004
013 * @author Bob Jacobsen Copyright (C) 2006, 2007, 2008, 2009 Converted to
014 * multiple connection
015 * @author kcameron Copyright (C) 2011
016 */
017public class SpecificLightManager extends jmri.jmrix.powerline.SerialLightManager {
018
019    public SpecificLightManager(SerialTrafficController tc) {
020        super(tc);
021        this.tc = tc;
022    }
023
024    SerialTrafficController tc = null;
025
026    /**
027     * Create light of a specific type for the interface
028     */
029    @Override
030    protected Light createNewSpecificLight(String systemName, String userName) {
031        if (isInsteon(systemName)) {
032            return new SpecificInsteonLight(systemName, tc, userName);
033        } else {
034            return new SpecificX10Light(systemName, tc, userName);
035        }
036    }
037
038    boolean isInsteon(String systemName) {
039        return tc.getAdapterMemo().getSerialAddress().isInsteon(systemName);
040    }
041
042}