001package jmri; 002 003/** 004 * Interface for a Cab Signal Object, describing the state of the track ahead 005 * relative to a locomotive with a given address. This is effectively a mobile 006 * signal mast. 007 * 008 * <hr> 009 * This file is part of JMRI. 010 * <p> 011 * JMRI is free software; you can redistribute it and/or modify it under the 012 * terms of version 2 of the GNU General Public License as published by the Free 013 * Software Foundation. See the "COPYING" file for a copy of this license. 014 * <p> 015 * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY 016 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 017 * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 018 * 019 * @author Steve Young Copyright (C) 2018 020 * @author Paul Bender Copyright (C) 2019 021 */ 022public interface CabSignal { 023 024 /** 025 * A method for cleaning up the cab signal 026 */ 027 public void dispose(); 028 029 /** 030 * Get the LocoAddress associated with the consist 031 * 032 * @return the cab signal address 033 */ 034 public LocoAddress getCabSignalAddress(); 035 036 /** 037 * Set the Block of the locomotive by searching the block list. 038 */ 039 public void setBlock(); 040 041 /** 042 * Set the Block of the locomotive 043 * 044 * @param position is a Block the locomotive is in. 045 */ 046 public void setBlock(Block position); 047 048 /** 049 * Get the Block position of the locomotive associated with the cab signal. 050 * 051 * @return The current Block position 052 */ 053 public Block getBlock(); 054 055 /** 056 * Get the Next Block the locomotive is expected to enter. 057 * This value is calculated from the current block and direction 058 * of travel. 059 * 060 * @return The next Block position 061 */ 062 public Block getNextBlock(); 063 064 /** 065 * Get the Next Signal Mast the locomotive is expected to pass. 066 * This value may be calculated from the current block and direction 067 * of travel. 068 * 069 * @return The next SignalMast position 070 */ 071 public SignalMast getNextMast(); 072 073 /** 074 * Forward the current cab signal value to the layout. 075 */ 076 public void forwardCabSignalToLayout(); 077 078 /* 079 * get whether this cab signal is on or off 080 * 081 * @return true if on, false if off 082 */ 083 public boolean isCabSignalActive(); 084 085 /* 086 * set whether this cab signal is on or off 087 * 088 * @param active true if on, false if off 089 */ 090 public void setCabSignalActive(boolean active); 091 092 /* 093 * set whether a Master Cab signal button is on or off 094 * 095 * @param active true if on, false if off 096 */ 097 public void setMasterCabSigPauseActive(boolean active); 098 099 /** 100 * Add a listener for consist events 101 * 102 * @param listener is a PropertyChangeListener object 103 */ 104 public void addPropertyChangeListener(java.beans.PropertyChangeListener listener); 105 106 /** 107 * Remove a listener for cab signal events 108 * 109 * @param listener is a PropertyChangeListener object 110 */ 111 public void removePropertyChangeListener(java.beans.PropertyChangeListener listener); 112 113}