JvLinkService Type
High-level service for interacting with JV-Link COM API.
Thread Safety: This class is NOT thread-safe and enforces single-operation access
at runtime using a reentrancy guard. Concurrent calls to long-running methods
(FetchPayloads, FetchPayloadsWithBytes, StreamRealtimePayloads) will fail immediately
with an InvalidState error rather than causing undefined behavior.
If you need to use JvLinkService in a multi-threaded environment (e.g., ASP.NET Core with concurrent HTTP requests), either:
- Create a separate JvLinkService instance per request (scoped lifetime)
- Use a dedicated background service with a queue for JV-Link operations
Constructors
| Constructor |
Description
|
Full Usage:
JvLinkService(client, config, ?logger, ?waitScheduler, ?pollingPolicy, ?retryConfig, ?eventQueueCapacity)
Parameters:
IJvLinkClient
config : JvLinkConfig
?logger : TraceLogger
?waitScheduler : IWaitScheduler
?pollingPolicy : PollingPolicy
?retryConfig : ComRetryConfig
?eventQueueCapacity : int
Returns: JvLinkService
|
|
Instance members
| Instance member |
Description
|
|
Requests JV-Link to cancel the active download thread. Note: This requires an active JVOpen/JVRTOpen session - do not re-initialize.
|
Full Usage:
this.CheckMovieAvailability
Parameters:
MovieType
key : string
Returns: Result<MovieAvailability, XanthosError>
|
Checks whether a movie is available for the specified movietype via `JVMVCheckWithType`.
|
Full Usage:
this.CheckMovieAvailability
Parameters:
string
Returns: Result<MovieAvailability, XanthosError>
|
Checks whether a race movie is currently available via `JVMVCheck`.
|
|
Deletes a previously downloaded file from the JV-Link save path. The filename is passed directly to JVFiledelete without text normalization to preserve full-width characters that may be present in valid file paths.
|
Full Usage:
this.Dispose
|
Releases all resources used by the JvLinkService. |
Full Usage:
this.FetchPayloads
Parameters:
string
fromTime : DateTime option
?openOption : int
?cancellationToken : CancellationToken
Returns: Result<JvPayload list, XanthosError>
|
|
Full Usage:
this.FetchPayloads
Parameters:
JvOpenRequest
?cancellationToken : CancellationToken
Returns: Result<JvPayload list, XanthosError>
|
Fetches all available payloads for the specified request, returning them as a materialised list.
|
Full Usage:
this.FetchPayloadsWithBytes
Parameters:
string
fromTime : DateTime option
?openOption : int
?cancellationToken : CancellationToken
Returns: Result<(JvPayload list * int64), XanthosError>
|
|
Full Usage:
this.FetchPayloadsWithBytes
Parameters:
JvOpenRequest
?cancellationToken : CancellationToken
Returns: Result<(JvPayload list * int64), XanthosError>
|
Fetches payloads along with the total byte count transferred during the request.
|
Full Usage:
this.FetchPayloadsWithSize
Parameters:
string
fromTime : DateTime option
?openOption : int
?cancellationToken : CancellationToken
Returns: Result<(JvPayload list * int64), XanthosError>
|
|
Full Usage:
this.FetchPayloadsWithSize
Parameters:
JvOpenRequest
?cancellationToken : CancellationToken
Returns: Result<(JvPayload list * int64), XanthosError>
|
|
Full Usage:
this.FetchTypedRecords
Parameters:
string
-
The dataspec string (e.g., "RACE" for race data).
fromTime : DateTime option
-
Start time for data retrieval (required by JVOpen).
?openOption : int
-
Optional open option (default: 1 for standard, 2 for setup without dialog).
?cancellationToken : CancellationToken
-
Optional cancellation token.
Returns: Result<ParsedRecord list, XanthosError>
|
Fetches payloads and parses them into strongly typed domain records.
|
Full Usage:
this.FetchTypedRecords
Parameters:
JvOpenRequest
-
The JV-Link open request specifying dataspec and time range.
?cancellationToken : CancellationToken
-
Optional cancellation token.
Returns: Result<ParsedRecord list, XanthosError>
A list of parsed records or the first error encountered.
|
Fetches payloads and parses them into strongly typed domain records. Fails fast on the first parse error.
|
Full Usage:
this.FetchTypedRecordsCollectErrors
Parameters:
JvOpenRequest
-
The JV-Link open request specifying dataspec and time range.
?cancellationToken : CancellationToken
-
Optional cancellation token.
Returns: Result<(ParsedRecord list * (JvPayload * XanthosError) list), XanthosError>
A tuple of successfully parsed records and failed payloads with their errors.
|
Fetches payloads and parses them, collecting both successes and failures.
|
Full Usage:
this.FetchWorkoutVideos
Parameters:
MovieType
searchKey : string
Returns: Result<WorkoutVideoListing list, XanthosError>
|
Fetches workout video listings via `JVMVOpen`/`JVMVRead` for the specified movietype.
|
Full Usage:
this.GenerateSilksFile
Parameters:
string
outputPath : string
Returns: Result<SilksImage, XanthosError>
|
Generates a silks (勝負服) bitmap on disk using This utility function does not open a JV-Link session (JVOpen/JVRTOpen), so it does not close any session. It can be safely used while other sessions are active.
|
Full Usage:
this.GetCourseDiagram
Parameters:
string
Returns: Result<CourseDiagram, XanthosError>
|
Retrieves a course diagram (file path + explanation) using `JVCourseFile`. This utility function does not open a JV-Link session (JVOpen/JVRTOpen), so it does not close any session. It can be safely used while other sessions are active.
|
Full Usage:
this.GetCourseDiagramBasic
Parameters:
string
filepath : string
Returns: Result<CourseDiagram, XanthosError>
|
Saves a course diagram to the specified filepath using `JVCourseFile2`. This utility function does not open a JV-Link session (JVOpen/JVRTOpen), so it does not close any session. It can be safely used while other sessions are active. The filepath must be a full path to a file in an existing directory.
|
|
Returns the timestamp of the file currently being read, if reported by JV-Link.
|
|
Returns the size of the currently read file as reported by JV-Link.
|
|
Retrieves the JV-Link version string reported by the COM layer.
|
|
Retrieves the parent window handle configured for JV-Link dialogs.
|
|
Returns whether payoff dialogs are suppressed within JV-Link.
|
Full Usage:
this.GetSaveDownloadsEnabled
Returns: Result<bool, XanthosError>
Ok(bool) on success, or Error if the property cannot be read.
|
Returns whether JV-Link is configured to persist downloads to disk.
|
Full Usage:
this.GetSavePath
Returns: Result<string, XanthosError>
Ok(string) on success, or Error if the property cannot be read.
|
Retrieves the configured JV-Link save path.
|
Full Usage:
this.GetServiceKey
Returns: Result<string, XanthosError>
Ok(string) on success, or Error if the property cannot be read.
|
Gets the JV-Link service key currently configured.
|
Full Usage:
this.GetSilksBinary
Parameters:
string
Returns: Result<SilksImage, XanthosError>
|
Retrieves a silks (勝負服) bitmap as binary data using This utility function does not open a JV-Link session (JVOpen/JVRTOpen), so it does not close any session. It can be safely used while other sessions are active.
|
|
Retrieves the number of files whose download has completed for the current session. Note: This requires an active JVOpen/JVRTOpen session - do not re-initialize.
|
|
Returns the total remaining download size in KB (kilobytes) as reported by JV-Link.
JV-Link returns
|
|
Returns the total remaining download size in bytes.
Converts JV-Link's
|
Full Usage:
this.PlayMovie
Parameters:
MovieType
key : string
Returns: Result<unit, XanthosError>
|
Requests movie playback for a specified movietype via `JVMVPlayWithType`.
|
|
|
Full Usage:
this.SetParentWindowHandle
Parameters:
IntPtr
Returns: Result<unit, XanthosError>
|
Sets the parent window handle used for JV-Link dialogs.
|
Full Usage:
this.SetPayoffDialogSuppressed
Parameters:
bool
Returns: Result<unit, XanthosError>
|
Configures payoff dialog suppression within JV-Link.
|
Full Usage:
this.SetSaveDownloadsEnabled
Parameters:
bool
Returns: Result<unit, XanthosError>
|
Updates the JV-Link save flag (persist downloads to disk).
|
|
|
|
|
|
Displays the JV-Link configuration dialog via `JVSetUIProperties`.
|
|
Skips the current download file and advances the JV-Link cursor. Note: This requires an active JVOpen/JVRTOpen session - do not re-initialize.
|
|
Starts JV-Link watch event notifications.
Events are queued to a dedicated background thread to avoid blocking the COM STA thread while preserving FIFO event order. Subscribers should still be lightweight; for heavy processing, offload to a Task or use Reactive Extensions operators like ObserveOn.
If events arrive faster than the subscriber can process them and the queue fills up,
incoming events are dropped and an
|
|
Stops JV-Link watch event notifications.
|
Full Usage:
this.StreamPayloads
Parameters:
string
fromTime : DateTime option
?openOption : int
Returns: Result<JvPayload, XanthosError> seq
|
Lazily streams payloads from a JV-Link session (`JVOpen`) until EndOfStream.
|
Full Usage:
this.StreamPayloads
Parameters:
JvOpenRequest
-
The JV-Link open request specifying dataspec and time range.
Returns: Result<JvPayload, XanthosError> seq
|
Lazily streams payloads from a JV-Link session (`JVOpen`) until EndOfStream.
Unlike FetchPayloads, this method yields payloads one at a time without accumulating them in memory. Use this for large data requests where memory is a concern.
Each element in the sequence is a
|
Full Usage:
this.StreamPayloadsAsync
Parameters:
string
fromTime : DateTime option
?openOption : int
?pollInterval : TimeSpan
?cancellationToken : CancellationToken
Returns: IAsyncEnumerable<Result<JvPayload, XanthosError>>
|
Asynchronously streams payloads from a JV-Link session (`JVOpen`), with cancellation support.
|
Full Usage:
this.StreamPayloadsAsync
Parameters:
JvOpenRequest
-
The JV-Link open request specifying dataspec and time range.
?pollInterval : TimeSpan
-
Interval between polls when waiting for downloads (default: 500ms)
?cancellationToken : CancellationToken
-
Token to request cancellation of the stream
Returns: IAsyncEnumerable<Result<JvPayload, XanthosError>>
|
Asynchronously streams payloads from a JV-Link session (`JVOpen`), with cancellation support.
Unlike FetchPayloads, this method yields payloads one at a time without accumulating them in memory. Use this for large data requests where memory is a concern. Cancellation behavior: The cancellation token is checked between COM operations and affects polling delays. However, individual COM calls (JVRead, etc.) cannot be interrupted mid-execution due to COM threading constraints.
|
Full Usage:
this.StreamRealtimeAsync
Parameters:
string
-
Data spec ID (4 characters, e.g., "0B12", "0B11", "0B16")
key : string
-
Request key: "YYYYMMDDJJKKHHRR" (race), "YYYYMMDD" (daily), or WatchEvent parameter
?pollInterval : TimeSpan
-
Interval between polls when no data is available (default: 100ms)
?cancellationToken : CancellationToken
-
Token to request cancellation of the stream
Returns: IAsyncEnumerable<Result<JvPayload, XanthosError>>
|
Asynchronously streams payloads from a real-time session (`JVRTOpen`), polling until cancelled.
Cancellation behavior: The cancellation token is checked between COM operations and affects polling delays. However, individual COM calls (JVRead, etc.) cannot be interrupted mid-execution due to COM threading constraints. If a COM call is in progress when cancellation is requested, the operation will complete (or timeout) before the cancellation takes effect. This ensures COM resources remain in a consistent state. For immediate responsiveness to cancellation, consider using shorter poll intervals. The service's internal timeout (configured via retry policy) provides an upper bound on how long a hung COM call can block before the service becomes poisoned.
|
Full Usage:
this.StreamRealtimePayloads
Parameters:
string
-
Data spec ID (4 characters, e.g., "0B12", "0B11", "0B16")
key : string
-
Request key: "YYYYMMDDJJKKHHRR" (race), "YYYYMMDD" (daily), or WatchEvent parameter
Returns: Result<JvPayload, XanthosError> seq
|
Lazily streams payloads from a real-time session (`JVRTOpen`) until EndOfStream. For continuous polling, use `StreamRealtimeAsync` which polls until cancelled.
|
Full Usage:
this.StreamRealtimePayloadsAsync
Parameters:
string
key : string
?pollInterval : TimeSpan
?cancellationToken : CancellationToken
Returns: IAsyncEnumerable<Result<JvPayload, XanthosError>>
|
Backwards-compatible alias for StreamRealtimeAsync.
|
|
Observable sequence of watch events (`JVWatchEvent` callbacks).
Events are delivered as
The queue capacity defaults to 10,000 events and can be configured via the
|
Static members
| Static member |
Description
|
Full Usage:
JvLinkService.ClearDiagnosticsSink()
|
Clears the COM diagnostic sink so traces fall back to stdout. |
Full Usage:
JvLinkService.ConfigureDiagnosticsSink(sink)
Parameters:
string -> unit
|
Routes low-level COM diagnostics (emitted by
|
Full Usage:
JvLinkService.GetRecordTypeId(data)
Parameters:
byte[]
-
Raw payload bytes.
Returns: string
The record type identifier (e.g., "TK", "RA", "SE").
|
Extracts the 2-character record type identifier from payload data.
|
Full Usage:
JvLinkService.IsComAvailable()
Returns: bool
|
Performs a lightweight COM activation check to confirm whether JV-Link is available on the current host.
|
Full Usage:
JvLinkService.ParsePayload(payload)
Parameters:
JvPayload
-
The payload to parse.
Returns: Result<ParsedRecord, XanthosError>
The parsed record or an error.
|
Parses a single JV payload into a typed domain record.
|
Full Usage:
JvLinkService.ParsePayloads(payloads)
Parameters:
JvPayload list
-
The payloads to parse.
Returns: Result<ParsedRecord list, XanthosError>
The list of parsed records or the first error encountered.
|
Parses multiple JV payloads into typed domain records.
|
Full Usage:
JvLinkService.TryParsePayloads(payloads)
Parameters:
JvPayload list
-
The payloads to parse.
Returns: ParsedRecord list * (JvPayload * XanthosError) list
A tuple of successfully parsed records and failed payloads with their errors.
|
Parses multiple JV payloads, collecting both successes and failures.
|
Xanthos