Package com.dsi.ant.message.fromant
Class AntMessageFromAnt
java.lang.Object
com.dsi.ant.message.AntMessage
com.dsi.ant.message.fromant.AntMessageFromAnt
- Direct Known Subclasses:
AntVersionMessage
,CapabilitiesMessage
,ChannelEventMessage
,ChannelIdMessage
,ChannelResponseMessage
,ChannelStatusMessage
,DataMessage
,SerialNumberMessage
A message sent ANT -> Host.
Takes a raw ANT message (single byte array) and sends it from the ANT Radio Service to an
application, where it is constructed as the specific object that represents the message,
and parses the information out.
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byte[]
Saved copy so we do not have to re-processFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AntMessageFromAnt
createAntMessage
(byte[] rawMessage) Takes a message read from the chip and converts it to anAntMessageFromAnt
objectprotected static AntMessageFromAnt
createAntMessage
(MessageFromAntType messageType, byte[] messageContent) static AntMessageFromAnt
createAntMessage
(AntMessageParcel antParcel) Takes a message received over IPC and converts it to anAntMessageFromAnt
objectprotected static byte[]
extractCorrectMessageContent
(MessageFromAntType desiredType, AntMessageParcel messageParcel) If the parcel represents a message of the desired type, the message content is returned.byte[]
The content of the message.int
Get the ANT message ID.abstract MessageFromAntType
The type of this message based on its message id and contents.toString()
protected String
Methods inherited from class com.dsi.ant.message.AntMessage
equals, getMessageContentString, getMessageIdString, hashCode, maskChannelNumber
-
Field Details
-
mMessageContent
protected byte[] mMessageContentSaved copy so we do not have to re-process
-
-
Constructor Details
-
AntMessageFromAnt
protected AntMessageFromAnt(byte[] messageContent)
-
-
Method Details
-
getMessageId
public int getMessageId()Description copied from class:AntMessage
Get the ANT message ID.- Specified by:
getMessageId
in classAntMessage
- Returns:
- Raw value of this messages Message ID byte.
- Since:
- 4.0
-
extractCorrectMessageContent
protected static byte[] extractCorrectMessageContent(MessageFromAntType desiredType, AntMessageParcel messageParcel) If the parcel represents a message of the desired type, the message content is returned.- Parameters:
desiredType
- The expected message type of the parcel.messageParcel
- The parcel to extract the message content from.- Returns:
- Raw ANT message content.
- Throws:
IllegalArgumentException
- If calculated and desired message types are not the same
-
getMessageContent
public byte[] getMessageContent()Description copied from class:AntMessage
The content of the message.- Specified by:
getMessageContent
in classAntMessage
- Returns:
- Message content raw byte array.
- Since:
- 4.0
-
getMessageType
The type of this message based on its message id and contents.It is recommended to use this rather than the raw message ID.
- Returns:
- A message type corresponding to this message as defined in
MessageFromAntType
. - Since:
- 4.0
-
createAntMessage
Takes a message read from the chip and converts it to anAntMessageFromAnt
object- Parameters:
rawMessage
- The basic ANT message data received from the chip.- Returns:
- A new specific
com.dsi.ant.message.fromant
message instance, or NULL if not a From ANT message or not a knownMessageFromAntType
. - Since:
- 4.0
-
createAntMessage
Takes a message received over IPC and converts it to anAntMessageFromAnt
object- Parameters:
antParcel
- The basic ANT message data received over IPC.- Returns:
- A new specific
com.dsi.ant.message.fromant
message instance, or NULL if not a From ANT message or not a knownMessageFromAntType
. - Since:
- 4.0
-
createAntMessage
protected static AntMessageFromAnt createAntMessage(MessageFromAntType messageType, byte[] messageContent) -
toStringHeader
-
toString
- Overrides:
toString
in classAntMessage
- Since:
- 4.0
-