IsoTpFunctionalListener Class¶
A standing subscription to a functional client's response range, from which Single-Frame responses are collected window by window. Unlike CollectResponsesAsync(TimeSpan, CancellationToken), which subscribes for each call, the subscription is made once, by Listen(), and kept until the listener is disposed: a response that arrives between two collections is buffered and returned by the next one, and one that arrives before the first collection begins is not missed. Obtain it before the request goes out, and no fast reply is lost.
Inheritance Object → IsoTpFunctionalListener
Implements IDisposable
Remarks¶
Collections are sequential: call CollectAsync(TimeSpan, CancellationToken) again only after the previous call completed. The subscription buffer is bounded and drops the oldest frame when full, so a listener left uncollected for long may lose the earliest of what arrived.
Methods¶
IsoTpFunctionalListener.CollectAsync(TimeSpan, CancellationToken) Method¶
Collects the Single-Frame responses that arrive on the subscription within window, together with those buffered since the previous collection. A response that arrives after the window ends but before this call returns is kept for the next collection, not returned by this one.
public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<CanKit.Pro.IsoTp.IsoTpFunctionalResponse>> CollectAsync(System.TimeSpan window, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
Parameters¶
window TimeSpan
Duration to collect responses. Zero or less returns what is buffered without waiting.
cancellationToken CancellationToken
Cancels the collection; what was collected is lost.
Returns¶
Task<IReadOnlyList<IsoTpFunctionalResponse>>
The responses, in arrival order; empty if none arrived.
Exceptions¶
ObjectDisposedException
The listener was disposed, or its subscription ended underneath it -- the service was
disposed -- which a collection in progress reports by returning what was buffered, and
every collection after it by this exception.
ArgumentOutOfRangeException
window exceeds what a timer can measure; nothing buffered is lost.
IsoTpFunctionalListener.Dispose() Method¶
Ends the subscription. A collection in progress ends with it.
Implements Dispose()