StreamSubscribe Method

CVB.Net Documentation
Notifies this stream that the given observer is to receive new image notifications.

Namespace:  Stemmer.Cvb.Driver
Assembly:  Stemmer.Cvb (in Stemmer.Cvb.dll) Version: 14.0.0.0
Syntax

public virtual IDisposable Subscribe(
	IObserver<StreamImage> observer
)

Parameters

observer
Type: SystemIObserverStreamImage
Observer to receive image notifications.

Return Value

Type: IDisposable
Reference to an interface to allow stop receiving notifications (unsubscribe).

Implements

IObservableTSubscribe(IObserverT)
Remarks

When subscribing to a stream which is not running (see IsRunning), this stream is Started. If this stream IsIndexed it runs by default until all images are delivered once. For endless streams it keeps running until all subscribed observers are unsubscribed via the returned IDisposable object or Stop/Abort is called. If one of these two functions is called or this stream IsIndexed, all subscribed observers receive the OnCompleted notification.

If you wish to automatically loop IndexedStreams, you need to set LoopObservers to true.

The stream is kept running even if OnError(Exception) is called. Note, though, that if you use the reactive extensions (System.Reactive), they will unsubscribe in this case and you need to resetup your application. Thus if you use your own IObserverT implementation you can handle it as you wish.

The acquisition loop is run in a long running Task and using Wait. Thus there are no timeouts. Unsubscribing all observers will result in Abort being called.

Manually calling Wait or WaitFor(UsTimeSpan) is forbidden as long as there is at least one subscribed observer.

See Also

Reference