Library - No events after CameraConnected

Post Reply
itsamaik
Posts: 2
Joined: Mon Apr 30, 2018 5:59 pm

Library - No events after CameraConnected

Post by itsamaik » Mon Apr 30, 2018 6:28 pm

Hi,

I'm trying to use the library of DigiCamControl (2.0.73-beta). I've installed the NuGet package in a C# Console Application for testing. In this application, I've hooked up some basic Console.Writeline's to the events and logging class to see what is happening. The library detects my Canon EOS 600D and fires the CameraConnected event, but doesn't fire any PhotoCaptured/CameraDisconnected-events after that moment.

This is my testcode:

Code: Select all

static void Main(string[] args)
        {
            var DeviceManager = new CameraDeviceManager();

            DeviceManager.CameraConnected += (e) => {
                Console.WriteLine($"Connected {e.DeviceName} {e.IsConnected} {e.SerialNumber}");
                DeviceManager.SelectedCameraDevice = e;
                Console.WriteLine("Taking photo");
                e.CapturePhotoNoAf();
                Console.WriteLine("Took photo");
            };
            DeviceManager.PhotoCaptured += (sender, eventArgs) => { Console.WriteLine("OK"); };
            DeviceManager.CameraDisconnected += (e) => { Console.WriteLine("Disconnected"); };

            DeviceManager.UseExperimentalDrivers = true;
            DeviceManager.DisableNativeDrivers = false;

            Log.LogError += (e) =>
            {
                Console.WriteLine($"ERROR: {e.Message}");
            };
            Log.LogDebug += (e) =>
            {
                Console.WriteLine($"DEBUG: {e.Message}");
            };
            Log.LogInfo += (e) =>
            {
                Console.WriteLine($"INFO: {e.Message}");
            };

            Console.WriteLine("Enter to continue");
            Console.ReadLine();
            Console.WriteLine("ConnectToCamera()");
            DeviceManager.ConnectToCamera();

            Console.ReadLine();
        }
And this is the output:

Code: Select all

Enter to continue

ConnectToCamera()
DEBUG: New canon camera found !
DEBUG: Pas 1
DEBUG: Pas 2
DEBUG: Connection device start
DEBUG: Connection device \\?\usb#vid_04a9&pid_3218#5&3095c79&0&2#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
DEBUG: Error get EC
ERROR: Error initialize EOS camera object
DEBUG: Pas 3
DEBUG: Pas 4
DEBUG: Pas 5
DEBUG: ===========Camera is connected==============
DEBUG: USB : VID=04a9, PID=3218
DEBUG: Driver :CanonSDKBase
DEBUG: Name :Canon EOS 600D
DEBUG: Manufacturer :Canon Inc.
Connected Canon EOS 600D True 083063027375
Taking photo
DEBUG: EOS capture start
DEBUG: EOS capture end
Took photo
DEBUG: New canon camera found done!
DEBUG: Connection device start
DEBUG: Connection device \\?\usb#vid_04a9&pid_3218#5&3095c79&0&2#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
The strange thing is that it is able to make a photo during the CameraConnected-event, but even then it doesn't fire the PhotoCaptured event. If I take a photo manually it doesn't fire either.

I've stripped the code down as far as I could, but it doesn't seem to work. I'm basically doing the exact same thing as CameraControl.Devices.Example and that one does work.

Does anyone have an idea what I'm doing wrong?

Library - No events after CameraConnected

Advertisment
 

admin
Site Admin
Posts: 90
Joined: Tue Sep 15, 2015 8:33 pm

Re: Library - No events after CameraConnected

Post by admin » Thu May 03, 2018 9:34 pm

I think the problem is the canon sdk require message pump in the application, the console application don't use such thing.
Take a look on this forum https://social.msdn.microsoft.com/Forum ... icesnative
maybe helps.

itsamaik
Posts: 2
Joined: Mon Apr 30, 2018 5:59 pm

Re: Library - No events after CameraConnected

Post by itsamaik » Mon May 07, 2018 3:42 pm

Right on point, perfect, thank you! I managed to get it working within my app as well by taking the message pump into consideration. Thank you for the help and the amazing library!


Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest