API Reference
API Reference for the SmartSpectra SDK.
SmartSpectraSdk
Entry point for the SmartSpectra SDK. Most apps use the shared singleton initialized by AndroidX Startup, or call [initialize] with a custom [SmartSpectraConfig] before accessing [shared].
Methods
-
public suspend fun start()Begin processing frames from the device camera.
-
public suspend fun stop()Stop processing. Call [start] again to resume.
-
public fun requestInsight(text: String): IntDispatch an on-demand insight request alongside the vitals samples buffered since the last send.
-
@JvmStatic @JvmOverloads fun initialize( context: Context, config: SmartSpectraConfig = SmartSpectraConfig(), ): SmartSpectraSdkInitialize the shared SDK instance and apply the provided configuration.
Properties
-
val config: SmartSpectraConfig -
public val metrics: LiveData<Metrics?> = _metrics -
public val insight: LiveData<Insight?> = _insight -
public val imageOutput: LiveData<Bitmap?> = _imageOutput -
val processingStatus: LiveData<ProcessingStatus> -
val validationStatus: LiveData<ValidationStatus?> = _validationStatus -
val error: LiveData<SmartSpectraError?> = _error -
val version: String -
val shared: SmartSpectraSdkShared SmartSpectra SDK instance.
SmartSpectraConfig
Configuration for [SmartSpectraSdk]. Most apps access configuration through [SmartSpectraSdk.config], or pass a prebuilt config to [SmartSpectraSdk.initialize] before using [SmartSpectraSdk.shared].
Properties
-
public var apiKey: String? = null -
public var cameraPosition: CameraPosition -
public var imageOutputEnabled: Boolean = true -
public var previewSurfaceProvider: Preview.SurfaceProvider?Optional CameraX preview surface supplied by a host app. When set, the SDK binds a CameraX [Preview] use case alongside image analysis so the host can display the camera stream through a native
PreviewViewwithout consuming bitmap image-output frames. -
public var requestedMetrics: List<MetricType>?Metrics the SDK requests for authorization and output. The getter never returns
null— when no list has been set (or after explicitly settingnull), it falls back to [breathingMetrics]. The setter acceptsnullto reset back to that default. -
public val breathingMetrics: List<MetricType> = listOf( MetricType.CHEST_BREATHING, MetricType.ABDOMEN_BREATHING, MetricType.BREATHING_RATE, MetricType.BREATHING_AMPLITUDE, MetricType.APNEA, MetricType.RESPIRATORY_LINE_LENGTH, MetricType.BASELINE, MetricType.INHALE_EXHALE_RATIO, )Breathing metric bundle. Equivalent to leaving [requestedMetrics] unset.
-
public val cardioMetrics: List<MetricType> = listOf( MetricType.PULSE_RATE, MetricType.ARTERIAL_PRESSURE_TRACE, MetricType.HRV, )Cardio metric bundle (pulse rate, arterial pressure trace, HRV). Combine with [breathingMetrics] for the typical "vitals" bundle.
-
public val faceMetrics: List<MetricType> = listOf( MetricType.FACE_LANDMARKS, MetricType.BLINKING, MetricType.TALKING, MetricType.EXPRESSIONS, )Face metric bundle (landmarks, blinking, talking, expressions). Requires the face-metrics-enabled bundle.
CameraPosition
public fun fromLensFacing(@CameraSelector.LensFacing lensFacing: Int): CameraPosition = when (lensFacing)FRONTBACK
ProcessingStatus
IDLESTARTINGRUNNINGSTOPPINGERROR
ValidationStatus
Properties
-
val code: ValidationCode -
val hint: String
ValidationCode
OK(0)NO_FACE_FOUND(1)MULTIPLE_FACES_FOUND(2)FACE_NOT_CENTERED(3)FACE_SIZE_OUT_OF_RANGE(4)TOO_DARK(5)TOO_BRIGHT(6)CHEST_NOT_VISIBLE(7)CAMERA_TUNING(10)
SmartSpectraError
A typed error from the SmartSpectra SDK. Lifecycle methods throw [SmartSpectraException] wrapping this type, and async pipeline failures are published on [SmartSpectraSdk.error].
Properties
-
val code: Code -
val message: String -
val retryable: Boolean = false
SmartSpectraError.Code
SDK error codes. Raw values are stable across SDK versions and match the C++/Swift wire values. Never change an existing value; only append new codes at the end.
INVALID_STATE(1)AUTHENTICATION_FAILED(2)CONFIGURATION_FAILED(3)CREDIT_EXHAUSTED(4)NETWORK_ERROR(5)SERVER_ERROR(6)INPUT_UNAVAILABLE(7)PROCESSING_FAILED(8)FRAME_CONVERSION_FAILED(9)NON_MONOTONIC_TIMESTAMP(10)
SmartSpectraException
Properties
-
val error: SmartSpectraError