//------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. All rights reserved. // //------------------------------------------------------------------------------ namespace Microsoft.Samples.Kinect.Webserver.Sensor { using System; using System.Threading.Tasks; using Microsoft.Samples.Kinect.Webserver.Sensor.Serialization; /// /// Provides context through which an instance of can /// communicate back with its owner. /// public sealed class SensorStreamHandlerContext { /// /// Initializes a new instance of the class. /// /// /// Function used to asynchronously send two-part (textual header plus binary payload) stream /// message to client(s) of stream handler. If binary (second) part of message is null, only /// textual header (first) part will be sent. /// /// /// Function used to asynchronously send event message to client(s) of stream handler. /// public SensorStreamHandlerContext( Func sendTwoPartStreamMessageAsync, Func sendEventMessageAsync) { this.SendTwoPartStreamMessageAsync = sendTwoPartStreamMessageAsync; this.SendStreamMessageAsync = message => sendTwoPartStreamMessageAsync(message, null); this.SendEventMessageAsync = sendEventMessageAsync; } /// /// Function used to asynchronously send stream message to client(s) of stream handler. /// public Func SendStreamMessageAsync { get; private set; } /// /// Function used to asynchronously send two-part (textual header plus binary payload) stream /// message to client(s) of stream handler. If binary (second) part of message is null, only /// textual header (first) part will be sent. /// public Func SendTwoPartStreamMessageAsync { get; private set; } /// /// Function used to asynchronously send event message to client(s) of stream handler. /// public Func SendEventMessageAsync { get; private set; } } }