001/* TamsProgrammerManager.java */
002package jmri.jmrix.tams;
003
004import jmri.AddressedProgrammer;
005import jmri.Programmer;
006import jmri.managers.DefaultProgrammerManager;
007
008/**
009 * Extend DefaultProgrammerManager to provide ops mode programmers for NCE
010 * systems
011 *
012 * @see jmri.managers.DefaultProgrammerManager Based on work by Bob Jacobsen
013 * @author Kevin Dickerson Copyright (C) 2012
014 *
015 */
016public class TamsProgrammerManager extends DefaultProgrammerManager {
017
018    TamsTrafficController tc;
019
020    public TamsProgrammerManager(Programmer serviceModeProgrammer, TamsSystemConnectionMemo memo) {
021        super(serviceModeProgrammer, memo);
022        this.tc = memo.getTrafficController();
023    }
024
025    /**
026     * Works with command station to provide Ops Mode, so say it works
027     *
028     * @return true
029     */
030    @Override
031    public boolean isAddressedModePossible() {
032        return true;
033    }
034
035    /**
036     * Works with PH command station to provide Service Mode and USB connect to
037     * PowerCab.
038     *
039     * @return true if not USB connect to SB3
040     */
041    @Override
042    public boolean isGlobalProgrammerAvailable() {
043        return true;
044    }
045
046    @Override
047    public AddressedProgrammer getAddressedProgrammer(boolean pLongAddress, int pAddress) {
048        return new TamsOpsModeProgrammer(tc, pAddress, pLongAddress);
049    }
050
051    @Override
052    public AddressedProgrammer reserveAddressedProgrammer(boolean pLongAddress, int pAddress) {
053        return null;
054    }
055}