ringbuffer and statistics
This commit is contained in:
41
VisionBuilder.UI.Camera/ModuleExtensions.cs
Normal file
41
VisionBuilder.UI.Camera/ModuleExtensions.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using Hawkeye.VisionBuilder.UI.Sources.Emulation;
|
||||
using Ninject;
|
||||
using Ninject.Extensions.ChildKernel;
|
||||
using VisionBuilder.UI.Common;
|
||||
using VisionBuilder.UI.Common.RecipeProcessing;
|
||||
|
||||
namespace Lindt.Colorballs.Duo.Utils;
|
||||
|
||||
public static class ModuleExtensions
|
||||
{
|
||||
public static IChildKernel RegisterCamera(this IChildKernel self, string cameraName)
|
||||
{
|
||||
self.Bind<CameraSettings, ISettings>().ToConstant(new CameraSettings(cameraName));
|
||||
self.Bind<EmulationSettings, ISettings>().ToConstant(new EmulationSettings(cameraName));
|
||||
return self;
|
||||
}
|
||||
private static void BindCameras(CameraSettings cameraSettings, IChildKernel kernel)
|
||||
{
|
||||
switch (cameraSettings.CameraSource)
|
||||
{
|
||||
case CameraSettings.EImageSource.Emulation:
|
||||
|
||||
kernel.Bind<IImageSource, IVisionBuilderModule>().To<EmulationCameraImageSource>().InSingletonScope();
|
||||
break;
|
||||
case CameraSettings.EImageSource.Hawkeye:
|
||||
break;
|
||||
case CameraSettings.EImageSource.IDS:
|
||||
break;
|
||||
case CameraSettings.EImageSource.Basler:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
public static IChildKernel UseCamera(this IChildKernel self)
|
||||
{
|
||||
var cameraSettings = self.Get<CameraSettings>();
|
||||
BindCameras(cameraSettings, self);
|
||||
return self;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user