Class SerialMessage

All Implemented Interfaces:
Message

public class SerialMessage
extends AbstractMRMessage
Contains the data payload of a serial packet. Note that it's _only_ the payload.

See the Grapevine Binary Message Format Summary

  • Field Details

  • Constructor Details

  • Method Details

    • replyExpected

      public boolean replyExpected()
      Description copied from class: AbstractMRMessage
      Is a reply expected to this message?

      By default, a reply is expected to every message; either a reply or a timeout is needed before the next message can be sent.

      If this returns false, the transmit queue will immediately go on to transmit the next message (if any).

      Overrides:
      replyExpected in class AbstractMRMessage
      Returns:
      true by default in Abstract MR message.
    • getAddr

      public int getAddr()
    • getPoll

      public static SerialMessage getPoll​(int addr)
      For Grapevine, which doesn't have a data poll, the poll operation is only used to see that the nodes are present. This is done by sending a "get software version" command.
      Parameters:
      addr - address to poll.
      Returns:
      serial message to poll data.
    • setBank

      public void setBank​(int b)
    • setParity

      public void setParity()
    • setParity

      public void setParity​(int start)
    • setReplyLen

      public void setReplyLen​(int len)
      Set the number of characters expected back from the command station. Normally four, this is used to set other lengths for special cases, like a reply to a poll (software version) message.
      Parameters:
      len - reply length.
    • getReplyLen

      public int getReplyLen()
    • format

      public String format()
      Format the reply as human-readable text.
      Returns:
      human-readable text of reply.
    • staticFormat

      static String staticFormat​(int b1, int b2, int b3, int b4)
      Provide a human-readable form of a message.

      Used by both SerialMessage and SerialReply, because so much of it is common. That forces the passing of arguments as numbers. Short messages are marked by having missing bytes put to -1 in the arguments. See the Grapevine Binary Message Format Summary

      Parameters:
      b1 - 1st message byte
      b2 - 2nd message byte
      b3 - 3rd message byte
      b4 - 4th message byte
      Returns:
      Human-readable form
    • colorAsString

      static String colorAsString​(int color)