Class: Toybox.Ant.ChannelAssignment

Overview

A class to control the assignment of an ANT wireless channel.

Since:

API Level 1.0.0

Instance Member Summary collapse

Instance Method Summary collapse

Instance Attribute Details

var channelType as Ant.ChannelType

Defines the type of channel.

The channel can be defined to primarily send data (master) or receive data(slave). The channel type is set via the CHANNEL_TYPE_* constant passed to the Ant.ChannelAssignment.initialize() function for the channelType parameter.

Since:

API Level 1.0.0

var network as Ant.NetworkType

Defines the type of network the channel should operate under.

The network is set via the NETWORK_* constant passed to the Ant.ChannelAssignment.initialize() function for the network parameter.

Since:

API Level 1.0.0

Instance Method Details

initialize(c as Ant.ChannelType, n as Ant.NetworkType)

Constructor By default disables background scanning.

Parameters:

Example:

using Toybox.Ant;

var channelType = Ant.CHANNEL_TYPE_RX_NOT_TX  // Bidirectional Receive (Slave)
var network = Ant.NETWORK_PUBLIC;             // Ant public network
// Get the channel
channelAssign = new Ant.ChannelAssignment(channelType, network);

// Initialize the channel - assumes message callback method
GenericChannel.initialize(method(:onMessage), channelAssign);

See Also:

Since:

API Level 1.0.0

isBackgroundScanEnabled() as Lang.Boolean

See if background scanning is enabled for the channel assignment.

Example:

using Toybox.Ant;
// Assuming initialized channel
ChannelAssignment.isBackgroundScanEnabled();

Returns:

  • Lang.Boolean

    Returns true if background scan is enabled, otherwise false.

Since:

API Level 1.2.0

setBackgroundScan(isBackgroundScanEnabled as Lang.Boolean) as Lang.Boolean

Set background scan to be enabled or disabled.

Enabling background scan can only be done on Receive Only channels.

Parameters:

  • isBackgroundScanEnabled(Lang.Boolean)

    Value is true to enable background scan, otherwise false.

Example:

using Toybox.Ant;
// Assuming initialized channel
ChannelAssignment.setBackgroundScan(isBackgroundScanEnabled);

Returns:

  • Lang.Boolean

    Return true if the background scan property was successfully set, otherwise false.

Since:

API Level 1.2.0


Generated Dec 11, 2024, 8:58:42 AM