001/* Mx1ProgrammerManager.java */ 002package jmri.jmrix.zimo; 003 004import jmri.AddressedProgrammer; 005import jmri.Programmer; 006import jmri.managers.DefaultProgrammerManager; 007 008/** 009 * Extend DefaultProgrammerManager to provide ops mode programmers for Zimo 010 * systems. Adding operations mode programming support July 2022. 011 * 012 * @see jmri.managers.DefaultProgrammerManager 013 * @author Bob Jacobsen Copyright (C) 2002 014 * @author Ken Cameron Copyright (C) 2014 015 * @author Kevin Dickerson Copyright (C) 2014 016 * @author Alger Pike Copyright (c) 2022 017 * 018 * 019 */ 020public class Mx1ProgrammerManager extends DefaultProgrammerManager { 021 022 private Mx1SystemConnectionMemo _memo = null; 023 024 public Mx1ProgrammerManager(Programmer serviceModeProgrammer, Mx1SystemConnectionMemo memo) { 025 super(serviceModeProgrammer, memo); 026 _memo = memo; 027 } 028 029 /** 030 * {@inheritDoc} 031 */ 032 @Override 033 public boolean isAddressedModePossible() { 034 if (_memo.getConnectionType() == Mx1SystemConnectionMemo.MXULF || _memo.getConnectionType() == Mx1SystemConnectionMemo.KLUG) 035 { 036 037 // currently only supporting MXULF and KLUG. In theory I think any Zimo 038 // system that supports the binary protocol would work but I am 039 // unable to test said systems. 040 return true; 041 } 042 else 043 { 044 return false; 045 } 046 } 047 048 @Override 049 public boolean isGlobalProgrammerAvailable() { 050 return true; 051 } 052 053 /** 054 * {@inheritDoc} 055 */ 056 @Override 057 protected AddressedProgrammer getConcreteAddressedProgrammer(boolean pLongAddress, int pAddress) { 058 if (_memo.getConnectionType() == Mx1SystemConnectionMemo.MXULF || _memo.getConnectionType() == Mx1SystemConnectionMemo.KLUG) 059 { 060 061 // currently only supporting MXULF and KLUG. In theory I think any Zimo 062 // system that supports the binary protocol would work but I am 063 // unable to test said systems. 064 return new Mx1OpsModeProgrammer(pAddress, pLongAddress, _memo.getMx1TrafficController()); 065 } 066 else 067 { 068 return null; 069 } 070 } 071 072 @Override 073 protected AddressedProgrammer reserveConcreteAddressedProgrammer(boolean pLongAddress, int pAddress) { 074 return null; 075 } 076}