Skip to main content
API Reference NSDK

NSDKDepthSession

Depth feature session for NSDK with Combine publisher support....

Declaration

final class NSDKDepthSession

Summary

Depth feature session for NSDK with Combine publisher support. Upon starting the depth session, NSDK will begin processing AR frames to generate depth data. The latest depth data can be retrieved using latestDepth(), and latestImageParams() provides information to synchronize the depth image with camera frame. $result is refreshed automatically each frame by NSDKSession.update() while the session is active. Subscribe to it with Combine:

depthSession.$result
.compactMap { if case .success(let result) = $0 { return result } else { return nil } }
.sink { result in ... }
.store(in: &cancellables)

Properties

NameTypeSummary
@Published var resultNSDKAsyncState<DepthResult, AwarenessError
The current depth result. Updated each frame by NSDKSession while active.

Methods

NameTypeSummary
configurevoid
Configures the session with the specified settings.
- Attention: This method must be called while the session is stopped,
or else configuration will fail. In that case, while this function returns without
throwing, configuration will still fail asynchronously. Use featureStatus()
to check that configuration has not failed.
- Parameter config: An object that defines this session's behavior.
Only settings that differ from the defaults will be applied.
- Throws: NSDKError.invalidArgument if the configuration is invalid.
Check NSDK's C logs for more information.
featureStatusNSDKFeatureStatus
The current feature status of the depth session.
latestDepthNSDKAsyncState<DepthResult, AwarenessError>
Retrieves the latest depth result from the depth session.
- Returns: An NSDKAsyncState containing either the latest DepthResult,
or an AwarenessError.
latestImageParamsNSDKAsyncState<AwarenessImageParams, AwarenessError>
Retrieves the latest image parameters associated with the depth data.
- Returns: An NSDKAsyncState containing either the latest AwarenessImageParams,
or an AwarenessError.
startvoid
Starts the depth session, enabling depth data processing with the current configuration.
stopvoid
Stops the depth session, halting depth data processing.

Nested Types

Structs

NameTypeSummary
ConfigurationConfiguration
The type of configuration used by this session

Enums

NameTypeSummary
DepthModeDepthMode
Options for different depth sensing modes.
These trade off between performance and quality.

Relationships

conforms to: NSDKFeatureSession