Header menu logo Xanthos

DownloadMonitor Module

Utilities for monitoring JV-Link download progress.

JV-Link downloads data asynchronously. After calling JVOpen, use JVStatus to poll for completion. This module provides a helper to wait for downloads to finish with timeout and cancellation support.

Functions and values

Function or value Description

waitForCompletion statusCall expectedDownloadCount pollIntervalOpt timeoutOpt cancellationTokenOpt

Full Usage: waitForCompletion statusCall expectedDownloadCount pollIntervalOpt timeoutOpt cancellationTokenOpt

Parameters:
    statusCall : unit -> Result<int, ComError> - Function that calls JVStatus and returns the completed count.
    expectedDownloadCount : int - Number of files expected to be downloaded.
    pollIntervalOpt : TimeSpan option - Time between status polls. Default: 500ms.
    timeoutOpt : TimeSpan option - Maximum time to wait. None = wait indefinitely.
    cancellationTokenOpt : CancellationToken option - Token to cancel the wait operation.

Returns: Result<WaitCompletionResult, ComError> Ok(Completed count) on success, Ok(TimedOut partialCount) on timeout, or Error if statusCall fails. Throws OperationCanceledException if cancellation is requested.

Polls JV-Link via JVStatus until the reported completed file count reaches the expected value, or cancellation/timeout occurs.

statusCall : unit -> Result<int, ComError>

Function that calls JVStatus and returns the completed count.

expectedDownloadCount : int

Number of files expected to be downloaded.

pollIntervalOpt : TimeSpan option

Time between status polls. Default: 500ms.

timeoutOpt : TimeSpan option

Maximum time to wait. None = wait indefinitely.

cancellationTokenOpt : CancellationToken option

Token to cancel the wait operation.

Returns: Result<WaitCompletionResult, ComError>

Ok(Completed count) on success, Ok(TimedOut partialCount) on timeout, or Error if statusCall fails. Throws OperationCanceledException if cancellation is requested.

Type something to start searching.