Package jmri.jmrix.lenz
Class FeedbackItem
java.lang.Object
jmri.jmrix.lenz.FeedbackItem
Represents a single response from the XpressNet.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGives status value as specified in XPressNet.intReturns the (base) address of the item.getEncoderStatus(int sensorNumber) Returns encoder feedback for the given sensor.intTranslates raw value ingetAccessoryStatus()into Turnout's CLOSED/THROWN valuesintgetType()Returns the feedback type.booleanReturns true, if the feedback is from turnout (accessory).booleanReturns true, if the feedback is from feedback encoder.booleanDetermines if the turnout motion has completed.booleanDetermines if the feedback was solicited.booleanmatchesAddress(int address) Determines if the feedback is for the given Turnout addressReturns a FeedbackItem instance for the other accessory address reported in the item.
-
Constructor Details
-
FeedbackItem
-
-
Method Details
-
isUnsolicited
Determines if the feedback was solicited.- Returns:
true, if feedback was solicited.
-
getAddress
Returns the (base) address of the item. For turnouts, return the reported address. For encoders, return the address of the first contained sensor- Returns:
- the address.
-
matchesAddress
Determines if the feedback is for the given Turnout address- Parameters:
address- address to check- Returns:
true, if the item applies to the address.
-
isMotionComplete
Determines if the turnout motion has completed. Requires decoder/switch feedback to be processed by the command station; alwaysfalseif not connected.- Returns:
trueif the motion is complete.
-
getType
Returns the feedback type.- 0: Turnout without feedback
- 1: Turnout with feedback
- 2: Feedback encoder
- 3: reserved, invalid
- Returns:
- feedback type.
-
getTurnoutStatus
Translates raw value ingetAccessoryStatus()into Turnout's CLOSED/THROWN values- Returns:
Turnout.CLOSED,Turnout.THROWNor -1 for inconsistent.s
-
isEncoder
Returns true, if the feedback is from feedback encoder.- Returns:
truefor encoder feedback.
-
isAccessory
Returns true, if the feedback is from turnout (accessory).- Returns:
truefor turnout feedback.
-
getAccessoryStatus
Gives status value as specified in XPressNet.- 0x00: turnout was not operated
- 0x01: last command was "0", turnout left, CLOSED.
- 0x02: last command was "1", turnout right, THROWN.
- 0x03: reserved, invalid
- Returns:
- accessory state.
-
getEncoderStatus
Returns encoder feedback for the given sensor. The function returnnullif the sensor number is not within this FeedbackItem range, or the item does not represent an encoder feedback.- Parameters:
sensorNumber- sensor number, starting with 1.- Returns:
- The sensor's reported bit value (true/false) or
null, if no encoder feedback for the sensor is found.
-
pairedAccessoryItem
Returns a FeedbackItem instance for the other accessory address reported in the item. Returnsnullfor non-accessory feedbacks.- Returns:
- instance for the paired accessory, or
null.
-