using System.Drawing; using System.Threading; using System.Threading.Tasks; namespace IPCamLib { /// /// Receives frames from an ICamera. /// public interface ICameraObserver { /// /// Called when a frame has been decoded from an ICamera. /// /// The decoded image. Task OnFrame(Image image); } /// /// Abstracts an IP camera stream. /// public interface ICamera { /// /// Starts receiving frames. /// /// /// The implementation should continue receiving frames until it is disconnected (if streaming), /// a request fails (if polling) or the cancellationToken is cancelled. Reconnecting is done by /// the caller which will call Fetch again. Do not keep connection-specific state between calls to Fetch. /// Running on a separate thread is also handled by the caller, the returning Task should not complete until disconnected. /// /// The observer implementation to receive frames. /// A CancellationToken which will stop the camera stream when cancelled. Task Fetch(ICameraObserver observer, CancellationToken cancellationToken); } }