Class MaidenheadLocatorBeacon

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

public class MaidenheadLocatorBeacon extends PositionMessage implements SendableMessage
This class decodes the (obsolete) Maidenhead Locator Beacon message (APRS protocol specification chapter 6), although this class is also used to store Status messages (APRS protocol specification chapter 16) when a Maidenhead prefix is used in the status message.
Author:
Andrew Pavlin, KA2DDO
See Also:
  • Constructor Details

    • MaidenheadLocatorBeacon

      public MaidenheadLocatorBeacon(byte[] body, int offset, String tp, long rcvTimestamp)
      Decode a Maidenhead locator beacon message from the specified AX.25 frame body.
      Parameters:
      body - byte array of frame body
      offset - zero-based index into array where the message starts (after any third-party data)
      tp - String of third-party header, or null if not routed by another network
      rcvTimestamp - Unix time in milliseconds since midnight 1 January 1970 UTC when message was received
    • MaidenheadLocatorBeacon

      public MaidenheadLocatorBeacon(long now, byte msgType, double latitude, double longitude, String comment)
      Alternate constructor for making a transmittable MaidenheadLocatorBeacon message (including one that looks like a StatusMessage with Maidenhead location).
      Parameters:
      now - current time in Java milliseconds since midnight Jan 1 1970 UTC
      msgType - APRS message type character (either '[' or '>')
      latitude - latitude in fractional degrees North
      longitude - longitude in fractional degrees East
      comment - free-text comment String
      See Also:
  • Method Details

    • testIfMaidenheadIdentifier

      public static boolean testIfMaidenheadIdentifier(byte[] body, int offset)
      Test if the specified message body contains a string that looks like a Maidenhead location identifier.
      Parameters:
      body - byte array presumably containing an ASCII APRS message
      offset - position in the byte array where a Maidenhead identifier might start
      Returns:
      boolean true if there is a Maidenhead identifier in the body at the specified offset
    • encodeMaidenheadIdentifier

      public static String encodeMaidenheadIdentifier(double latitude, double longitude)
      Convert a lat/lon pair in decimal degrees North/East into a Maidenhead location.
      Parameters:
      latitude - latitude in decimal degrees North
      longitude - longitude in decimal degrees East
      Returns:
      6 character Maidenhead locator
    • getBody

      public byte[] getBody(boolean countTransmission, ProtocolFamily protocolId, AX25Frame frame)
      Get an instance 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 generate the 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, or null if message body cannot be generated in specified protocol, or retransmission count has been exceeded.
      See Also:
    • paramString

      public String paramString()
      Descriptive text about this message, to be included in the toString() method's response.
      Overrides:
      paramString in class PositionMessage
      Returns:
      String describing the contents of this message
      See Also:
    • 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