001package jmri.jmrix.roco; 002 003import jmri.LocoAddress; 004import jmri.jmrix.lenz.XNetSystemConnectionMemo; 005import jmri.jmrix.lenz.XNetTrafficController; 006import org.slf4j.Logger; 007import org.slf4j.LoggerFactory; 008 009/** 010 * An implementation of DccThrottle with code specific to a Roco XpressNet 011 * connection. 012 * 013 * @author Paul Bender (C) 2015 014 * @author Giorgio Terdina (C) 2007 015 */ 016public class RocoXNetThrottle extends jmri.jmrix.lenz.XNetThrottle { 017 018 /** 019 * Constructor. 020 * @param memo system connection. 021 * @param controller traffic controller. 022 */ 023 public RocoXNetThrottle(XNetSystemConnectionMemo memo, XNetTrafficController controller) { 024 super(memo,controller); 025 } 026 027 /** 028 * Constructor. 029 * @param memo system connection. 030 * @param address loco address. 031 * @param controller traffic controller. 032 */ 033 public RocoXNetThrottle(XNetSystemConnectionMemo memo, LocoAddress address, XNetTrafficController controller) { 034 super(memo,address,controller); 035 } 036 037 // The Roco doesn't support setting the momentary/continuous status of 038 // functions, so override the sending of all momentary/continuous 039 // from the parent class. 040 @Override 041 protected void sendMomentaryFunctionGroup1() { 042 log.debug("Command station does not support Momentary functions"); 043 } 044 045 @Override 046 protected void sendMomentaryFunctionGroup2() { 047 log.debug("Command station does not support Momentary functions"); 048 } 049 050 @Override 051 protected void sendMomentaryFunctionGroup3() { 052 log.debug("Command station does not support Momentary functions"); 053 } 054 055 @Override 056 protected void sendMomentaryFunctionGroup4() { 057 log.debug("Command station does not support Momentary functions"); 058 } 059 060 @Override 061 protected void sendMomentaryFunctionGroup5() { 062 log.debug("Command station does not support Momentary functions"); 063 } 064 065 // also prevent requesting the momentary status information 066 @Override 067 synchronized protected void sendFunctionStatusInformationRequest() { 068 log.debug("Command station does not support Momentary functions"); 069 } 070 071 @Override 072 synchronized protected void sendFunctionHighMomentaryStatusRequest() { 073 log.debug("Command station does not support Momentary functions"); 074 } 075 076 // The Roco Doesn't support the XpressNet directed emergency stop 077 // instruction, so override sendEmergencyStop in the parent, and 078 // just send speed step 0. 079 @Override 080 protected void sendEmergencyStop(){ 081 setSpeedSetting(0); 082 } 083 084 /** 085 * Dispose when finished with this object. After this, further usage of this 086 * Throttle object will result in a JmriException. 087 * <p> 088 * This is quite problematic, because a using object doesn't know when it's 089 * the last user. 090 */ 091 @Override 092 public void throttleDispose() { 093 active = false; 094 stopStatusTimer(); 095 finishRecord(); 096 } 097 098 // register for notification 099 private final static Logger log = LoggerFactory.getLogger(RocoXNetThrottle.class); 100 101}