Class CbusNodeTimerManager

java.lang.Object
jmri.jmrix.can.cbus.node.CbusNodeTimerManager

public class CbusNodeTimerManager extends Object
Class to handle Timers for a CbusNode.
  • Field Details

  • Constructor Details

  • Method Details

    • hasActiveTimers

      protected boolean hasActiveTimers()
      See if any timers are running, ie waiting for a response from a physical Node.
      Returns:
      true if timers are running else false
    • cancelTimers

      protected void cancelTimers()
    • resetTimeOutCounts

      protected final void resetTimeOutCounts()
    • clearNextNvVarTimeout

      protected void clearNextNvVarTimeout()
      Stop timer for a single NV fetch request.
    • setNextNvVarTimeout

      protected void setNextNvVarTimeout()
      Start timer for a single Node Variable request. If 10 failed requests aborts loop and sets number of NV's to unknown
    • clearNextEvVarTimeout

      protected void clearNextEvVarTimeout()
      Stop timer for a single event variable request.
    • setNextEvVarTimeout

      protected void setNextEvVarTimeout(int eventVarIndex, String eventString)
      Start timer for a single event variable request. If 10 failed requests aborts loop and sets events to unknown. The timeout count is left at 10 so the fetch is not automatically re-attempted by the background fetch, see eventFetchAbandoned()
      Parameters:
      eventVarIndex - Event Variable Index
      eventString - User Friendly Event Text
    • eventFetchAbandoned

      protected boolean eventFetchAbandoned()
      Check if a fetch of the node events has been abandoned following repeated timeouts, ie. from an RQEVN ( total events ), NERD ( event index ) or REVAL ( event variable ) request.

      Counts are reset when a response is received, or by resetTimeOutCounts().

      Returns:
      true if an event fetch has been abandoned, else false.
    • clearNumEvTimeout

      protected void clearNumEvTimeout()
      Stop timer for event total RQEVN request.
    • setNumEvTimeout

      protected void setNumEvTimeout()
      Start timer for event total RQEVN request. If 10 failed requests aborts loop and leaves event number unknown. The timeout count is left at 10 so the request is not automatically re-attempted by the background fetch, see eventFetchAbandoned()
    • clearAllEvTimeout

      protected void clearAllEvTimeout()
      Stop timer for an ALL event by index fetch request.
    • setAllEvTimeout

      protected void setAllEvTimeout()
      Starts timer for an ALL event by index fetch request.

      This has a higher chance of failing as we could be expecting up to 255 CAN Frames in response. If fails, re-sends the NERD to the physical node Aborts on 10 failed requests

    • clearAllParamTimeout

      protected void clearAllParamTimeout()
      Stop timer for a single parameter fetch
    • setAllParamTimeout

      protected void setAllParamTimeout(int index)
      Start timer for a Parameter request If 10 timeouts are counted, aborts loop, sets 8 parameters to 0 and node events array to 0
      Parameters:
      index - Parameter Index
    • clearsendEditNvTimeout

      protected void clearsendEditNvTimeout()
      Stop timer for Teaching NV Node Variables
    • setsendEditNvTimeout

      protected void setsendEditNvTimeout()
      Start timer for Teaching NV Node Variables If no response received, increases error count and resumes loop to teach next NV which handles the error
    • clearsendEditEvTimeout

      protected void clearsendEditEvTimeout()
      Stops timer for Teaching Events
    • setsendEditEvTimeout

      protected void setsendEditEvTimeout()
      Start timer for Teaching Events On timeout, ie Node does not Respond with a success message, stops Learn Loop and takes node out of Learn Mode.
    • clearSendEnumTimeout

      protected void clearSendEnumTimeout()
      Stops timer for CAN ID Self Enumeration Timeout
    • setsendEnumTimeout

      protected void setsendEnumTimeout()
      Starts timer for CAN ID Self Enumeration Timeout If no response adds warning to console log