-
public final class SynheartSessionTimer-driven session engine. Collects HR data from a BiosignalProvider, buffers samples in a sliding window, and emits typed SessionEvents with computed metrics on a Flow.
Mirrors the Flutter sibling
SynheartSessionand the Swift siblingSynheartSession. The on-the-wire shape (returned by SessionEvent.toMap) is identical across all three SDKs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classSynheartSession.Companion
-
Constructor Summary
Constructors Constructor Description SynheartSession(BiosignalProvider provider, BehaviorProvider behaviorProvider)
-
Method Summary
Modifier and Type Method Description final UnitingestHsiMetrics(String sessionId, Map<String, Object> hsiMetrics)Ingest pre-computed HRV metrics from the runtime, scoped to a session. final SharedFlow<SessionEvent>startSession(SessionConfig config)Start a new session and return a hot SharedFlow of SessionEvents. final UnitstopSession(String sessionId)Stop a running session — emits a final SessionSummary and completes the flow. final SessionStatusgetStatus()Typed status snapshot of the current session, or nullif none.final Unitdispose()Release resources held by this instance. -
-
Constructor Detail
-
SynheartSession
SynheartSession(BiosignalProvider provider, BehaviorProvider behaviorProvider)
-
-
Method Detail
-
ingestHsiMetrics
final Unit ingestHsiMetrics(String sessionId, Map<String, Object> hsiMetrics)
Ingest pre-computed HRV metrics from the runtime, scoped to a session.
The session SDK does not compute HRV locally; the runtime supplies artifact-filtered, authoritative values. No-op if sessionId does not match the currently active session.
-
startSession
final SharedFlow<SessionEvent> startSession(SessionConfig config)
Start a new session and return a hot SharedFlow of SessionEvents.
Flow lifecycle:
SessionStarted→SessionFrame*→SessionSummary(orSessionErrorEventon failure). When SessionConfig.includeRawSamples is true,BiosignalFrameevents interleave between session frames.Eagerly starts the biosignal provider and emission timers; callers that subscribe late will miss earlier events (mirroring Flutter's stream semantics).
-
stopSession
final Unit stopSession(String sessionId)
Stop a running session — emits a final SessionSummary and completes the flow.
-
getStatus
final SessionStatus getStatus()
Typed status snapshot of the current session, or
nullif none.
-
-
-
-