Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errror EDS_ERR_DEVICE_NOT_FOUND when opening canon camera session ( EdsOpenSession(cRef))

I am developing a Windows 8 metro application which can control the canon camera.My application detects the camera and also gets the device information.But when I open camera session "err = EdsOpenSession(cRef)" , I get an error "EDS_ERR_DEVICE_NOT_FOUND".

But I got the camera detected when I call below function -

private uint GetFirstCamera()
    {
        // Variable initilazions
        IntPtr cameraList;
        uint err;
        int count;

        // Get list of cameras;
        err = EdsGetCameraList(out cameraList);

        if (err != EDS_ERR_OK)
        {
            return err;
        }

        // Get count of cameras in list
        err = EdsGetChildCount(cameraList, out count);

        if (err != EDS_ERR_OK)
        {
            return err;
        }
        if (count == 0)
        {
            return EDS_ERR_DEVICE_NOT_FOUND;
        }

        // Get first camera to public cRef
        err = EdsGetChildAtIndex(cameraList, 0, out cRef);

        if (err != EDS_ERR_OK)
        {
            return err;
        }

        EDSDKLib.EDSDK.EdsDeviceInfo deviceInfo;

        //Canon EOS REBEL T1i

        if (err == EDS_ERR_OK)
        {
            err = EdsGetDeviceInfo(cRef, out deviceInfo);

            if (err == EDS_ERR_OK & (cRef == null) == true)
            {
                err = (uint)EDS_ERR_DEVICE_NOT_FOUND;
            }

        }

        // release camera list
        if (cameraList != null)
        {
            EdsRelease(cameraList);
        }

        // everything went just fine
        return EDS_ERR_OK;
    }

Here is my complete initialise code -

public uint Initialize()
    {
        // err init
        uint err;
        // Initilize SDK.
        // SDK initilizion is needed to use EDSDK functions
        err = EdsInitializeSDK();

        // In case of error pass it on...
        if (err != EDS_ERR_OK)
        {
            return err;
        }

        // get first camera connected to computer
        err = GetFirstCamera(); // **MY CAMERA IS DETECTED IN THIS FUNCTION**

        if (err != EDS_ERR_OK)
        {
            return err;
        }

        err = EdsSetObjectEventHandler(cRef, ObjectEvent_All, ObjectEventHandler, IntPtr.Zero);



        // Open session to camera
        // **ERROR HAPPENS HERE .RETURNS  ERROR CODE 128 -  EDS_ERR_DEVICE_NOT_FOUND** 
        err = EdsOpenSession(cRef); 



        if (err != EDS_ERR_OK)
        {
            return err;
        }

        // We don't want to save pictures to the camera so lets set save target to host
        err = EdsSetPropertyData(cRef, PropID_SaveTo, 0, 4, 1);

        return err;
    }

I tried the same code on WPF application and it works.This happens only in Windows store apps/Metro apps.My camera model is Canon EOS REBEL T1i.SDK version I use is 2.11.

like image 947
user1926195 Avatar asked Nov 12 '22 03:11

user1926195


1 Answers

A metro app can't talk to the device outside of the sandbox. Reason 426 that I do not write metro apps.

like image 59
joe.feser Avatar answered Jan 04 '23 02:01

joe.feser