Class XmitEncoding

java.lang.Object
org.ka2ddo.aprs.XmitEncoding
All Implemented Interfaces:
Serializable, Cloneable

public class XmitEncoding extends Object implements Serializable, Cloneable
This class specifies all the parameter variations associated with all possible encodings for subaudible codes, such as CTCSS, DCS, etc., including specifying whether narrowband or (comparatively) wideband FM deviation is used.

APRS encoding is as a letter code for the type followed by a three-digit zero-prefixed number for the frequency (dropping fractions) or digital code number. The letter code is uppercase for wideband FM deviation or lowercase for narrowband. The codes are:

Tanalog tone transmission from mobile to repeater only
Canalog tone transmission in both directions (does not support split tones)
DDCS code number
APRS-Standard Tone Code Prefixes
Author:
Andrew Pavlin, KA2DDO
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String[]
    The standard TCS/CTCSS frequencies in 1/10 Hz values.
    static final String[]
    The standard TCS/CTCSS frequencies used for analog repeaters, in ascending frequency order.
    static final String[]
    The standard DCS (CDCSS) code numbers, in ascending number order.
    boolean
    Indicates this represents DCS (Digital Code Squelch) rather than tone squelch,
    boolean
    Indicates that the repeater not only expects a tone, but sends one out as well.
    boolean
    Indicates that values of this object are meaningless garbage and should not be used.
    boolean
     
    short
    Index into CTCSS_FREQS or DCS_CODES array; 0 implies no tone or code.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an XmitEncoding object for wideband analog with unspecified tone.
    XmitEncoding(boolean isDigital, boolean isFullDuplex, short toneCodeIndex, boolean isNarrowBand)
    Create an XmitEncoding object with the specified valus.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates and returns a copy of this object.
    void
    Copy another XmitEncoding into this XmitEncoding object.
    Decode the specified string into a tone or DCS encoding.
    Generate a String encoding in ASCII text the value of this XmitEncoding object.
    boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns a hash code value for the object.
    static boolean
    isValidLookingSubTone(byte[] body, int offset)
    Test if a message body has a valid-looking subtone encoding for an APRS message.
    Returns a string representation of the object.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • isNarrowband

      public boolean isNarrowband
    • toneCodeIndex

      public short toneCodeIndex
      Index into CTCSS_FREQS or DCS_CODES array; 0 implies no tone or code.
    • isDigital

      public boolean isDigital
      Indicates this represents DCS (Digital Code Squelch) rather than tone squelch,
    • isFullDuplex

      public boolean isFullDuplex
      Indicates that the repeater not only expects a tone, but sends one out as well.
    • isInvalid

      public boolean isInvalid
      Indicates that values of this object are meaningless garbage and should not be used.
    • CTCSS_FREQS

      public static final String[] CTCSS_FREQS
      The standard TCS/CTCSS frequencies used for analog repeaters, in ascending frequency order.
    • BADFMT_CTCSS_FREQS

      public static final String[] BADFMT_CTCSS_FREQS
      The standard TCS/CTCSS frequencies in 1/10 Hz values.
    • DCS_CODES

      public static final String[] DCS_CODES
      The standard DCS (CDCSS) code numbers, in ascending number order.
  • Constructor Details

    • XmitEncoding

      public XmitEncoding()
      Create an XmitEncoding object for wideband analog with unspecified tone.
    • XmitEncoding

      public XmitEncoding(boolean isDigital, boolean isFullDuplex, short toneCodeIndex, boolean isNarrowBand)
      Create an XmitEncoding object with the specified valus.
      Parameters:
      isDigital - boolean true if transmission uses Digital Code Squelch, false for analog CTCSS tone
      isFullDuplex - boolean true if repeater transmits a tone or code on its output
      toneCodeIndex - zero-based index into CTCSS_FREQS or DCS_CODES array for tone/code in use, 0 for no tone or code. -1 for unspecified
      isNarrowBand - boolean true if transmission is using narrow modulation bandwidth
  • Method Details

    • encodedString

      public String encodedString()
      Generate a String encoding in ASCII text the value of this XmitEncoding object.
      Returns:
      String representation of encoding
    • decodeString

      public static XmitEncoding decodeString(String s)
      Decode the specified string into a tone or DCS encoding.
      Parameters:
      s - String to decode
      Returns:
      XmitEncoding of the specified value, or null if this string does not contain an APRS tone encoding
      Throws:
      IllegalArgumentException - if this looks like a tone encoding but doesn't have one of the legal tone frequencies or digital code numbers
    • copyInto

      public void copyInto(XmitEncoding other)
      Copy another XmitEncoding into this XmitEncoding object.
      Parameters:
      other - source XmitEncoding object
    • isValidLookingSubTone

      public static boolean isValidLookingSubTone(byte[] body, int offset)
      Test if a message body has a valid-looking subtone encoding for an APRS message.
      Parameters:
      body - byte array containing APRS message body
      offset - index in body array where subtone encoding should be present
      Returns:
      boolean true if a valid-looking subtone encoding is at the specified position in the array
    • equals

      public boolean equals(Object obj)
      Indicates whether some other object is "equal to" this one.
      Overrides:
      equals in class Object
      Parameters:
      obj - the reference object with which to compare.
      Returns:
      true if this object is the same as the obj argument; false otherwise.
      See Also:
    • hashCode

      public int hashCode()
      Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object.
      See Also:
    • toString

      public String toString()
      Returns a string representation of the object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the object.
    • clone

      public Object clone()
      Creates and returns a copy of this object.
      Overrides:
      clone in class Object
      Returns:
      a clone of this instance.