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 * Works with command station to provide Ops Mode, so say it works 031 * 032 * @return true 033 */ 034 @Override 035 public boolean isAddressedModePossible() { 036 if (_memo.getConnectionType() == Mx1SystemConnectionMemo.MXULF) 037 { 038 039 // currently only supporting MXULF. In theory I think any Zimo 040 // system that supports the binary protocol would work but I am 041 // unable to test said systems. 042 return true; 043 } 044 else 045 { 046 return false; 047 } 048 } 049 050 @Override 051 public boolean isGlobalProgrammerAvailable() { 052 return true; 053 } 054 055 @Override 056 public AddressedProgrammer getAddressedProgrammer(boolean pLongAddress, int pAddress) { 057 if (_memo.getConnectionType() == Mx1SystemConnectionMemo.MXULF) 058 { 059 060 // currently only supporting MXULF. In theory I think any Zimo 061 // system that supports the binary protocol would work but I am 062 // unable to test said systems. 063 return new Mx1OpsModeProgrammer(pAddress, pLongAddress, _memo.getMx1TrafficController()); 064 } 065 else 066 { 067 return null; 068 } 069 } 070 071 @Override 072 public AddressedProgrammer reserveAddressedProgrammer(boolean pLongAddress, int pAddress) { 073 return null; 074 } 075}