0

I use EDSDK to control a canon EOS 1200D.

I try this code :

err = EdsOpenSession(_camera);
if(err != EDS_ERR_OK)
    std::cout << "[ERROR] : EdsOpenSession" << std::endl;
QThread::sleep(5);
err = EdsSetObjectEventHandler(_camera, kEdsObjectEvent_All, handleObjectEvent, (EdsVoid*)&_path);
if(err != EDS_ERR_OK)
    std::cout << "[ERROR] : EdsSetObjectEventHandler" << std::endl;    
EdsInt32 saveTarget = kEdsSaveTo_Host;
err = EdsSetPropertyData(_camera, kEdsPropID_SaveTo, 0, 4, &saveTarget);
if(err != EDS_ERR_OK)
    std::cout << "[ERROR] : EdsSetPropertyData kEdsSaveTo_Host" << std::endl;
EdsCapacity newCapacity = {0x7FFFFFFF, 0x1000, 1};
err = EdsSetCapacity(_camera, newCapacity);
if(err != EDS_ERR_OK)
    std::cout << "[ERROR] : EdsSetPropertyData newCapacity" << std::endl;
err = EdsSendCommand(_camera, kEdsCameraCommand_TakePicture, 0);
if(err != EDS_ERR_OK)
    std::cout << "[ERROR] : takePicture " << err << std::endl;

With the sleep I get the error EDS_ERR_TAKE_PICTURE_CARD_NG 0x00008D07L when I do EdsSendCommand(_camera, kEdsCameraCommand_TakePicture, 0). Without the sleep, all works well.

Does the camera session has a timeout ?

artoon
  • 729
  • 2
  • 14
  • 41

1 Answers1

1

I had the same problem in C # . I solved the problem by using a Timer component to run the rest of the code . I think the EDSDK not very fond of Threads.

If you are compiling for windows can use the SetTimer function .

The link talks about the function. https://msdn.microsoft.com/en-us/library/windows/desktop/ms644906%28v=vs.85%29.aspx

I hope you can solve your problem.