[Solved]: let Connect IQ apps download stored HRM-Swim heart rate data

I bought an HRM-Swim specifically for windsurfing, because I fall in the water a lot and wanted heart rate data that survives the dunks. I'm writing my own Connect IQ app for windsurfing (Forerunner 255S, CIQ 5.2), and so far I haven't been able to use the strap's main feature from it. That's pretty frustrating for an expensive strap I bought for exactly this purpose.

This was asked before and never answered: forums.garmin.com/.../can-an-app-use-stored-hrm-swim-strap-data

I tested it: with the native Pool Swim and Open Water activities, the watch searches for the strap after saving, downloads the stored heart rate data, and the data ends up in the FIT file. With my app, the session is saved immediately: no search, no download, no stored data in the FIT file. That's true even when I set the sport to swimming / open water in createSession(). The data is still on the strap, though. A native Open Water activity recorded afterwards downloaded it, including the time of my app's sessions.

Questions:
1. Is there an API that lets a CIQ app trigger the stored-HR download when the session is saved? If not, could this be added as a feature request?
2. Until then, is there a recommended way to get stored strap data into an activity recorded by a CIQ app?

I'd really appreciate any pointers. It would be great to finally get full use out of this strap.

Thanks!

  • I think that strap is ant+ so you could try using ant+ directly to the strap.  Same if it uses BLE.

  • Thanks Jim, that was the right direction.

    Here's an update for anyone who finds this thread later: it works. A Connect IQ app can download the stored heart rate from the strap itself over ANT. Below is how I - and when I say I, I mean Claude Code - did it, what I used, and how it differs from the native Garmin activities.

    Documentation I used
    - ANT+ Device Profile Heart Rate (Rev 2.1): common data page 70 (request data page) and the HR pages
    - The ANT-FS Technical Specification and Dynastream's ANT-FS PC host source code: the byte layouts of beacon, link, authentication, download and directory
    - The Connect IQ API docs for Toybox.Ant (GenericChannel, acknowledged messages, burst transfers)

    How the strap download works
    1. Connect: open an Ant.GenericChannel on NETWORK_PLUS as a normal ANT+ HR receiver (device type 120, period 8070, frequency 57).
    2. Ask for an ANT-FS session: once HR pages arrive, send common page 70 as an acknowledged message, asking for the ANT-FS beacon. The strap stays on the same channel and starts sending ANT-FS beacons (0x43) instead of HR pages. This is "broadcast ANT-FS".
    3. Link: send the link command (frequency 19 = 2419 MHz, 8 Hz). Then close the channel and reopen it on the new frequency and period.
    4. Authenticate: pass-through authentication is accepted. No pairing and no passkey are needed.
    5. Download: use burst transfers. Index 0 is the directory. The HR files are type 0x80, subtype 4.
    6. Disconnect: send the "return to broadcast" command, and the strap resumes normal HR pages.

    What's on the strap
    - Plain FIT files: each file contains standard FIT hr messages (global 132), the same ones native swim activities contain. The official FIT SDK decodes them as is.
    - One time stamp per beat: in 1/1024 s, counted on the strap's own uptime clock. The directory header contains a pair "uptime Left right arrow real FIT time", which converts beat times to clock time. The result was 1–2 s off the watch clock in my tests.
    - Records whenever worn: the strap records every heartbeat while it's worn, not only during an activity. Every ANT-FS connection closes the current file and starts a new one.
    - Archive flag: downloading sets each file's "archived" flag. I don't know whether the watch then skips those files on its own downloads.

    Pitfalls in Connect IQ
    - The watch's own search blocks yours: if your app enables the HR sensor (Sensor.setEnabledSensors([SENSOR_HEARTRATE])), the generic channel never found the strap for me, not even after 100 s. Switching the sensor off before opening the channel fixed it. With that, the strap was found within 1–2 s every time.
    - Watchdog: large burst blocks plus processing in one callback trip "Code Executed Too Long". 1 KB blocks, and converting in slices on a timer, avoid it.

    How my app uses it

    When you choose Save:
    1. The app switches off GPS and its HR sensor use and downloads the strap file(s) covering the session.
    2. It converts the beats to one HR value per second.
    3. It vibrates when done. For a 10-minute session, download and conversion took about 13 s.

    Where the data goes, and how this differs from native activities
    - Native activities append the downloaded data unchanged as standard hr messages after the end of the activity. Garmin Connect merges them into the HR graph on the server. The watch itself doesn't change any earlier records.
    - A Connect IQ app can't do that: it can't write hr messages, and it can't change records that were already written. Its only option is developer fields (FitContributor) in the messages being written at that moment, at most 256 bytes per message.
    - My workaround: after Save, the app restarts the timer for a few seconds. It writes the per-second values into a record developer field, in 240-byte blocks with a sequence number and a header block. Then it saves.
    - Then a desktop script reads those blocks and replaces the HR of every data point with the strap's value. It finds the strap clock offset by comparing with the live HR, removes the extra tail and corrects the session/lap summaries. The result is a normal FIT file you can upload to Garmin Connect or Strava.

    Test result: 10 minutes in the bath tub with the strap under water. The watch lost the live strap connection for about 4 of those minutes and quietly fell back to wrist HR. The strap's stored data had no gaps, and after merging it matched the live strap HR within about 1 bpm.

    So my feature request still stands, but more specific now. (And less urgent, because this works for me personally.) Please either let Connect IQ apps write hr messages, or let them trigger the same stored-HR download the native activities do. Either would make the desktop step unnecessary.