Canon EDSDK / automatic last picture download

zanroversi's picture


Continuing here and there to experiment with Canon EDSDK (2.10)... (by the way, v 2.113 do not even compile for me)

I was turning mad with direct image download just after a picture has been taken from the internal buffer (no memory card in camera), shutter programmatically triggered.

because : • If I build and run in X-Code the Canon test-app "CameraControl" then the pictures are saved correctly in the folder of the build app.

• If I run the app itself (not by "build and run in X-Code") this do not work ! The camera shutter fires normally, but the stream of data can't be created (EDS_ERR_STREAM_OPEN_ERROR), and no file is written.

If you encounter the same problem, try to locate the "EdsCreateFileStream" function in the "DownloadCommand.m" and replace it with the alternate stream create function : "EdsCreateFileStreamEx". (Moreover, you can easily set a specific folder for images).

In my case :

NSString * thePath = [NSString stringWithFormat:@"%@/Canon_Images/%s", NSDesktopDirectory, directoryItemInfo.szFileName]; CFURLRef url = (CFURLRef)[NSURL fileURLWithPath:thePath]; error = EdsCreateFileStreamEx(url, kEdsFileCreateDisposition_CreateAlways, kEdsAccess_ReadWrite, &stream);

instead of :

error = EdsCreateFileStream(directoryItemInfo.szFileName, kEdsFileCreateDisposition_CreateAlways, kEdsAccess_ReadWrite, &stream);

Hope this will be useful for someone !