Class AntChannel
- All Implemented Interfaces:
android.os.Parcelable
This class is parcelable and can therefore be passed between processes. In this case care must be
taken that setChannelEventHandler(IAntChannelEventHandler)
and
clearChannelEventHandler()
are used properly. Also note that all copies of this object can make
calls into the ANT Radio Service, so who is making calls must be properly co-ordinated or changes to
the channel state from other processes must be accounted for.
- Since:
- 4.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface android.os.Parcelable
android.os.Parcelable.ClassLoaderCreator<T>, android.os.Parcelable.Creator<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final android.os.Parcelable.Creator<AntChannel>
Creates an AntChannel from a ParcelFields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addIdToInclusionExclusionList
(ChannelId channelId, int listIndex) Adds channel IDs to the inclusion/exclusion list for this channel.void
assign
(ChannelType channelType) Specifies the type of this channel and prepares the channel for use.void
assign
(ChannelType channelType, ExtendedAssignment extendedAssignment) Specifies the type of this channel and prepares the channel for use.void
burstTransfer
(byte[] data) Transmits the given data on this channel as a series of burst messages.void
Clears the handler registered to this callback throughsetAdapterEventHandler(IAntAdapterEventHandler)
and closes its associated resources.void
Clears the handler registered to this callback throughsetChannelEventHandler(IAntChannelEventHandler)
and closes its associated resources.void
close()
Closes this channel.void
configureFrequencyAgility
(int freq1, int freq2, int freq3) Configures the frequency agility feature for this channel.void
configureInclusionExclusionList
(int listSize, boolean exclude) Configures the inclusion/exclusion list for this channel which allows specifying specific channel IDs to ignore or include in a search.int
void
Disables event buffering for the entire adapter.protected void
finalize()
Gets theBackgroundScanState
of the ANT adapter this channel is running on.Gets theBurstState
of the ANT adapter this channel is running on.Gets theCapabilities
of this channel.Gets theEventBufferSettings
of the ANT adapter this channel is running on.Gets theLibConfig
of the ANT adapter this channel is running on.void
open()
Opens this channel.void
release()
Does the opposite ofAntChannelProvider
acquireChannel(), tearing down this channel instance.Asks the ANT Adapter this channel is running on for its version information.Asks the ANT Adapter this channel is running on for its Capabilities information.Asks the ANT Adapter for this channels ID information.Asks the ANT Adapter for this channels status information.void
setAdapterEventHandler
(IAntAdapterEventHandler eventHandler) Sets up the handler to be used for event callbacks from the adapter this channel is on.void
setAdapterWideLibConfig
(LibConfig libConfig) Requests which extended data to include with data messages.void
setBroadcastData
(byte[] payload) Sets the broadcast message for this channel.void
setChannelEventHandler
(IAntChannelEventHandler eventHandler) Sets up the handler to be used for event callbacks from this channel.void
setChannelId
(ChannelId channelId) Configures the channel ID for this channel.void
setEventBuffer
(EventBufferSettings eventBufferSettings) Requests an event buffer with the desired values contained within theEventBufferSettings
.void
Sets the event buffer to the default value defined byEventBufferSettings.DEFAULT_BUFFER_TIME_MILLISECONDS
.void
setPeriod
(int period_32768unitsPerSecond) Configures the messaging period of this channel.void
setProximityThreshold
(int searchThreshold) Sets a signal strength 'proximity' requirement on finding matches during searching.void
setRfFrequency
(int radioFrequencyOffset) Sets the RF frequency for this channel by a frequency offset, e.g.void
setSearchPriority
(int searchPriority) Sets the search priority for this channel.void
setSearchTimeout
(LowPrioritySearchTimeout lowPrioritySearchTimeout) Configures the length of time that this channel will perform a search before timing out and closing.void
setSearchTimeout
(LowPrioritySearchTimeout lowPrioritySearchTimeout, HighPrioritySearchTimeout highPrioritySearchTimeout) Configures the length of time that this channel will perform a search before timing out and closing, including high priority search - warning: high priority search can interfere with other active channels on the same adapter.void
setTransmitPower
(int outputPowerLevelSetting) Sets the transmit power level for this channel.void
startSendAcknowledgedData
(byte[] payload) Sends an acknowledged message on this channel, without waiting for the result (complete or failed).void
unassign()
Unassigns this channel.void
writeToParcel
(android.os.Parcel dest, int flags)
-
Field Details
-
CREATOR
Creates an AntChannel from a Parcel- Since:
- 4.0
-
-
Method Details
-
assign
public void assign(ChannelType channelType) throws android.os.RemoteException, AntCommandFailedException Specifies the type of this channel and prepares the channel for use. This clears channel configuration to defaults.A channel must be unassigned, using
unassign()
, before it can be reassigned.See the ANT Message Protocol and Usage document for more details.
- Parameters:
channelType
- Specify that this channel should be either a master or slave, and a shared channel or not.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
assign
public void assign(ChannelType channelType, ExtendedAssignment extendedAssignment) throws android.os.RemoteException, AntCommandFailedException, UnsupportedFeatureException Specifies the type of this channel and prepares the channel for use. The extended assignment enables enhanced functionality. The channel must have the desired capability set inCapabilities
for the request to succeed. This clears channel configuration to defaults.A channel must be unassigned, using
unassign()
, before it can be reassigned.See the ANT Message Protocol and Usage document for more details.
- Parameters:
channelType
- Specify that this channel should be either a master or slave, and a shared channel or not.extendedAssignment
- Indicates optional features to be enabled.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.UnsupportedFeatureException
- If attempting to assign a feature inExtendedAssignment
that is not supported by the installed ANT Radio Service. To determine if a feature is available usegetCapabilities()
.- Since:
- 4.0
-
unassign
Unassigns this channel. A channel must be unassigned before it can be reassigned usingassign(ChannelType)
. When a channel is unassigned you should assume any channel configuration previously performed on this channel has been lost.See the ANT Message Protocol and Usage document for more details.
- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
setChannelId
public void setChannelId(ChannelId channelId) throws android.os.RemoteException, AntCommandFailedException Configures the channel ID for this channel. Note: When a channel is searching, a value of 0 here signifies using a wild card for that parameter when finding a match.See the ANT Message Protocol and Usage document for more details.
- Parameters:
channelId
- The device number, device type and transmission type to identify this channel.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
setPeriod
public void setPeriod(int period_32768unitsPerSecond) throws android.os.RemoteException, AntCommandFailedException Configures the messaging period of this channel.See the ANT Message Protocol and Usage document for more details.
- Parameters:
period_32768unitsPerSecond
- The message period to use for this channel, in 1/32768ths of a second units. Valid range is 0-65535.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
setSearchPriority
public void setSearchPriority(int searchPriority) throws android.os.RemoteException, AntCommandFailedException, UnsupportedFeatureException Sets the search priority for this channel. If a channel has a higher search priority, it will pre-empt lower search priority search channels. This value is used to determine which channel is the active searching channel between multiple channels, but does not affect the search performance itself once a search is active.See the ANT Message Protocol and Usage document for more details.
- Parameters:
searchPriority
- The search priority to be used for this channel. Higher numbers are given higher priority. Valid range isChannelSearchPriorityMessage.LIB_MIN_SEARCH_PRIORITY
toChannelSearchPriorityMessage.LIB_MAX_SEARCH_PRIORITY
, and other values are reserved for system use. If search priority is not set, a channel automatically assumes the default search priority value ofChannelSearchPriorityMessage.LIB_DEFAULT_SEARCH_PRIORITY
.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.UnsupportedFeatureException
- If the service does not support configuring search priority- Since:
- 4.7.3
-
setRfFrequency
public void setRfFrequency(int radioFrequencyOffset) throws android.os.RemoteException, AntCommandFailedException Sets the RF frequency for this channel by a frequency offset, e.g. 50 MHz offset = 2450 MHz. The valid range for the offset can be found by getting the channel's capabilities (getCapabilities()
) and callingCapabilities.getRfFrequencyMin()
andCapabilities.getRfFrequencyMax()
. A frequency offset of 57 MHz (2457 MHz) is not allowed and is reserved for use by the ANT+ Plugin API, which must be used to connect to ANT+ devices. An attempt to set a frequency outside of these allowed values will fail with aAntCommandFailureReason.INVALID_REQUEST
. See the ANT Message Protocol and Usage document for more details.- Parameters:
radioFrequencyOffset
- The radio frequency to use for this channel's communication as an offset in MHz from 2400MHz (2.4GHz).- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
addIdToInclusionExclusionList
public void addIdToInclusionExclusionList(ChannelId channelId, int listIndex) throws android.os.RemoteException, AntCommandFailedException Adds channel IDs to the inclusion/exclusion list for this channel. Note: the search filtering is not enabled untilconfigureInclusionExclusionList(int, boolean)
is called.See the ANT Message Protocol and Usage document for more details.
- Parameters:
channelId
- The device number, device type and transmission type to identify this channel.listIndex
- The (0-based) index to place the ID at in the list. Valid range is 0-3. Always overwrites any existing value.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
configureInclusionExclusionList
public void configureInclusionExclusionList(int listSize, boolean exclude) throws android.os.RemoteException, AntCommandFailedException Configures the inclusion/exclusion list for this channel which allows specifying specific channel IDs to ignore or include in a search.addIdToInclusionExclusionList(ChannelId, int)
is used to configure the IDs in the list.See the ANT Message Protocol and Usage document for more details.
- Parameters:
listSize
- The number of IDs to reference from the id list (starting at index 0). Valid range is 0-4. 0=disable the list.exclude
- True to ignore the listed devices during a search. False to search for only the listed devices during a search.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
setSearchTimeout
public void setSearchTimeout(LowPrioritySearchTimeout lowPrioritySearchTimeout) throws android.os.RemoteException, AntCommandFailedException Configures the length of time that this channel will perform a search before timing out and closing. This function will use low priority search only and disable high priority search. Low priority search is the preferred default search mode because it does not interfere with the operation of other active channels on the same adapter.The maximum search time available using this function is 25s. Setting the timeout to
LowPrioritySearchTimeout.DISABLED
will cause the channel to immediately close when entering the search state.Note: This API restricts against longer timeouts to ensure other channels have fair access to search time. If an application must search for longer periods of time then it can open the channel again to start a new search when the search times out. However, applications must give special consideration to avoid starting new searches when unnecessary to save battery and resources e.g. when the target device is no longer present or when the app is in the background.
See the ANT Message Protocol and Usage document for more details.
- Parameters:
lowPrioritySearchTimeout
- The time before low priority search will timeout in 2.5s units.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure. Note: This function is not valid on channels in background scanning mode and will fail with failure reasonAntCommandFailureReason.INVALID_REQUEST
.- Since:
- 4.0
-
setSearchTimeout
public void setSearchTimeout(LowPrioritySearchTimeout lowPrioritySearchTimeout, HighPrioritySearchTimeout highPrioritySearchTimeout) throws android.os.RemoteException, AntCommandFailedException Configures the length of time that this channel will perform a search before timing out and closing, including high priority search - warning: high priority search can interfere with other active channels on the same adapter. Applications should always disable high priority search where possible. The high priority search will activate after the low priority search times out.The maximum search time available using this function is 30s. Setting the timeout to
LowPrioritySearchTimeout.DISABLED
andHighPrioritySearchTimeout.DISABLED
will cause the channel to immediately close when entering the search state.Note: This API restricts against longer timeouts to ensure other channels have fair access to search time. If an application must search for longer periods of time then it can open the channel again to start a new search when the search times out. However, applications must give special consideration to avoid starting new searches when unnecessary to save battery and resources e.g. when the target device is no longer present or when the app is in the background.
See the ANT Message Protocol and Usage document for more details.
- Parameters:
lowPrioritySearchTimeout
- The time before low priority search will timeout.highPrioritySearchTimeout
- The time before high priority search will timeout.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure. Note: This function is not valid on channels in background scanning mode and will fail with failure reasonAntCommandFailureReason.INVALID_REQUEST
.- Since:
- 4.0
-
configureFrequencyAgility
public void configureFrequencyAgility(int freq1, int freq2, int freq3) throws android.os.RemoteException, AntCommandFailedException Configures the frequency agility feature for this channel. Should be used in conjunction with theExtendedAssignment()
, enableFrequencyAgility parameter inassign(ChannelType, ExtendedAssignment)
. The valid range for frequency can be found by getting the channel's capabilities (getCapabilities()
) and callingCapabilities.getRfFrequencyMin()
andCapabilities.getRfFrequencyMax()
. A frequency offset of 57 MHz (2457 MHz) is not allowed and is reserved for use by the ANT+ Plugin API, which must be used to connect to ANT+ devices. An attempt to configure a frequency outside of these allowed values will fail with aAntCommandFailureReason.INVALID_REQUEST
. Should not be used with shared, or Tx-only/Rx-only channel types.See the ANT Message Protocol and Usage and AN10 ANT Frequency Agility documents for more details.
- Parameters:
freq1
- The first operating frequency offset in MHz from 2400MHz (2.4GHz).freq2
- The second operating frequency offset in MHz from 2400MHz (2.4GHz).freq3
- The third operating frequency offset in MHz from 2400MHz (2.4GHz).- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
setProximityThreshold
public void setProximityThreshold(int searchThreshold) throws android.os.RemoteException, AntCommandFailedException Sets a signal strength 'proximity' requirement on finding matches during searching. Note: This value is cleared any time a search is successful.Only ANT devices within the set proximity bin can be acquired. Search threshold values are relative to each other only; they are not correlated to specific distances, are not expected to be exactly equivalent between different chips, and will vary depending on the RF environment.
See the ANT Message Protocol and Usage document for more details.
- Parameters:
searchThreshold
- The proximity threshold to use. Valid range is 0-10. 0 = disabled. Values are relative to each other only and will vary in different RF environments.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
open
Opens this channel. Note: Channel must be in the 'assigned' state first usingassign(ChannelType)
.See the ANT Message Protocol and Usage document for more details.
- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
close
Closes this channel.Note: This method returns when the close command itself is successful, but not the actual event of the channel completing the close routines. To synchronize on the actual closing of the channel wait for the response event
EventCode.CHANNEL_CLOSED
in aMessageFromAntType.CHANNEL_EVENT
throughIAntChannelEventHandler.onReceiveMessage(MessageFromAntType, AntMessageParcel)
.See the ANT Message Protocol and Usage document for more details.
- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
requestChannelStatus
public ChannelStatusMessage requestChannelStatus() throws android.os.RemoteException, AntCommandFailedExceptionAsks the ANT Adapter for this channels status information.- Returns:
- This channels ChannelStatus.
- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
requestChannelId
public ChannelIdMessage requestChannelId() throws android.os.RemoteException, AntCommandFailedExceptionAsks the ANT Adapter for this channels ID information.- Returns:
- This channels ChannelId
- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
requestAntVersion
public AntVersionMessage requestAntVersion() throws android.os.RemoteException, AntCommandFailedExceptionAsks the ANT Adapter this channel is running on for its version information.- Returns:
- This Adapters ANT Version.
- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
requestCapabilities
public CapabilitiesMessage requestCapabilities() throws android.os.RemoteException, AntCommandFailedExceptionAsks the ANT Adapter this channel is running on for its Capabilities information. You probably want to be usinggetCapabilities()
instead.- Returns:
- This Adapters Capabilities.
- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
setBroadcastData
public void setBroadcastData(byte[] payload) throws android.os.RemoteException Sets the broadcast message for this channel. Broadcast messages have no guarantees or status to indicate they have been received by any receivers.If this channel is a master it will broadcast this data once every message period. If this channel is a slave it will broadcast this data once at the next transmit window.
See the ANT Message Protocol and Usage document for more details.
- Parameters:
payload
- The data to send in the broadcast message. Must be exactlyDataMessage.LENGTH_STANDARD_PAYLOAD
bytes long.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.- Since:
- 4.0
-
startSendAcknowledgedData
public void startSendAcknowledgedData(byte[] payload) throws android.os.RemoteException, AntCommandFailedException Sends an acknowledged message on this channel, without waiting for the result (complete or failed). Acknowledged messages will report if they have been received and acknowledged by a receiver or not through response events inIAntChannelEventHandler.onReceiveMessage(MessageFromAntType, AntMessageParcel)
Note that for some old hardware, the ANT radio service may forcibly release the channel if an acknowledged message transfer was pending while the channel drops to search state and closes to prevent some bugs in the firmware layer. Therefore, when using acknowledged messages the app must either guarantee that it never has a pending ack when a channel closes or to handle recovery from occasional channel death on affected platforms when the case occurs.
See the ANT Message Protocol and Usage document for more details.
- Parameters:
payload
- The data to send in the acknowledged message. Must be exactlyDataMessage.LENGTH_STANDARD_PAYLOAD
bytes long.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
burstTransfer
Transmits the given data on this channel as a series of burst messages. Blocks until burst is finished, either successfully or a failure.Burst transfers that exceed the maximum allowed size will fail with
AntCommandFailureReason.INVALID_REQUEST
reason. Applications can query the maximum burst size viaBurstState.getMaxBurstSize()
either from a BurstState instance received when aIAntAdapterEventHandler.onBurstStateChange(BurstState)
adapter event occurs or fromgetBurstState()
.See the ANT Message Protocol and Usage document for details.
- Parameters:
data
- The data to send as a burst. Must be at leastDataMessage.LENGTH_STANDARD_PAYLOAD
bytes long.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure or the burst failed.- Since:
- 4.0
-
setTransmitPower
public void setTransmitPower(int outputPowerLevelSetting) throws android.os.RemoteException, AntCommandFailedException Sets the transmit power level for this channel. By default all channels are requesting a transmit power of as close to 0dBm as supported (usually setting 3).See the ANT Message Protocol and Usage document for more details.
- Parameters:
outputPowerLevelSetting
- The transmission power to use. The exact meaning of the value passed here changes between hardware. Setting 0 is the lowest, with each higher setting indicating a higher transmit power.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
setAdapterWideLibConfig
public void setAdapterWideLibConfig(LibConfig libConfig) throws android.os.RemoteException, AntCommandFailedException Requests which extended data to include with data messages.The Lib Config setting is adapter wide, so any extended data enabled by at least one channel will be enabled for all channels (including channels acquired by other applications). The extended data is only disabled when every channel on the adapter has cleared their requests for that feature. When first acquired, a channel is not requesting any Lib Config features.
See the ANT Message Protocol and Usage document for details.
- Parameters:
libConfig
- Indicates extended data requested to be enabled.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.0
-
setEventBuffer
public void setEventBuffer(EventBufferSettings eventBufferSettings) throws android.os.RemoteException, AntCommandFailedException Requests an event buffer with the desired values contained within theEventBufferSettings
. The buffer may be flushed earlier than the set values if another channel sets values lower than the values set by this channel (see note). By default, channels set the maximum buffer time to 2 seconds, the optimal value for responsiveness and power savings. Setting the maximum buffer time to less than the default value will sacrifice significant power savings provided by event buffering.Event buffering can be used to lower power consumption caused by processing frequent messages. See the ANT Message Protocol and Usage document for details.
Note: Event buffering is a chip-wide setting. If multiple channels set Event Buffering, the buffering time will be set to the minimum value. If another channel sets the buffering time to 0 (disabling buffering) no buffering will occur on this adapter and so, setting the event buffer does not guarantee buffering will occur given the possibility of this scenario.
- Parameters:
eventBufferSettings
- Indicates the specific event buffer values to be requested- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.1
-
setEventBufferToDefault
Sets the event buffer to the default value defined byEventBufferSettings.DEFAULT_BUFFER_TIME_MILLISECONDS
.This should only be used if the channel supports event buffering.
- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.1
-
disableEventBuffer
Disables event buffering for the entire adapter. By disabling event buffering, this guarantees that no buffering will occur on any channel on the adapter and will sacrifice the significant power savings provided by event buffering.This should only be used if the channel supports event buffering.
- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.AntCommandFailedException
- If the service reported a failure.- Since:
- 4.1
-
setChannelEventHandler
public void setChannelEventHandler(IAntChannelEventHandler eventHandler) throws android.os.RemoteException Sets up the handler to be used for event callbacks from this channel. Setting a handler clears any handler previously registered. The handler can be cleared by callingclearChannelEventHandler()
.- Parameters:
eventHandler
- The handler to receive the channel events.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.- Since:
- 4.0
- See Also:
-
clearChannelEventHandler
public void clearChannelEventHandler() throws android.os.RemoteExceptionClears the handler registered to this callback throughsetChannelEventHandler(IAntChannelEventHandler)
and closes its associated resources.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.- Since:
- 4.0
-
setAdapterEventHandler
public void setAdapterEventHandler(IAntAdapterEventHandler eventHandler) throws android.os.RemoteException Sets up the handler to be used for event callbacks from the adapter this channel is on. Events are triggered for any configuration changes that impact all channels on an adapter. Setting a handler clears any handler previously registered. The handler can be cleared by callingclearAdapterEventHandler()
.- Parameters:
eventHandler
- The handler to receive the adapter events.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.- Since:
- 4.0
- See Also:
-
clearAdapterEventHandler
public void clearAdapterEventHandler() throws android.os.RemoteExceptionClears the handler registered to this callback throughsetAdapterEventHandler(IAntAdapterEventHandler)
and closes its associated resources.- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.- Since:
- 4.0
-
getCapabilities
Gets theCapabilities
of this channel. These are based on the adapter (hardware) the channel is running on.- Returns:
- The capabilities of this channel.
- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.- Since:
- 4.0
-
getEventBufferSettings
Gets theEventBufferSettings
of the ANT adapter this channel is running on.- Returns:
- The event buffer settings of this channel's adapter. Null, if event buffering is not supported by the ANT Radio Service version installed.
- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.- Since:
- 4.1
-
getBurstState
Gets theBurstState
of the ANT adapter this channel is running on.- Returns:
- The burst state of this channels adapter.
- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.- Since:
- 4.0
-
getLibConfig
Gets theLibConfig
of the ANT adapter this channel is running on.- Returns:
- The extended data configuration of this channels adapter.
- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.- Since:
- 4.0
-
getBackgroundScanState
Gets theBackgroundScanState
of the ANT adapter this channel is running on.- Returns:
- The background scan state of this channels adapter.
- Throws:
android.os.RemoteException
- If you receive this exception then the channel should be considered dead. In this circumstance you can attempt to acquire a replacement channel.- Since:
- 4.0
-
release
public void release()Does the opposite ofAntChannelProvider
acquireChannel(), tearing down this channel instance. It cannot be used after calling this method. This signals the ANT Radio service to reclaim the channel resources for other applications to use.- Since:
- 4.0
-
finalize
-
describeContents
public int describeContents()- Specified by:
describeContents
in interfaceandroid.os.Parcelable
-
writeToParcel
public void writeToParcel(android.os.Parcel dest, int flags) - Specified by:
writeToParcel
in interfaceandroid.os.Parcelable
-