Class DefaultMessage

All Implemented Interfaces:
Serializable, Cloneable, Comparable<AX25Message>, CommentedMessage, SendableMessage

public class DefaultMessage extends Message implements SendableMessage
This class defines a default message (suitable to contain any other type of APRS message that YAAC doesn't explicitly understand). The lead character of such messages is kept in the comment instead of being stripped off.
Author:
Andrew Pavlin, KA2DDO
See Also:
  • Constructor Details

    • DefaultMessage

      public DefaultMessage(byte[] body, int offset, String tp, long rcvTimestamp)
      Create a DefaultMessage from the bytes in a byte array (such as the body of an AX25Frame).
      Parameters:
      body - byte array containing the transmission format of the message
      offset - index into the array where the message starts
      tp - String of third-party routing information (or null if this was not routed over another network)
      rcvTimestamp - the time (in milliseconds in Jan 1970 UTC) when this message was received
    • DefaultMessage

      public DefaultMessage(char type)
      Create an empty DefaultMessage with the specified message type character.
      Parameters:
      type - char type code of this message.
  • Method Details

    • getBody

      public byte[] getBody(boolean countTransmission, ProtocolFamily protocolId, AX25Frame frame)
      Get an ASCII-text version of this message, suitable for transmitting.
      Specified by:
      getBody in interface SendableMessage
      Parameters:
      countTransmission - number of times the message has been transmitted
      protocolId - ProtocolFamily to format this message in
      frame - AX25Frame into which the message will be placed; the decoded message (as opposed to the byte array encoding) should be stored into the field frame.parsedAX25Msg
      Returns:
      byte array of message
      See Also:
    • isEnabled

      public boolean isEnabled()
      Test if message should still be transmitted.
      Specified by:
      isEnabled in interface SendableMessage
      Returns:
      boolean true if message should still be transmitted
    • disableForTransmit

      public void disableForTransmit()
      Specify that message should no longer be transmitted.
      Specified by:
      disableForTransmit in interface SendableMessage
    • getProtocols

      public Set<ProtocolFamily> getProtocols()
      Get the protocol family or families that this message corresponds to, so ports that don't support all protocols will not forward inappropriate packets.
      Overrides:
      getProtocols in class Message
      Returns:
      array of supported ProtocolFamily enums