Events

During a measurement, the SDK emits events to inform the application of the progress of the PPG measurement. Events will only be emitted after a measurement is started using the startMeasurement SDK Method.

Subscribe to events

The following code examples demonstrate how to listen for events on each platform. The examples feature the onFingerDetected events. Subscribing to other events is similar.

FibriCheckView(
    ...
    onFingerDetected: () => { ...your code here...},
    ...
),

Available events

onFingerDetected

Description

The user's finger is correctly placed on the smartphone camera.

Frequency

Can be emitted multiple times if a user moves their finger.

When

Before measurement, during measurement, after measurement

Data

/

onFingerRemoved

Description

The user's finger is no longer present on the camera. When the finger is removed, the measurement is paused until the finger is detected again.

Frequency

Can be emitted multiple times if a user moves their finger placement on the camera. Happens after a onFingerDetected event.

When

Before measurement, during measurement, after measurement

Data

y[number] - Luminance v[number] - Red chrominance stdDevY[number] - Luminance standard deviation

onFingerDetectionTimeExpired

Description

The user's finger has not been detected within the set time. This event is disabled by default.

Frequency

Once per measurement

When

Before measurement

Data

/

onPulseDetected

Description

Emitted when a pulse has been detected. The pulse detection is only active after the finger detection has been completed.

Frequency

Once per measurement

When

Before the measurement

Data

/

onPulseDetectionTimeExpired

Description

Emitted when no pulse has been detected after 10 seconds.

Frequency

once per measurement

When

Before the measurement

Data

/

Info

This is an informational event, it's not required to implement this event. The measurement process will continue independent of a pulse being detected.

onCalibrationReady

Description

When performing a measurement, a baseline needs to be calculated. When this baseline has been calculated, the calibration is ready and the SDK will emit this event.

Frequency

Once per measurement

When

Before measurement

Data

/

onMeasurementStart

Description

Emitted when the PPG measurement has successfully started started.

Frequency

Once per measurement

When

Before the measurement

Data

/

onHeartBeat

Description

Emitted when a heartbeat is detected. Returns the heart rate as a number.

Frequency

Multiple times per measurement, emitted on every change in heart rate

When

During the measurement

Data

heartrate[number]

onSampleReady

Description

Emitted every time when a PPG signal has been successfully extracted from a camera image. It can be used to draw a graph or analyse the data during the measurement.

Frequency

Multiple times per measurement, typically around 30 times per second during the measurement.

When

Before and during the measurement.

Data

ppg[number] - filtered PPG value raw[number] - raw PPG value Use the ppg value when you want to visualise a chart to the user

When acting on this event it's important to measure the performance of the application while measuring. Especially in cross-platform environments (Flutter, React Native, Cordova) it's possible that the bridging layer is not fast enough to handle the amount of data that this event generates.

The range of PPG values reported by this event can vary greatly between different devices and depends on ambient lightning conditions. If you want to plot the PPG values, keep these recommendations:

  • Only plot the latest x samples

  • Use dynamic ranges for the y-axis of the visualization to account for differences in device specifications and conditions.

onMovementDetected

Description

Emitted when the SDK detects movement of the phone. Depends on the value of movementDetectionEnabled, which is true by default

Frequency

Multiple times per measurement

When

During the measurement

Data

/

onTimeRemaining

Description

Emitted to update the application on the time remaining in seconds for the measurement to complete.

Frequency

Every second during the measurement

When

During the measurement

Data

timeRemaining[number]

onMeasurementFinished

Description

Emitted when the measurement has finished. After this event, the SDK starts processing the measurement.

Frequency

Once

When

After the measurement

Data

onMeasurementError

Description

Emitted when a measurement error occurs. The measurement wil stop. Possible errors: BROKEN_ACC_SENSOR - Can happen on iOS devices, ask the user to reboot the device if this happens.

Frequency

Once

When

During the measurement

Data

Error[string]

onMeasurementProcessed

Description

Emitted when the measurement has been processed. The output of this event should be forwarded to the FibriCheck Cloud for further analysis by the FibriCheck Algorithm.

Frequency

Once

When

After the measurement

Data

Measurement - details of the returned data can be found in Measurements

Last updated