// -----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// -----------------------------------------------------------------------
namespace Microsoft.Samples.Kinect.Webserver.Sensor
{
using System;
using Microsoft.Samples.Kinect.Webserver.Properties;
///
/// The supported sensor stream type.
///
public enum StreamHandlerType
{
Skeleton,
Interaction,
BackgroundRemoval,
SensorStatus,
}
///
/// Implementation of ISensorStreamHandlerFactory used to create instances of
/// sensor stream handler objects.
///
public class SensorStreamHandlerFactory : ISensorStreamHandlerFactory
{
///
/// The type of the created stream.
///
private readonly StreamHandlerType streamType;
///
/// Initializes a new instance of the class.
///
/// The stream type.
public SensorStreamHandlerFactory(StreamHandlerType streamType)
{
this.streamType = streamType;
}
///
/// Creates a sensor stream handler object and associates it with a context that
/// allows it to communicate with its owner.
///
///
/// An instance of class.
///
///
/// A new instance.
///
public ISensorStreamHandler CreateHandler(SensorStreamHandlerContext context)
{
switch (streamType)
{
case StreamHandlerType.Skeleton:
return new SkeletonStreamHandler(context);
case StreamHandlerType.Interaction:
return new InteractionStreamHandler(context);
case StreamHandlerType.BackgroundRemoval:
return new BackgroundRemovalStreamHandler(context);
case StreamHandlerType.SensorStatus:
return new SensorStatusStreamHandler(context);
default:
throw new NotSupportedException(Resources.UnsupportedStreamType);
}
}
}
}