AntPlus Class Library Overview

The AntPlus class library supports a number of ANT+ device profiles as defined by Garmin/Dynastream. All device profiles are based on the abstract class AntDevice. Common data pages and timeout options are provided to support the device profiles. The following device profiles are supported -

  • Asset Tracker

  • Bicycle Power

    • Crank Torque Frequency Sensor

    • Standard Power Sensor

    • Standard Crank Torque Sensor

    • Standard Wheel Torque Sensor

  • Bike Speed and Cadence

    • Bike Cadence Sensor

    • Bike Speed Sensor

    • Combined Speed and Cadence Sensor

  • Fitness Equipment

    • Climber

    • Elliptical

    • Nordic Skier

    • Rower

    • Trainer/Stationary Bike

    • Treadmill

  • Geocache

  • Heart Rate

  • Muscle Oxygen

  • Stride Based Speed and Distance Monitor

  • Unknown

See SmallEarthTech.AntPlus.DeviceProfiles for specific device details.

AntDevice

This abstract class provides properties and methods common to all ANT devices. The virtual Parse method handles resetting the device timeout each time a message is received. The RequestDataPage method sends a data page request to the ANT device. The SendExtAcknowledgedMessage method sends commands/requests to the ANT device.

CommonDataPages

CommonDataPages are typically added to derived AntDevice classes as a read-only property if the ANT device supports common data pages.

C#
public CommonDataPages CommonDataPages { get; }

The AntDevice constructor will create and assign the CommonDataPages class. Here's an example from the BikeRadar class -

C#
public BikeRadar(ChannelId channelId, IAntChannel antChannel, ILogger<BikeRadar> logger, TimeoutOptions? options)
    : base(channelId, antChannel, logger, options)
{
    CommonDataPages = new CommonDataPages(logger);
    for (int i = 0; i < 8; i++) { RadarTargets.Add(new RadarTarget()); }
}

AntDeviceCollection

This is a thread-safe observable collection of ANT devices. The constructor will initialize the ANT radio for continuous scan mode and direct all messages received from the ANT radio to a private handler. This handler will select an ANT device from the collection or create a new ANT device and add it to the collection. The message is then passed to the ANT device parser for handling by the device.

TimeoutOptions

Set either Timeout in milliseconds or MissedMessages to the number of missed messages before signaling device offline. Prefer MissedMessages as this scales the timeout to the ANT device broadcast message rate. Set Timeout to -1 to disable ANT device timeouts.

See Also