AntPlus device usage

i am struggling to get info from an ANT- device in ConnectIQ on Edge520.

In my page initializer I have this code:

    	if (Toybox.AntPlus has :BikeSpeed)
    	{
    		bscListener = new AntPlus.BikeSpeedListener();
    		bikeSpeed = new AntPlus.BikeSpeedCadence(bscListener);
    	}
    	else
    	{
    		Sys.println("Sensor not found");
    	}

But when I run it the "Sensor not found" message appears.  I have confirmed in the simulator that it is connecting to a bike speed cadence sensor, so I don't understand what I am doing wrong.  Am I missing something?

  • Toybox.AntPlus.BikeSpeed was introduced in CIQ 3.0.0 version, I think Edge 520 does not support that.

    At least in my environment I cannot select Edge 520 when my minimum SDK version is set to 3.0.x, in manifest editor. Edge 520 Plus would be already supported.

  • Also, if you plan to use combined speed and cadence sensor, you should choose Toybox::AntPlus::BikeSpeedCadence (in 'has' check) and BikeSpeedCadenceListener.

  • Ok, thank you.  I saw AntPlus was in SDK2.2, so I guess only just added speed sensor? 

    Is there any other way to get at speed data from an app on earlier versions of SDK?  if I can somehow get device number of the paired speed/cadence device then I can do my own ANT channel?  its quite critical to my application to have speed an power meter data from my ConnectIQ app, and ideally on an Edge 520 (that I have for development..).

  • Some AntPlus profiles have been available since 2.2.0, like BikePower and BikeLight. But speed and cadence stuff came at 3.0.0. So you should be able to access the power meter using AntPlus::BikePower and BikePowerListener.

    For speed/cadence, if you have sensor connected to your Garmin device, this AntPlus API would also be the way to talk more directly to the sensor. Because Garmin device will "own" the sensor when connected, it is not visible and accessible via Toybox:Ant API.

    If you don't connect it via Garmin device, then you are free to use Toybox:Ant API to talk to the sensor directly (available since CIQ 1.0.0). This requires a bit more work, since you need to do the connecting/pairing, know the contents of the data pages based on the specific profile, and then parse the data. But it can be done for sure, knowing your sensors AntID is easy, you can see that from sensor details from Garmin device when sensor is connected (and sometimes AntId is written on the sensor)

  • If you talk directly, you may run into a conflict if it's paired in the FW.  Also, some devices may not support native paring, even if they are running CIQ 3.x.

  • out of curiosity - why would you want to connect to them via ANT+ since most of the implementations are already available on a native device. AfAIK, unless its a power meter, cadence / speed is native to all Garmin wearable and edge devices

  • We have a device we are developing which uses ANT, so are developing a ConnectIQ app to display and log the data.  It would be useful to use the speed sensor data combined with our device data to display new metrics.  For example our device measures wind speed, so with bike speed we can calculate headwind.

    I have tried and seems not to work, but can someone confirm if there is any other way to access speed data on the Edge520, for example using the Sensor API?  Seems to "work" but returns zeros even with non-zero speed (using SimulANT to generate speed data). I guess Sensor API is using GPS to create speed data?  

    Seems like I can't be the only one wanting to access bike speed data on a cycle computer..? 

  •  since you only want the bike speed, can't you just use 

    developer.garmin.com/.../Info.html

    which reports the speed in m/s and then use that in combination w/ your ANT device to do the calculation? 

    The reported data from Garmin is based on priority

    1) Sensor

    2) GPS

    IIRC but you cannot choose between the 2 unless you connect to it (ant+).

    my datafiield and a lot of others are just using the activity.info class to get the current speed.

    Or you're basically creating an app? That's why you're using 

    https://developer.garmin.com/connect-iq/api-docs/Toybox/Sensor/Info.html#speed-instance_method

  • For my Battery State app, which is intended to display battery level (and other info) of all connected sensors. I have to use AntPlus APIs to collect the data I need (battery status, voltage, manufacturer name, sensor model, sensor Antid etc). And in special case I even use normal Ant API (dual-HR sensors). All this info is not available via other APIs.

  • Thats what I am looking for.   Thank you!