setEnabledSensors functionality in Apps

When we use "setEnabledSensors" in an App to access a HR or Speed and Cadence sensor, how can we control which sensor it will use if more than one sensor is paired to the watch in various activity or sport/multisport profiles? Where will the wheel size information be drawn from? If both a Power Meter and a Speed/Cadence sensor are paired, will it follow the same preferential hierarchy that the watch normally does?

What is the syntax for enabling more that 1 sensor? The following code seems to only enable 1 sensor at a time. When I run the simulator, I can only get HR or Cadence depending on the order of the, but not both together.

Snsr.setEnabledSensors( [Snsr.SENSOR_BIKECADENCE], [Snsr.SENSOR_HEARTRATE] );
Snsr.enableSensorEvents( method(:onSnsr) );

When I run the FIT simulator using data from a FIT file, it shows the HR or Speed data correctly, but the Cadence always shows 127. Is this a bug, or does the Cadence data need to be processed differently?
  • Former Member
    Former Member over 10 years ago
    The first thing I need to note is that this module will probably have at least some minor changes (possibly major) coming to it before ConnectIQ hits devices. That said, this is how it functions currently:

    If more than one sensor of the type requested is paired to the system, the device will connect to the first paired device that is available.

    If multiple sensors that provide the same data are connected, the data will be provided using the same precedence the device uses for native behavior.

    The setEnabledSensors function takes an array of sensors to enable as a parameter. The correct syntax would be:
    Snsr.setEnabledSensors( [Snsr.SENSOR_BIKECADENCE, Snsr.SENSOR_HEARTRATE] );

    I'll try to check on parsing cadence from a FIT file to see if there is a bug there.
  • Brian, Thanks for the explanation on pairing.

    The syntax you listed gives an Array Out Of Bounds Error.
  • Former Member
    Former Member over 10 years ago
    We've confirmed both issues (array out of bounds, and cadence = 127) as bugs in the 0.1.0 simulator. The array out of bounds had already been fixed, and I am testing a fix for parsing cadence from fit files.

    We are planing a bug fix release for the end of this week, and both of these fixes should be included.
  • If multiple sensors that provide the same data are connected, the data will be provided using the same precedence the device uses for native behavior.

    Brian,
    So that would mean that it isn't, for instance, possible to use a widget to display current pace from a running footpod when the watch is configured to display pace from GPS?