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 } 030 031 /** {@inheritDoc} */ 032 @Override 033 public int getMaximumLength() { 034 return 8; 035 } 036 037 /** {@inheritDoc} */ 038 @Override 039 protected boolean cutLongStrings() { 040 return true; 041 } 042 043}