public final class ChannelPeriodMessage extends AntMessageFromHost
Modifier and Type | Field and Description |
---|---|
static double |
CHANNEL_PERIOD_UNITS_FRACTION_OF_A_SECOND
ANT channel period = channel period time (s) *
CHANNEL_PERIOD_UNITS_FRACTION_OF_A_SECOND . |
static int |
OFFSET_CHANNEL_PERIOD
The message content offset to the channel period
|
static int |
SIZE_CHANNEL_PERIOD
The number of bytes used for the channel period
|
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 and Description |
---|
ChannelPeriodMessage(int channelPeriod)
Constructs the message from the given channel period.
|
Modifier and Type | Method and Description |
---|---|
int |
getChannelPeriod()
Gets the channel period this message configures.
|
static int |
getChannelPeriod(double messagesPerSecond)
Converts a transmitted data rate in Hz to the channel period value used by ANT.
|
byte[] |
getMessageContent(int channelNumber,
int networkNumber)
The content of the message with specified channel number and network number set if required.
|
double |
getMessagesPerSecond()
Gets the transmitted data rate this message configures.
|
static double |
getMessagesPerSecond(int channelPeriod)
Converts the channel period value used by ANT to the transmitted data rate in Hz.
|
MessageFromHostType |
getMessageType()
The unique type of this message based on its message id, contents, and intended channel
type.
|
java.lang.String |
toString() |
createAntMessage, getMessageContent, getMessageContent, getMessageId, getRawMessage
equals, getMessageContentString, getMessageIdString, hashCode, maskChannelNumber
public static final int OFFSET_CHANNEL_PERIOD
public static final int SIZE_CHANNEL_PERIOD
public static final double CHANNEL_PERIOD_UNITS_FRACTION_OF_A_SECOND
CHANNEL_PERIOD_UNITS_FRACTION_OF_A_SECOND
.
E.g.: To send or receive a message at 4Hz, set the channel period to
CHANNEL_PERIOD_UNITS_FRACTION_OF_A_SECOND
/4 = 8192.
getChannelPeriod(double)
and getMessagesPerSecond(int)
are helper methods
to get these values.
public ChannelPeriodMessage(int channelPeriod)
channelPeriod
- The channel period in 1/32768ths of a second units.public static int getChannelPeriod(double messagesPerSecond)
messagesPerSecond
- The desired data rate, in Hz. This MUST be an integer divisor of
CHANNEL_PERIOD_UNITS_FRACTION_OF_A_SECOND
.public int getChannelPeriod()
public static double getMessagesPerSecond(int channelPeriod)
channelPeriod
- The desired messaging period, in
CHANNEL_PERIOD_UNITS_FRACTION_OF_A_SECOND
's.public double getMessagesPerSecond()
public byte[] getMessageContent(int channelNumber, int networkNumber)
AntMessageFromHost
getMessageContent
in class AntMessageFromHost
channelNumber
- Written to the channel number byte if requirednetworkNumber
- Written to the network number byte if requiredpublic MessageFromHostType getMessageType()
AntMessageFromHost
It is recommended to use this rather than the raw message ID.
getMessageType
in class AntMessageFromHost
public java.lang.String toString()
toString
in class AntMessageFromHost
Copyright © 2015 Dynastream Innovations Inc. All Rights Reserved.