Appearance
Session State
A measuring session is always in a "state". The session transitions between possible states either by following an API action called by the application, or via internal logic that is intended to prepare the session for performing measurements. The session state diagram appears in the figure below.
Session States
The table below provides a description of each session state:
State Name | State Definition |
---|---|
initializing | The session is in its initial state, performing initialization actions. Please wait until you receive the message indicating that the session is in the ready state before starting to measure vital signs or before calling any session APIs. |
ready | The session is now ready to be started. The application can display the camera preview. Refer to the Creating a Preview page for detailed instructions. |
starting | The session is currently preparing to measure vital signs. |
processing | The session is processing the images and calculating vital signs. For information on the handling of instantaneous vital signs, please refer to the Vital Signs page. |
stopping | The session has been stopped, and the measurement results are being calculated. For information on the handling the final results, please see the Vital Signs page. |
terminating | The session is currently being terminated. Please refrain from calling any session APIs. |
terminated | The session has been gracefully terminated, and a new session can now be initiated. |
Session State Transitions
The table below describes the actions that cause a transition between the states:
State | Next State | Trigger |
---|---|---|
initializing | ready | Once all initialization actions are completed, the session transitions to the ready state. |
ready | starting | Calling the start() method causes the session to transition to the starting state. |
starting | processing | The session's actions in the starting state were completed. |
processing | stopping | The session will transition to the stopping state under the following circumstances: *The measurement ends gracefully either because it reached the defined duration or due to a manual invocation of the stop() method. *The measurement was stopped due to an error. Refer to the Alerts section for more information. |
stopping | ready | The SDK has finished performing the vital sign calculations. |
ready | terminating | By calling the terminate() method, the session transitions to the terminating state. |
terminating | terminated | The termination actions have been completed. |
Note
The starting, stopping and terminating states are 'transition states' that end automatically after a short period. Do not call any session methods while the session is in transition.
Receiving Session State Updates
The application can receive session state updates by implementing onSessionState
as part of SessionInfoListener
:
Dart
void onSessionStateChange(SessionState sessionState) {
// Receive session state updates
}
void onWarning(WarningData warningData) {
// Receive warnings
}
void onError(ErrorData errorData) {
// Receive errors
}
void onLicenseInfo(LicenseInfo licenseInfo) {
// Receive license info
}
void onEnabledVitalSigns(SessionEnabledVitalSigns enabledVitalSigns) {
// Receive the enabled vital signs for the session
}
Handling State Transitions
The code below is a simple example for handling session transitions updates by implementing onSessionState
as part of SessionInfoListener
.
Dart
@override
void onSessionStateChange(SessionState sessionState) {
switch (sessionState) {
case SessionState.initializing:
print("Session is initializing and NOT ready");
break;
case SessionState.ready:
print("Session is ready to start measuring");
break;
case SessionState.starting:
print("Session is preparing for the measurement of vital signs");
break;
case SessionState.processing:
print("Session is measuring vital signs");
break;
case SessionState.stopping:
print("Session is stopping the measuring of vital signs");
break;
case SessionState.terminating:
print("Session is preparing to terminate");
break;
case SessionState.terminated:
print("Session is terminated");
break;
}
}