After a time working with DigicamControl Source Code. I've developed a simple app to take photos with an interface, something like a photo Booth.
I made all my tests with a Canon EOS 1300, and everything worked correctly.
But now I've tried the Canon EOS 4000, and the live view doesn't work, when I use the Function StartLiveView() an exception is thrown.
Methow who throws the exception:
Code: Select all
public static void Assert(uint result, string message)
{
if (Util.HasFailed(result))
throw new EosException(result, message);
}
Well, this could be an incompatibility of versions or something like that, BUT! If I execute CameraControl base Project, the live view works PERFECTLY!Canon.Eos.Framework.EosException: 'Failed to open session.'
That's why I suppose that I'm missing something when I initialize the camera.
Reading Code, and looking for the initialize method i've found that DigicamControl initialize the camera here:
App.xaml.cs
Code: Select all
// event handlers
ServiceProvider.Settings.SessionSelected += Settings_SessionSelected;
ServiceProvider.DeviceManager.CameraConnected += DeviceManager_CameraConnected;
ServiceProvider.DeviceManager.CameraSelected += DeviceManager_CameraSelected;
ServiceProvider.DeviceManager.CameraDisconnected += DeviceManager_CameraDisconnected;
//-------------------
ServiceProvider.DeviceManager.DisableNativeDrivers = ServiceProvider.Settings.DisableNativeDrivers;
if (ServiceProvider.Settings.AddFakeCamera)
ServiceProvider.DeviceManager.AddFakeCamera();
ServiceProvider.DeviceManager.LoadWiaDevices = ServiceProvider.Settings.WiaDeviceSupport;
ServiceProvider.DeviceManager.DetectWebcams = ServiceProvider.Settings.WebcamSupport;
ServiceProvider.DeviceManager.ConnectToCamera();
if (ServiceProvider.Settings.DisableHardwareAccelerationNew)
OpenCL.IsEnabled = false;
Code: Select all
public void InitCamera()
{
DeviceManager = new CameraDeviceManager();
DeviceManager.UseExperimentalDrivers = true;
DeviceManager.CameraConnected += DeviceManager_CameraConnected;
DeviceManager.CameraDisconnected += DeviceManager_CameraDisconnected;
DeviceManager.PhotoCaptured += DeviceManager_PhotoCaptured;
DeviceManager.DisableNativeDrivers = false;
DeviceManager.LoadWiaDevices = true;
DeviceManager.DetectWebcams = true;
Available = DeviceManager.ConnectToCamera();
if (Available)
{
EmitConected("Conectado a alguna cámara");
Console.WriteLine("Conectado a alguna cámara");
}
else
{
EmitError("No hay ninguna cámara :(");
}
if (DeviceManager.SelectedCameraDevice != null && DeviceManager.SelectedCameraDevice.DeviceName != null)
{
if (!DeviceManager.SelectedCameraDevice.DeviceName.ToLower().Contains("canon"))
{
for (int i = 0; i < 3 && !DeviceManager.SelectedCameraDevice.DeviceName.ToLower().Contains("canon"); i++)
{
DeviceManager.SelectNextCamera();
}
}
Available = true;
ICameraDevice cameraDevice = DeviceManager.SelectedCameraDevice;
EmitConected("¡Se ha conectado una cámara!");
Console.WriteLine("Camera conected: " + cameraDevice.DeviceName);
cameraDevice.CaptureCompleted += CameraDevice_CaptureCompleted;
}
else
{
EmitError("No se ha podido conectar a ninguna cámara :(");
}
}
If it is important, I initialize the live view just with this function:
DeviceManager.SelectedCameraDevice.StartLiveView();