Class SprogReply

All Implemented Interfaces:
Message

public class SprogReply
extends AbstractMRReply
Carries the reply to a SprogMessage.
  • Field Details

  • Constructor Details

  • Method Details

    • setId

      public void setId​(int id)
    • getId

      public int getId()
    • skipPrefix

      protected int skipPrefix​(int index)
      Specified by:
      skipPrefix in class AbstractMRReply
    • isOverload

      public boolean isOverload()
      Is this reply indicating that an overload condition was detected?
      Returns:
      boolean true for overload
    • isError

      public boolean isError()
      Is this reply indicating that a general error has occurred?
      Returns:
      boolean true for error message
    • strip

      public boolean strip()
      Check and strip framing characters and DLE from a SPROG bootloader reply.
      Returns:
      boolean result of message validation
    • getChecksum

      public boolean getChecksum()
      Check and strip checksum from a SPROG bootloader reply.

      Assumes framing and DLE chars have been stripped

      Returns:
      boolean result of checksum validation
    • toString

      public String toString()
      Return a string representation of this SprogReply.
      Specified by:
      toString in interface Message
      Overrides:
      toString in class AbstractMRReply
      Returns:
      String The string representation
    • value

      public int value()
      Extract Read-CV returned value from a message.

      SPROG is assumed to not be echoing commands. A reply to a command may include the prompt that was printed after the previous command.

      Reply to a CV read is of the form " = hvv" where vv is the CV value in hex

      Overrides:
      value in class AbstractMRReply
      Returns:
      -1 if message can't be parsed
    • match

      public int match​(String s)
      Find a specific string in the reply.
      Overrides:
      match in class AbstractMRReply
      Parameters:
      s - string to look for
      Returns:
      index of String s in the reply
    • endNormalReply

      public boolean endNormalReply()
      Normal SPROG replies will end with the prompt for the next command.
      Returns:
      true if end of normal reply is found
    • endBootReply

      public boolean endBootReply()
      Bootloader will end with ETX with no preceding DLE.
      Returns:
      true if end of bootloader reply is found