001package jmri.jmrix.roco.z21; 002 003 004import jmri.jmrix.ConnectionStatus; 005import jmri.jmrix.lenz.LenzCommandStation; 006import jmri.jmrix.lenz.XNetPacketizer; 007import org.slf4j.Logger; 008import org.slf4j.LoggerFactory; 009 010/** 011 * Extension of the XNetPacketizer for Roco: the Roco Z21 XpressNet 012 * Tunnel. 013 * 014 * @author Paul Bender Copyright (C) 2017 015 */ 016public class Z21XNetPacketizer extends XNetPacketizer { 017 018 /** 019 * Must provide a LenzCommandStation reference at creation time. 020 * 021 * @param pCommandStation reference to associated command station object, 022 * preserved for later. 023 */ 024 Z21XNetPacketizer(LenzCommandStation pCommandStation) { 025 super(pCommandStation); 026 } 027 028 @Override 029 public void handleOneIncomingReply() { 030 try{ 031 super.handleOneIncomingReply(); 032 } catch(java.io.IOException ioe){ 033 log.info("Z21 XpressNet Connection Terminated"); 034 ConnectionStatus.instance().setConnectionState(controller.getUserName(), controller.getCurrentPortName(), ConnectionStatus.CONNECTION_DOWN); 035 terminateThreads(); 036 } 037 } 038 039 private static final Logger log = LoggerFactory.getLogger(Z21XNetPacketizer.class); 040 041}