Class ChannelPeriodMessage


public final class ChannelPeriodMessage extends AntMessageFromHost
Configures the channel period the channel will operate on. Messages will be sent and received every channel period.
Since:
4.0
  • Field Details

  • Constructor Details

    • ChannelPeriodMessage

      public ChannelPeriodMessage(int channelPeriod)
      Constructs the message from the given channel period.
      Parameters:
      channelPeriod - The channel period in 1/32768ths of a second units.
      Since:
      4.0
    • ChannelPeriodMessage

      protected ChannelPeriodMessage(byte[] messageContent)
  • Method Details

    • getChannelPeriod

      public static int getChannelPeriod(double messagesPerSecond)
      Converts a transmitted data rate in Hz to the channel period value used by ANT.
      Parameters:
      messagesPerSecond - The desired data rate, in Hz. This MUST be an integer divisor of CHANNEL_PERIOD_UNITS_FRACTION_OF_A_SECOND.
      Returns:
      The channel period in 1/32768ths of a second units.
      Since:
      4.5
    • getChannelPeriod

      public int getChannelPeriod()
      Gets the channel period this message configures.
      Returns:
      The channel period in 1/32768ths of a second units.
      Since:
      4.0
    • getMessagesPerSecond

      public static double getMessagesPerSecond(int channelPeriod)
      Converts the channel period value used by ANT to the transmitted data rate in Hz.
      Parameters:
      channelPeriod - The desired messaging period, in CHANNEL_PERIOD_UNITS_FRACTION_OF_A_SECOND's.
      Returns:
      The matching data rate, in Hz.
      Since:
      4.5
    • getMessagesPerSecond

      public double getMessagesPerSecond()
      Gets the transmitted data rate this message configures.
      Returns:
      The data rate, in Hz.
      Since:
      4.5
    • getMessageContent

      public byte[] getMessageContent(int channelNumber, int networkNumber)
      Description copied from class: AntMessageFromHost
      The content of the message with specified channel number and network number set if required.
      Specified by:
      getMessageContent in class AntMessageFromHost
      Parameters:
      channelNumber - Written to the channel number byte if required
      networkNumber - Written to the network number byte if required
      Returns:
      Message content raw byte array.
      Since:
      4.0
    • getMessageType

      public MessageFromHostType getMessageType()
      Description copied from class: AntMessageFromHost
      The unique type of this message based on its message id, contents, and intended channel type.

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

      Specified by:
      getMessageType in class AntMessageFromHost
      Returns:
      The type of message returned by the host.
      Since:
      4.0
    • toString

      public String toString()
      Overrides:
      toString in class AntMessageFromHost