feat(train): the Loop's training sessions as workouts (ADR 0030, D39)

Each read of the band lists the sessions it holds, reads those from the
read's first day on (`LoopDays.kt`, one line per exercise: its start
with the band's offset, length, Polar's sport ID, figures and heart
rate at its interval), and deletes those up to the day kept, as the
days. The app keeps each as a workout of origin Polar Loop with its
heart rate (`takeLoopSessions`), Polar's running and cycling as
Train's and every other sport as the new `Activity.other`, which a
workout's edit sheet now changes; a session overlapping a workout Train
recorded gives it its heart rate where it has none instead. The
sessions taken are remembered in `loop.json`, so one deleted in Train
isn't brought back. Health Connect writes the Loop's workouts as
Train's own.

The SDK gives sessions as its protobuf messages: protobuf-javalite
3.20.0, the SDK's own, is named for compiling only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-28 20:22:23 +01:00
commit 2c5467a282
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -3,7 +3,7 @@
- **Status:** decided 27–28 Oct 2026, by the developer (D1–D39 below). The shell (D12)
is built; recording (D13–D28) is built on Android, iOS waiting for a Mac; Health
Connect (D29–D31) is built; the Loop's setup and keeping (7a, D34–D36) and its
daily data (7b, D37, D38) are built; its sessions (7c, D39) are being built.
daily data (7b, D37, D38) and its sessions (7c, D39) are built.
- **Numbering:** 0025 is held by the federation draft (stashed), 0026–0029 by the .NET
rewrite on the local branch `rewrite-dotnet`, abandoned on 27 Oct; Train takes the next
free number so that neither is ever read as this one.
@ -710,6 +710,25 @@ Strava. What was found, 27 Oct:
the background job, and deleted on the band once sealed by the same rule (D38); one
deleted in Train is remembered, so it isn't brought back.
7c built so (28 Oct), with choices of mine for the developer to look at: a
multisport session is a workout per exercise, each with the band's reference and its
index as its ID; the workout's moving time is the session's length, its distance the
band's sum, its series the heart rate alone (speed and cadence samples are read but
not kept, as Train has no series for them yet, and a band without GPS has no
track); a heart-rate sample of 0 is none; every session the band holds is listed at
each read (they are few, as the kept ones go), those from the read's first day on
read and those up to the day kept deleted; the sessions taken in are remembered in
`loop.json` by ID with their date, forgotten a week after that date is kept, and a
session already kept as a workout (`loop.json` lost) isn't brought again either; a
double is looked for among the workouts Train recorded alone, not those brought in
from Health Connect; *Other workout* can't be recorded on the phone (the record sheet
offers it not), and the edit sheet changes any workout's activity. Polar's training
sessions are protobuf messages of the SDK's, so the app names protobuf-javalite
3.20.0, the SDK's own, for compiling (`compileOnly`), adding nothing to the APK.
Health Connect's writing takes the Loop's workouts as Train's own, its *bring in the
track* stays for Health Connect's. Not yet tried with a Loop: Polar's other sport
IDs, and whether the band keeps samples of a detected session, are for a real band.
## Consequences
- Train's sensors are one pattern: open profiles read by the app itself, on the phone;