createForNSDKResult
Declaration
fun <T, E : com.nianticspatial.nsdk.ErrorCodeProvider> createForNSDKResult( pollingIntervalMs: Long, pollFunction: () -> NSDKResult<T, E>, frameIdExtractor: ((T) -> Long)? = null ): FlowPollingManager<NSDKResult<T, E>>
Summary
Parameters
| Name | Type | Summary |
|---|---|---|
| pollingIntervalMs | Long | Interval between polling attempts in milliseconds |
| pollFunction | () -> NSDKResult<T, E> | Function that returns ARDKResult<T, E> |
| frameIdExtractor | ((T) -> Long)? | Function to extract frame ID from Success value. Should return 0L for Error cases. |
Creates a FlowPollingManager specifically for ARDKResult types, reducing boilerplate code.
This helper automatically handles ARDKResult.Success and ARDKResult.Error cases:
- Success results are deduplicated based on frameIdExtractor
- Error results are emitted when they differ from the previous result, so a change from
one error to another is reported, but the same error is not repeated on every poll