-
public final class WatchSessionRelayPhone-side relay that drives a session on a companion Wear OS watch over the Wearable Data Layer.
startSession sends a
start_sessioncommand to every connected node.The watch's engine streams events back on EVENT_PATH.
The returned Flow completes when the watch reports a terminal event (
session_summaryorsession_error).
The phone computes nothing here — the watch owns the session and this only carries commands out and events in.
This logic previously lived only inside the cross-platform session plugin's Android module, which declares no
maven-publish— so it was compiled into a plugin AAR that nothing could depend on. A native Android host, andsynheart-core-kotlin, therefore had no way to run a watch session at all, even though the implementation existed and worked. It belongs here, with the rest of the session SDK, and that plugin should consume it rather than carry its own copy.The callback API it had there is replaced with a Flow; the Data Layer behaviour is otherwise unchanged, including the message paths, which the companion watch app already listens on.
-
-
Constructor Summary
Constructors Constructor Description WatchSessionRelay(Context context)
-
Method Summary
Modifier and Type Method Description final WatchStatusstatus()Connectivity snapshot. final Flow<WatchHrSample>hrSamples()Heart-rate samples the watch measured. final Flow<SessionEvent>startSession(SessionConfig config)Start a session on the watch and stream its events. final UnitstopSession(String sessionId)Ask the watch to stop a session. -
-
Constructor Detail
-
WatchSessionRelay
WatchSessionRelay(Context context)
-
-
Method Detail
-
status
final WatchStatus status()
Connectivity snapshot.
Never throws: a Data Layer query failing is a disconnected watch, not an error the caller can act on, so it reports WatchStatus.reachable false while keeping
supportedhonest about whether the transport exists.
-
hrSamples
final Flow<WatchHrSample> hrSamples()
Heart-rate samples the watch measured.
Separate from startSession's event flow, and independent of it: the watch owns the sensor, and its readings are the phone's only biosignal source in this arrangement — the phone has no PPG. A host forwards these into the engine so HSI has physiology to work with; without that the five canonical axes stay at zero confidence no matter how long the watch measures.
Emits whenever a sample arrives, session or not. Nothing here interprets the values.
-
startSession
final Flow<SessionEvent> startSession(SessionConfig config)
Start a session on the watch and stream its events.
The flow registers the Data Layer listener before sending the command, so an event cannot be missed between the two. It completes on the watch's terminal event, and unregisters on completion or cancellation.
Emits a SessionErrorEvent rather than throwing when no node is connected: a watch going out of range is an ordinary runtime condition that a caller renders, not an exception.
-
stopSession
final Unit stopSession(String sessionId)
Ask the watch to stop a session.
Best-effort and silent on failure: the watch also stops on its own duration timer, so a dropped stop command ends the session late rather than leaving it running forever.
-
-
-
-