# NsdkSessionDataSource Source: https://www.nianticspatial.com/docs/api/kotlin/com.nianticspatial.nsdk.NsdkSessionDataSource/ NsdkSessionDataSource --- ## Declaration interface NsdkSessionDataSource ## Summary Provides synchronous, pull-based access to the latest available sensor data required by [NSDKSession]. All methods must be non-blocking and thread-safe. Returned values represent the most recent samples already captured by the underlying services. Implement this interface and assign it to [NSDKSession.dataSource], then call [NSDKSession.update] once per camera frame to submit data to the native layer. ## See also DefaultSessionDataSource -- for the standard ARCore + sensor implementation. PlaybackSessionDataSource -- for dataset playback. --- ## Functions | Name | Type | Summary | | --- | --- | --- | | latestCameraSample | CameraSample? | Returns the most recent camera sample, or null if unavailable. | | latestCompassSample | Compass? | Returns the most recent compass/magnetometer reading, or null if unavailable. | | latestDepthSample | DepthSample? | Returns the most recent platform depth sample (e.g. LiDAR), or null if unavailable. | | latestGpsSample | Location? | Returns the most recent GPS location, or null if unavailable. | | latestTrackingStateSample | TrackingState | Returns the current VIO tracking state. | | prepareFrame | Boolean | Snapshots the current frame data so that [latestCameraSample] and the other accessorscan be called from any thread. Returns true when a frame is ready to be consumed, falseif no frame was available -- in which case the caller should skip [NSDKSession.update].The default implementation returns true and does nothing; data sources that hold noper-frame state do not need to override it.**Threading contract**: the caller must ensure that [prepareFrame], [NSDKSession.update],and any `latest*` accessor calls are serialized -- i.e., a complete`prepareFrame -> update -> (accessors finish)` cycle must complete before the next[prepareFrame] call begins. This is typically achieved by driving the cycle from asingle-threaded executor or a coroutine with an in-flight gate. | ---