Class AntMessageFromHost

java.lang.Object
com.dsi.ant.message.AntMessage
com.dsi.ant.message.fromhost.AntMessageFromHost
Direct Known Subclasses:
AddChannelIdToListMessage, AssignChannelMessage, ChannelIdMessageFromHost, ChannelPeriodMessage, ChannelRfFrequencyMessage, ChannelSearchPriorityMessage, CloseChannelMessage, ConfigIdListMessage, ConfigureEventBufferMessage, CrystalEnableMessage, CwInitMessage, DataMessageFromHost, FrequencyAgilityMessage, LibConfigMessage, LoadOrStoreEncryptionKeyMessage, LowPrioritySearchTimeoutMessage, OpenChannelMessage, OpenRxScanModeMessage, ProximitySearchMessage, RequestMessage, ResetSystemMessage, SearchTimeoutMessage, SerialNumberSetChannelIdMessage, SetChannelTransmitPowerMessage, SetNetworkKeyMessage, SleepMessage, TransmitPowerMessage, UnassignChannelMessage

public abstract class AntMessageFromHost extends AntMessage
A message sent Host -> ANT. Takes individual pieces of information from an application, and the message type and sends this to the ANT Radio Service, which is pieced together to a single ANT message byte array.
Since:
4.0
  • Constructor Details

    • AntMessageFromHost

      public AntMessageFromHost()
  • Method Details

    • getMessageId

      public int getMessageId()
      Description copied from class: AntMessage
      Get the ANT message ID.
      Specified by:
      getMessageId in class AntMessage
      Returns:
      Raw value of this messages Message ID byte.
      Since:
      4.0
    • getMessageType

      public abstract MessageFromHostType getMessageType()
      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.

      Returns:
      The type of message returned by the host.
      Since:
      4.0
    • getMessageContent

      public byte[] getMessageContent()
      The content of the message with no channel number or network number set.
      Specified by:
      getMessageContent in class AntMessage
      Returns:
      Message content raw byte array.
      Since:
      4.0
    • getMessageContent

      public byte[] getMessageContent(int channelNumber)
      The content of the message with specified channel number set if required.
      Parameters:
      channelNumber - Written to the channel number byte if required
      Returns:
      Raw byte array with network number not set.
      Since:
      4.0
    • getMessageContent

      public abstract byte[] getMessageContent(int channelNumber, int networkNumber)
      The content of the message with specified channel number and network number set if required.
      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
    • getRawMessage

      public byte[] getRawMessage(int channelNumber, int networkNumber)
      Creates a message which can be written to the chip.
      Parameters:
      channelNumber - Specific channel to write in to this message, if required.
      networkNumber - Specific network to write in to this message, if required.
      Returns:
      An ANT message that can be written to the chip.
      Since:
      4.0
    • createAntMessage

      public static AntMessageFromHost createAntMessage(AntMessageParcel antParcel, ChannelType channelType)
      Takes a message received over IPC and converts it to an AntMessageFromHost object
      Parameters:
      antParcel - The basic ANT message data received over IPC.
      channelType - The channel type of the channel this message is intended for.
      Returns:
      A new specific message type instance, or NULL if not a From Host message or not a known MessageFromHostType.
      Since:
      4.0
    • createAntMessage

      protected static AntMessageFromHost createAntMessage(MessageFromHostType messageType, byte[] messageContent)
    • toStringHeader

      protected String toStringHeader()
    • toString

      public String toString()
      Overrides:
      toString in class AntMessage
      Since:
      4.0