Skip to Content

During the measurement

After the measurement has started, you can monitor the stage and progress of the measurement.

Checking the measurement state

To see what is happening underneath you can call the getMeasurementState() method. It returns the following enumeration informing you about the state of the measurement.

enum MeasurementState { notStarted, // Measurement has not started yet waitingForFace, // Waiting for face to be properly positioned in the frame runningSignalShort, // Measurement started: Signal is too short for any conclusions runningSignalGood, // Measurement proceeding: Signal quality is good runningSignalBad, // Measurement stalled due to poor signal quality runningSignalBadDeviceUnstable, // Measurement stalled due to poor signal quality (caused by unstable device) finalizing, // Measurement capture has ended and final result computation is in progress finished, // Measurement has finished successfully failed, // Measurement has failed }

In particular, you should wait for Finished or Failed values, because they indicate that the measurement has concluded.

Tracking the measurement progress

To check the progress of the whole measurement you can call the getMeasurementProgressPercentage() method, returning a floating point number between 0 and 100.

Real-time metrics

During the measurement you can query the SDK for real-time metrics. These metrics are updated every second.

Heart rate

You can query the real-time heart rate based on the last 10 seconds of the measurement. The provided value is the average heart rate over the specified time interval and is expressed in beats per minute (BPM), rounded to the nearest integer.

final hr10s = await ShenaiSdk.getHeartRate10s();

Measurement success

When the Shen.AI SDK engine enters the Finished state it means that the measurement has concluded and computed metrics are available.

See Results to see how to access the results.