BSX, Stryd, and Tempe in Data Field

I'm new to developing in IQ, but I've been reading the SDK and trying to work through where to find paired sensor data. 

My goal is to implement the BSX open source code to turn the BSX on and off. But, it natively pairs to the F5x as a Muscle O2 sensor. 

I'm also trying to add the Tempe values on the same full page data field. 

Then, the reason I'm trying to do this... I'd also like to see power while running. 

All 3 sensors pair just fine on the watch (though I can't get anything to connect on the simulator on Win 10 with a Garmin ANT stick). 

I looked at connecting to the sensor class, but kept getting permission errors. Then I tried the sensor history class... I started with the Tempe, and it would only return the temp from the internal se sensor. 

I then found some old source for adding a Tempe to an Edge as a data field. But, it was implementing an ANT Sensor handler. It worked with the Tempe here and there... But it seemed to keep disconnecting and only occasionally getting data. 

Long story short... How do you get access to other sensors that are paired? The Activity Info class doesn't have much. There has to be a class I haven't found yet that has all the paired sensor values without writing an ANT handler for each sensor that is also paired separately from the watch.

Any help is appreciated. 

  • As you have found, the Sensor module is not available to data fields, afaik.

    The good news is that power is very easily available as Activity.info.currentPower, for multisport watches which can natively connect to a power meter. It's available while running (even though you may have to force the watch to connect to the sensor in run mode). Several CIQ data fields have the ability to display power in run mode in this way, like the excellent Dozen Run, and a couple of fields of mine.

    The bad news is that for your other sensors, you do have to write your own ANT handler. The downside is that when you do this, you can't also connect to the sensor natively at the same time, if I'm not mistaken. e.g. In the case of the Stryd, you either have to connect natively or through your data field, but not both. This is a not a big deal for power in run mode, but would probably be significant for the Tempe, since you probably want the Tempe to connect natively so temperature is recorded properly to your activity.

    If you want to make a data field that displays power in run mode for non-multisport watches, then you also need to write an ANT handler. For power this is pretty simple, but there is a memory cost due to added code and runtime objects, which is significant especially on older watches.

    https://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Sensor.html

    "App Types:

    • Widget

    • App

    • Audio Content Provider App

    • Background Services"

  • Actually, with a data field there is a way to return info form Sensor.Info, and get things like the temperature.  You need to do it in a background process.

    But background processes can run at most every 5 minutes, and run for at most 30 seconds at a time.  So for a Tempe, that might be fine, but for other sensors, maybe not.

    In the case of Edge devices, there is no SensorHistory, and the way to get data from the internal temperature sensor is the same as the Tempe on watches, as Edge devices don't support the Tempe as a standard sensor.  The internal Temperature reading is in Sensor.Info, so you get it in a background process as you would a Tempe.

  • Thanks for the clarification.

    Sorry, I purposely didn’t mention background processes because I assumed that getting data every five minutes was not sufficient for the OP’s use case. (Although I thought about mentioning it). 

    But I didn’t consider that a five minute frequency might be good enough for temperature.....

  • Yes, I know people that use a BG in DF's for the Edge device just to get the Internal Temp data.  It's actually not that different than watches with getTemperatureHistory for internal temp, as that only updates every few minutes.

  • Definitely appreciated on the details. The issue with adding a handler and using the native pairing is crap limitation. And the background processes is something I'll look at, but every 5 minutes isn't very useful for most runs. Maybe a marathon or ultra, but yeah... Not very useful there either. 

    Seems like I'm still going to be stuck with the two data field limitation and at best can add the BSX trigger to the field. Not sure how that might affect the native Muscle O2 pairing though.

    Would be nicer to have a memory limit to fields than a two screen limit. Stryd, BSX is it just for sensors. And then you can't take advantage of the many other data fields available (why I've used the same basic 1 data screen from Run Plus since almost day one on my ild F3 and now 5x).

    I'll keep scratching my head with the BSX bits at least and see if I can get Power added too in run mode... But, sounds like temp is out. 

    Time to figure out fonts now... Thanks for the input.