Class AntVersionMessage


public class AntVersionMessage extends AntMessageFromAnt
Extracts information from a firmware version message string. The firmware version can dictate what abilities the ANT chip may or may not have.
Since:
4.0
  • Constructor Details

    • AntVersionMessage

      public AntVersionMessage(AntMessageParcel messageParcel)
      Parse message specific information from the given ANT message parcel.
      Parameters:
      messageParcel - Raw ANT message received form the ANT Radio Service.
      Throws:
      IllegalArgumentException - If the parcel is for the wrong message type.
      Since:
      4.0
    • AntVersionMessage

      protected AntVersionMessage(byte[] messageContent)
    • AntVersionMessage

      public AntVersionMessage(String versionString)
      Constructs the message from the given string
      Parameters:
      versionString - An ANT version string.
      Since:
      4.0
  • Method Details

    • compareTo

      public int compareTo(AntVersionMessage right) throws IllegalArgumentException
      Check the return value of isComparable(AntVersionMessage) as true before using this method. This method compares the given FirmwareVersions for less than, greater than or equality. Only version, revision and build number are compared.
      Parameters:
      right -
      Returns:
      0 if left == right, 1 if left > right and -1 if left < right.
      Throws:
      IllegalArgumentException
      Since:
      4.0
    • isComparable

      public boolean isComparable(AntVersionMessage right)
      Checks to see if the firmware version message can be compared, namely they have the same format, from the same chip maker or within the same module. The return value of this method should be true before compareTo(AntVersionMessage) is invoked.
      Parameters:
      right - Version message to be compared with
      Returns:
      True if both version messages can be compared, false otherwise.
      Since:
      4.0
    • getVersionString

      public String getVersionString()
      Returns human readable version string
      Returns:
      version info.
      Since:
      4.0
    • getProductFamily

      public String getProductFamily()
      Returns the product family this version belongs to.
      Returns:
      The string that represents the product family.
      Since:
      4.0
    • getMajorVersion

      public float getMajorVersion()
      Returns the major version contained within the version message.
      Returns:
      The major version value.
      Since:
      4.0
    • getRevision

      public char getRevision()
      Returns the specific revision of this version.
      Returns:
      The specific revision value.
      Since:
      4.0
    • getBuildNumber

      public int getBuildNumber()
      Returns the build number for the version.
      Returns:
      The build number of the version.
      Since:
      4.0
    • getModule

      public String getModule()
      Returns the module the version pertains to.
      Returns:
      The string representing a specific module.
      Since:
      4.0
    • toString

      public String toString()
      Overrides:
      toString in class AntMessageFromAnt
      Since:
      4.0
    • getMessageType

      public MessageFromAntType getMessageType()
      Description copied from class: AntMessageFromAnt
      The type of this message based on its message id and contents.

      It is recommended to use this rather than the raw message ID.

      Specified by:
      getMessageType in class AntMessageFromAnt
      Returns:
      A message type corresponding to this message as defined in MessageFromAntType.
      Since:
      4.0