Package com.dsi.ant.message.fromant
Class AntVersionMessage
java.lang.Object
com.dsi.ant.message.AntMessage
com.dsi.ant.message.fromant.AntMessageFromAnt
com.dsi.ant.message.fromant.AntVersionMessage
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
-
Field Summary
Fields inherited from class com.dsi.ant.message.fromant.AntMessageFromAnt
mMessageContent
Fields inherited from class com.dsi.ant.message.AntMessage
BITMASK_CHANNEL_NUMBER, FILLER_BYTE, OFFSET_CHANNEL_NUMBER, RAW_OFFSET_MESSAGE_CONTENT_START, RAW_OFFSET_MESSAGE_ID, RAW_OFFSET_MESSAGE_SIZE, SIZE_CHANNEL_NUMBER, SIZE_FILLER_BYTE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AntVersionMessage
(byte[] messageContent) AntVersionMessage
(AntMessageParcel messageParcel) Parse message specific information from the given ANT message parcel.AntVersionMessage
(String versionString) Constructs the message from the given string -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(AntVersionMessage right) Check the return value ofisComparable(AntVersionMessage)
as true before using this method.int
Returns the build number for the version.float
Returns the major version contained within the version message.The type of this message based on its message id and contents.Returns the module the version pertains to.Returns the product family this version belongs to.char
Returns the specific revision of this version.Returns human readable version stringboolean
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.toString()
Methods inherited from class com.dsi.ant.message.fromant.AntMessageFromAnt
createAntMessage, createAntMessage, createAntMessage, extractCorrectMessageContent, getMessageContent, getMessageId, toStringHeader
Methods inherited from class com.dsi.ant.message.AntMessage
equals, getMessageContentString, getMessageIdString, hashCode, maskChannelNumber
-
Constructor Details
-
AntVersionMessage
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
Constructs the message from the given string- Parameters:
versionString
- An ANT version string.- Since:
- 4.0
-
-
Method Details
-
compareTo
Check the return value ofisComparable(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
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 beforecompareTo(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
Returns human readable version string- Returns:
- version info.
- Since:
- 4.0
-
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
Returns the module the version pertains to.- Returns:
- The string representing a specific module.
- Since:
- 4.0
-
toString
- Overrides:
toString
in classAntMessageFromAnt
- Since:
- 4.0
-
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 classAntMessageFromAnt
- Returns:
- A message type corresponding to this message as defined in
MessageFromAntType
. - Since:
- 4.0
-