Class FeedbackItem


public class FeedbackItem
extends Object
Represents a single response from the XpressNet.
  • Constructor Details

  • Method Details

    • isUnsolicited

      public boolean isUnsolicited()
      Determines if the feedback was solicited.
      true, if feedback was solicited.
    • resetUnsolicited

      since 4.21.1 without replacement
      Resets the unsolicited flag in the reply.
    • getAddress

      public int getAddress()
      Returns the (base) address of the item. For turnouts, return the reported address. For encoders, return the address of the first contained sensor
      the address.
    • matchesAddress

      public boolean matchesAddress​(int address)
      Determines if the feedback is for the given Turnout address
      address - address to check
      true, if the item applies to the address.
    • isMotionComplete

      public boolean isMotionComplete()
      Determines if the turnout motion has completed. Requires decoder/switch feedback to be processed by the command station; always false if not connected.
      true if the motion is complete.
    • getType

      public int getType()
      Returns the feedback type.
      • 0: Turnout without feedback
      • 1: Turnout with feedback
      • 2: Feedback encoder
      • 3: reserved, invalid
      feedback type.
    • getTurnoutStatus

      public int getTurnoutStatus()
      Translates raw value in getAccessoryStatus() into Turnout's CLOSED/THROWN values
      Turnout.CLOSED, Turnout.THROWN or -1 for inconsistent.s
    • isEncoder

      public boolean isEncoder()
      Returns true, if the feedback is from feedback encoder.
      true for encoder feedback.
    • isAccessory

      public boolean isAccessory()
      Returns true, if the feedback is from turnout (accessory).
      true for turnout feedback.
    • getAccessoryStatus

      public int 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
      The method returns 0x03, if the feedback is not for accessory.
      accessory state.
    • getEncoderStatus

      @CheckForNull public Boolean getEncoderStatus​(int sensorNumber)
      Returns encoder feedback for the given sensor. The function return null if the sensor number is not within this FeedbackItem range, or the item does not represent an encoder feedback.
      sensorNumber - sensor number, starting with 1.
      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. Returns null for non-accessory feedbacks.
      instance for the paired accessory, or null.