Class SprogReply

    • Constructor Detail

      • SprogReply

        public SprogReply​(SprogReply m)
        Create a new SprogReply as a deep copy of an existing SprogReply.
        Parameters:
        m - the SprogReply to copy
      • SprogReply

        public SprogReply​(java.lang.String replyString,
                          boolean isBoot)
        Create a SprogReply from a String.
        Parameters:
        replyString - a String containing the contents of the reply
        isBoot - a boolean indicating if this is a boot reply
      • SprogReply

        public SprogReply​(java.lang.String replyString)
    • Method Detail

      • setId

        public void setId​(int id)
      • getId

        public int getId()
      • 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 java.lang.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​(java.lang.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