001package jmri.jmrix.loconet; 002 003import jmri.JmriException; 004import jmri.implementation.AbstractStringIO; 005 006/** 007 * Send a message to the LocoNet throttles. 008 * 009 * @author Daniel Bergqvist Copyright (C) 2021 010 */ 011public class LnThrottleStringIO extends AbstractStringIO { 012 013 private final LocoNetSystemConnectionMemo _scm; 014 015 /** 016 * Create a LnThrottleStringIO object 017 * 018 * @param scm connection memo 019 */ 020 public LnThrottleStringIO(LocoNetSystemConnectionMemo scm) { 021 super(scm.getSystemPrefix()+"CThrottles", null); 022 this._scm = scm; 023 } 024 025 /** {@inheritDoc} */ 026 @Override 027 protected void sendStringToLayout(String value) throws JmriException { 028 _scm.getLnMessageManager().sendMessage(value); 029 // Sets the known string and fires listeners. 030 setString(value); 031 } 032 033 /** {@inheritDoc} */ 034 @Override 035 public int getMaximumLength() { 036 return 8; 037 } 038 039 /** {@inheritDoc} */ 040 @Override 041 protected boolean cutLongStrings() { 042 return true; 043 } 044 045}