001package jmri;
002
003import java.util.List;
004
005/**
006 * RailCom represents a RailCom enabled decoder that might be fitted to a
007 * specific piece of rolling stock to uniquely identify it.<br>
008 * RailCom is a registered trademark of Lenz GmbH.
009 * <p>
010 * This implementation of RailCom is an extension of @see IdTag and holds the
011 * additional information that can be supplied by the decoder as defined in
012 * RP-9.3.2
013 * <p>
014 * This file is part of JMRI.
015 * <p>
016 * JMRI is free software; you can redistribute it and/or modify it under the
017 * terms of version 2 of the GNU General Public License as published by the Free
018 * Software Foundation. See the "COPYING" file for a copy of this license.
019 * <p>
020 * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY
021 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
022 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
023 *
024 * @author Kevin Dickerson Copyright (C) 2012
025 * @since 2.99.4
026 */
027public interface RailCom extends AddressedIdTag {
028
029    /**
030     * Constant representing that we do not know the address type of the
031     * decoder. This is the initial state of a newly created object before.
032     */
033    int NO_ADDRESS = 0x00;
034
035    /**
036     * Constant representing that the address type reported back is Short.
037     */
038    int SHORT_ADDRESS = 0x02;
039
040    /**
041     * Constant representing that the address type reported back is Long.
042     */
043    int LONG_ADDRESS = 0x04;
044
045    /**
046     * Constant representing that the address type reported back is part of a
047     * Consist.
048     */
049    int CONSIST_ADDRESS = 0x08;
050
051    int ORIENTA = 0x10;
052    int ORIENTB = 0x20;
053
054    /**
055     * Method for a RailCom Reader to set the orientation reported back from a
056     * device
057     *
058     * @param type the orientation to set
059     */
060    void setOrientation(int type);
061
062    /**
063     * Gets the Orientation of the Rail Com device on the track
064     *
065     * @return current orientation
066     */
067    int getOrientation();
068
069    /**
070     * Method for a RailCom Reader to set the Actual speed reported back from a
071     * device
072     *
073     * @param actualSpeed the speed
074     */
075    void setActualSpeed(int actualSpeed);
076
077    /**
078     * Gets the actual speed reported by the RailCom device as a representation
079     * 128 speed steps
080     *
081     * @return -1 if not set.
082     */
083    int getActualSpeed();
084
085    /**
086     * Method for a RailCom Reader to set the Actual Load back from a device.
087     *
088     * @param actualLoad the load
089     */
090    void setActualLoad(int actualLoad);
091
092    /**
093     * Gets the actual load reported by decoder the RailCom device.
094     *
095     * @return -1 if not set.
096     */
097    int getActualLoad();
098
099    /**
100     * Method for a RailCom Reader to set the actual temperate reported back
101     * from a device.
102     *
103     * @param actualTemp the temperature
104     */
105    void setActualTemperature(int actualTemp);
106
107    /**
108     * Gets the actual temperate reported by the RailCom device. Location is
109     * configured in CV876 (RP.9.3.2)
110     *
111     * @return -1 if not set.
112     */
113    int getActualTemperature();
114
115    /**
116     * Method for a RailCom Reader to set the fuel level reported back from a
117     * device.
118     *
119     * @param fuelLevel the fuel level
120     */
121    void setFuelLevel(int fuelLevel);
122
123    /**
124     * Method for a RailCom Reader to set the water level reported back from a
125     * device.
126     *
127     * @param waterLevel the water level
128     */
129    void setWaterLevel(int waterLevel);
130
131    /**
132     * Gets the remaining fuel level as a % Fuel level CV879 (RP.9.3.2)
133     *
134     * @return -1 if not set.
135     */
136    int getFuelLevel();
137
138    /**
139     * Gets the remaining fuel level as a % Water level CV878 (RP.9.3.2)
140     *
141     * @return -1 if not set.
142     */
143    int getWaterLevel();
144
145    /**
146     * Method for a RailCom Reader to set the location reported back from a
147     * device.
148     *
149     * @param location the location
150     */
151    void setLocation(int location);
152
153    /**
154     * Gets the Last Location that the RailCom device was identified in Location
155     * is configured in CV876 (RP.9.3.2)
156     *
157     * @return -1 if not set.
158     */
159    int getLocation();
160
161    /**
162     * Method for a RailCom Reader to set the routing number reported back from
163     * a device.
164     *
165     * @param routingno the routing number
166     */
167    void setRoutingNo(int routingno);
168
169    /**
170     * Gets the routing number that the RailCom device wishes to travel. Route
171     * Number is configured in CV874 (RP.9.3.2)
172     *
173     * @return -1 if not set.
174     */
175    int getRoutingNo();
176
177    /**
178     * Gets the value of a CV reported back from the RailCom device.
179     *
180     * @param cv CV number that the value relates to.
181     * @return the value of the CV, or 0 if none has yet been collected
182     */
183    int getCV(int cv);
184
185    /**
186     * Sets the value of a CV reported back from the decoder.
187     *
188     * @param cv    CV number that the value relates to.
189     * @param value Value of the CV
190     */
191    void setCV(int cv, int value);
192
193    /**
194     * Set the CV number of the next expected value to be returned in a RailCom
195     * Packet.
196     *
197     * @param cv the expected CV
198     */
199    void setExpectedCv(int cv);
200
201    /**
202     * Get the expected CV to be returned in a RailCom Packet.
203     *
204     * @return the expected CV
205     */
206    int getExpectedCv();
207
208    /**
209     * Set the value of the CV that has been read from the RailCom packet.
210     *
211     * @param value the CV value
212     */
213    void setCvValue(int value);
214
215    /**
216     * Get a list of the CVs last seen for this RailCom device.
217     *
218     * @return a list of CVs
219     */
220    List<Integer> getCVList();
221
222}